/* Add custom Js styles below */ document.addEventListener('DOMContentLoaded', () => { function buildCustomFooter(lang) { const f = document.createElement("footer"); f.classList.add("new-footer"); f.setAttribute("data-custom","true"); if (lang === "ar") { f.innerHTML = ` `; } else { f.innerHTML = ` `; } return f; } function replaceFooter() { const existingNew = document.querySelector('.new-footer[data-custom="true"]'); if (existingNew) return; // Skip if custom footer already exists const footer = document.querySelector("footer"); if (footer) { footer.style.display = "none"; const lang = document.documentElement.lang; const custom = buildCustomFooter(lang); footer.insertAdjacentElement("afterend", custom); } } // Try to replace footer immediately replaceFooter(); // Set up interval to try replacing footer every 500ms for up to 5 seconds const interval = setInterval(replaceFooter, 500); setTimeout(() => clearInterval(interval), 5000); // Set up MutationObserver to watch for DOM changes and language changes const observer = new MutationObserver((mutations) => { // Check if language changed const langChanged = mutations.some(mutation => mutation.type === 'attributes' && mutation.attributeName === 'lang' ); if (langChanged) { // Remove existing custom footer if language changed const existingFooter = document.querySelector('.new-footer[data-custom="true"]'); if (existingFooter) { existingFooter.remove(); } replaceFooter(); } else { replaceFooter(); } }); observer.observe(document.documentElement, { attributes: true, childList: true, subtree: true }); });