/* Add custom Js styles below */ // إنشاء زر الواتساب ديناميكيًا (منع التكرار) if (!document.getElementById('whatsapp-btn')) { const whatsappButton = document.createElement('div'); whatsappButton.id = 'whatsapp-btn'; whatsappButton.innerHTML = ` WhatsApp `; // فتح واتساب عند النقر + تتبع التحويل في Google Ads whatsappButton.onclick = function () { // لو دالة gtag_report_conversion متاحة if (typeof gtag_report_conversion === 'function') { gtag_report_conversion('https://wa.me/+966536300700'); } else { // fallback في حال عدم وجود الدالة window.open('https://wa.me/+966536300700', '_blank'); } }; // إضافة الزر إلى الصفحة document.body.appendChild(whatsappButton); } // تصميم وادارة شوكفات // ========== إعدادات ========== 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); } }); /* === Ministry of Commerce Badge for Salla === */ (function () { // ------- الإعدادات (عدّل الروابط حسب حاجتك) ------- var LOGO_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Logo_Ministry_of_Commerce.svg/1200px-Logo_Ministry_of_Commerce.svg.png"; var CR_IMAGE_URL = "https://cdn.salla.sa/NKaxXB/4jcjRmfaL7sNy1w7Pr90BeT7ENSaHzPlQgjuGE8N.png"; var BADGE_TEXT = "موثق بوزارة التجارة – سجل تجاري"; // ------- إنشاء الشارة ------- function createBadge() { var a = document.createElement("a"); a.className = "moc-badge"; a.href = CR_IMAGE_URL; a.target = "_blank"; a.rel = "noopener"; a.setAttribute("aria-label", BADGE_TEXT); a.title = BADGE_TEXT; var img = document.createElement("img"); img.src = LOGO_URL; img.alt = "شعار وزارة التجارة"; img.decoding = "async"; img.loading = "lazy"; var span = document.createElement("span"); span.className = "moc-text"; span.textContent = BADGE_TEXT; a.appendChild(img); a.appendChild(span); // افتح مودال عند الضغط a.addEventListener("click", function (e) { try { e.preventDefault(); openModal(CR_IMAGE_URL); } catch (err) { // لو صار خطأ، افتح الصورة بتبويب جديد window.open(CR_IMAGE_URL, "_blank", "noopener"); } }); document.body.appendChild(a); } // ------- إنشاء المودال ------- function buildModal() { var wrap = document.createElement("div"); wrap.className = "moc-modal"; wrap.setAttribute("role", "dialog"); wrap.setAttribute("aria-modal", "true"); wrap.setAttribute("aria-label", "السجل التجاري"); var backdrop = document.createElement("div"); backdrop.className = "moc-modal__backdrop"; var dialog = document.createElement("div"); dialog.className = "moc-modal__dialog"; var card = document.createElement("div"); card.className = "moc-modal__card"; var img = document.createElement("img"); img.className = "moc-modal__img"; img.alt = "صورة السجل التجاري"; img.decoding = "async"; var btn = document.createElement("button"); btn.className = "moc-modal__close"; btn.type = "button"; btn.textContent = "إغلاق"; // إغلاقات function close() { wrap.classList.remove("is-open"); img.src = ""; // تنظيف document.removeEventListener("keydown", onKey); } function onKey(ev) { if (ev.key === "Escape") close(); } backdrop.addEventListener("click", close); btn.addEventListener("click", close); card.appendChild(img); card.appendChild(btn); dialog.appendChild(card); wrap.appendChild(backdrop); wrap.appendChild(dialog); document.body.appendChild(wrap); // API بسيطة return { open: function (src) { img.src = src; wrap.classList.add("is-open"); document.addEventListener("keydown", onKey); } }; } var modalInstance; function openModal(src) { if (!modalInstance) modalInstance = buildModal(); modalInstance.open(src); } // ------- شغل بعد جاهزية الصفحة ------- if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", createBadge); } else { createBadge(); } })();