/* Add custom Js styles below */ // ========== إعدادات ========== const WHATSAPP_URL = "https://wa.me/966547226514"; const SITE_URL = "https://shokvat.com"; // تجنب التكرار لو الكود اتشغّل أكتر من مرة if (!window.__shokvatInjected__) { window.__shokvatInjected__ = true; document.addEventListener("DOMContentLoaded", function () { // 1) إنشاء نص الفوتر بالرابط let footerText = document.querySelector(".custom-footer-text"); if (!footerText) { footerText = document.createElement("div"); footerText.className = "custom-footer-text"; footerText.innerHTML = 'تصميم وإدارة شوكفات'; document.body.appendChild(footerText); } else { // لو موجود بالفعل، نخلي الرابط يشتغل كبوابة للمودال const link = footerText.querySelector("a") || (() => { const a = document.createElement("a"); a.id = "shokvatLink"; a.textContent = "شوكفات"; a.href = "#"; footerText.append(" ", a); return a; })(); link.id = "shokvatLink"; link.href = "#"; link.setAttribute("role", "button"); link.removeAttribute("target"); } // 2) إنشاء المودال بالكامل بالـJS (بدون HTML جاهز) if (!document.getElementById("shokvatModal")) { const modal = document.createElement("div"); modal.id = "shokvatModal"; modal.innerHTML = `
`; document.body.appendChild(modal); // إغلاق بالزر modal.querySelector(".shokvat-close-btn").addEventListener("click", function () { modal.style.display = "none"; document.body.classList.remove("shokvat-no-scroll"); }); // إغلاق بالضغط خارج المحتوى modal.addEventListener("click", function (e) { if (e.target.id === "shokvatModal") { modal.style.display = "none"; document.body.classList.remove("shokvat-no-scroll"); } }); // إغلاق بمفتاح ESC document.addEventListener("keydown", function (e) { if (e.key === "Escape" && modal.style.display === "flex") { modal.style.display = "none"; document.body.classList.remove("shokvat-no-scroll"); } }); } // 3) ربط الضغط على "شوكفات" بفتح المودال const trigger = document.getElementById("shokvatLink"); const modalEl = document.getElementById("shokvatModal"); if (trigger && modalEl) { trigger.addEventListener("click", function (e) { e.preventDefault(); modalEl.style.display = "flex"; document.body.classList.add("shokvat-no-scroll"); }); } }); } document.addEventListener("DOMContentLoaded", function () { // لا يظهر في الصفحة الرئيسية فقط if (window.location.pathname !== "/") { const helpBtn = document.createElement('div'); helpBtn.id = 'floating-help-btn'; helpBtn.innerHTML = `❓`; helpBtn.style.cssText = ` position: fixed; bottom: 90px; left: 20px; /* ← هنا التغيير */ width: 50px; height: 50px; background-color: #f97316; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 99999; box-shadow: 0 4px 12px rgba(0,0,0,0.25); transition: transform 0.3s ease; `; helpBtn.onmouseover = () => { helpBtn.style.transform = 'scale(1.1)'; }; helpBtn.onmouseout = () => { helpBtn.style.transform = 'scale(1)'; }; // عند الضغط عليه يفتح نافذة التسجيل helpBtn.onclick = () => { if (typeof salla !== 'undefined' && salla.event) { salla.event.dispatch('login::open'); } else { alert("حدث خطأ، تأكد من تحميل مكتبة سلة."); } }; document.body.appendChild(helpBtn); } }); // إنشاء زر الواتساب ديناميكيًا (منع التكرار) if (!document.getElementById('whatsapp-btn')) { const whatsappButton = document.createElement('div'); whatsappButton.id = 'whatsapp-btn'; whatsappButton.innerHTML = `