fix: update sub-products in footer
This commit is contained in:
@@ -9,6 +9,7 @@ const SELECTORS = {
|
||||
faqQuestion: '.faq-question',
|
||||
faqAnswer: '.faq-answer',
|
||||
fadeInElements: '.fade-in',
|
||||
citationCopy: '.citation-copy',
|
||||
};
|
||||
|
||||
function initNavbarScroll() {
|
||||
@@ -190,6 +191,47 @@ function initReadMore() {
|
||||
});
|
||||
}
|
||||
|
||||
function initCitationCopy() {
|
||||
const copyButtons = document.querySelectorAll(SELECTORS.citationCopy);
|
||||
if (!copyButtons.length) return;
|
||||
|
||||
copyButtons.forEach((btn) => {
|
||||
const url = btn.getAttribute('data-citation-url');
|
||||
const feedback = btn.querySelector('.citation-copy-feedback');
|
||||
if (!url || !feedback) return;
|
||||
|
||||
let resetTimer = null;
|
||||
|
||||
btn.addEventListener('click', async () => {
|
||||
clearTimeout(resetTimer);
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
} catch {
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = url;
|
||||
textarea.setAttribute('readonly', '');
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.left = '-9999px';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
}
|
||||
|
||||
feedback.hidden = false;
|
||||
btn.classList.add('is-copied');
|
||||
btn.setAttribute('aria-label', 'Link copied');
|
||||
|
||||
resetTimer = setTimeout(() => {
|
||||
feedback.hidden = true;
|
||||
btn.classList.remove('is-copied');
|
||||
btn.setAttribute('aria-label', 'Copy citation link');
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function init() {
|
||||
initNavbarScroll();
|
||||
initMobileMenu();
|
||||
@@ -197,6 +239,7 @@ function init() {
|
||||
initFAQAccordion();
|
||||
initIntersectionObserver();
|
||||
initReadMore();
|
||||
initCitationCopy();
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
|
||||
Reference in New Issue
Block a user