function addDarkModeButton() { const userMenu = document.querySelector("salla-user-menu"); if (!userMenu) { setTimeout(addDarkModeButton, 1000); return; } if (document.querySelector(".dark-toggle-btn")) return; const moonIcon = ` `; const sunIcon = ` `; const btn = document.createElement("button"); btn.className = "dark-toggle-btn"; btn.innerHTML = moonIcon; btn.style.cssText = ` background:none; border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; margin-left:12px; margin-right:12px; color:#111827; transition:.3s; `; userMenu.parentNode.insertBefore(btn, userMenu); if (localStorage.getItem("darkMode") === "on") { document.body.classList.add("dark-mode"); btn.innerHTML = sunIcon; btn.style.color = "#ffffff"; } btn.addEventListener("click", () => { document.body.classList.toggle("dark-mode"); if (document.body.classList.contains("dark-mode")) { localStorage.setItem("darkMode", "on"); btn.innerHTML = sunIcon; btn.style.color = "#ffffff"; } else { localStorage.setItem("darkMode", "off"); btn.innerHTML = moonIcon; btn.style.color = "#111827"; } }); } document.addEventListener("DOMContentLoaded", addDarkModeButton); document.addEventListener('DOMContentLoaded', () => { const logo = document.querySelector('.navbar-brand img'); if (logo) { logo.src = 'https://i.imgur.com/HKawffx.png'; } }); document.addEventListener('DOMContentLoaded', () => { const footerLinks = document.querySelector('.s-menu-footer-list'); if (!footerLinks) return; footerLinks.insertAdjacentHTML('beforeend', ` سياسة الشحن سياسة التوصيل `); }); function updateContacts() { document.querySelectorAll('.s-contacts-item').forEach(item => { const text = item.querySelector('.unicode'); if (!text) return; if (item.href.includes('wa.me')) { text.textContent = 'واتساب'; } if (item.href.startsWith('tel:')) { text.textContent = 'اتصال'; } if (item.href.startsWith('mailto:')) { text.textContent = 'البريد الإلكتروني'; } }); } setInterval(updateContacts, 1000);