fix: update sub-products in footer

This commit is contained in:
mohamad
2026-05-20 16:21:04 +03:30
parent 24dd24e1c9
commit 4875d8b6c3
5 changed files with 128 additions and 13 deletions
+43
View File
@@ -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') {