document.addEventListener("DOMContentLoaded", function () { // البحث عن حاوية البانر الرئيسي const bannerContainer = document.querySelector('.s-block--slider') || document.querySelector('.swiper-slide') || document.querySelector('.s-block'); if (bannerContainer) { // إنشاء زر التسوق const shopBtn = document.createElement("a"); shopBtn.href = "https://goldenm.store/ar/our-products/c377407363"; shopBtn.innerHTML = `تسوق الآن ←`; // التنسيق: أبيض ناصع، موضع منخفض ومضبوط (bottom: 10%) shopBtn.style.cssText = ` position: absolute; bottom: 10%; right: 18%; z-index: 10; background: #ffffff; color: #111111 !important; border: 1px solid rgba(255, 255, 255, 0.9); text-decoration: none; padding: 12px 34px; border-radius: 30px; font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); transition: all 0.3s ease; cursor: pointer; `; // تفاعل عند مرور الماوس shopBtn.onmouseover = function() { this.style.background = "#dfbe82"; this.style.color = "#000000"; this.style.borderColor = "#dfbe82"; this.style.transform = "scale(1.06)"; this.style.boxShadow = "0 12px 35px rgba(223, 190, 130, 0.5)"; }; shopBtn.onmouseout = function() { this.style.background = "#ffffff"; this.style.color = "#111111"; this.style.borderColor = "rgba(255, 255, 255, 0.9)"; this.style.transform = "scale(1)"; this.style.boxShadow = "0 10px 30px rgba(0, 0, 0, 0.6)"; }; bannerContainer.style.position = "relative"; bannerContainer.appendChild(shopBtn); } }); ////// كود البوب منيو document.addEventListener("DOMContentLoaded", function () { /* ========================================================================== 👇👇👇 ضع رابط صورة الإعلان الجديد هنا بين علامتي التنصيص في أي وقت 👇👇👇 ========================================================================== */ const GM_PROMO_IMAGE_URL = "https://cdn.files.salla.network/other/591337445/b9495518-fe73-4d7d-abd5-3d6dd1d5e370-original.webp"; /* ========================================================================== */ // رابط الصفحة التي يفتحها العميل عند الضغط على الإعلان const GM_PROMO_TARGET_URL = "https://goldenm.store/ar/our-products/c377407363"; // منع تكرار ظهور النافذة إذا كان الزائر قد أغلقها مسبقاً خلال نفس الجلسة if (sessionStorage.getItem("gm_promo_closed")) return; // إنشاء هيكل النافذة المنبثقة const modalOverlay = document.createElement("div"); modalOverlay.id = "gmPromoModal"; modalOverlay.className = "gm-promo-overlay"; modalOverlay.innerHTML = `
`; document.body.appendChild(modalOverlay); // إظهار النافذة بعد ثانية واحدة من تحميل الصفحة setTimeout(() => { modalOverlay.classList.add("active"); }, 1000); // إغلاق النافذة بسلاسة const closePopup = () => { modalOverlay.classList.remove("active"); sessionStorage.setItem("gm_promo_closed", "true"); setTimeout(() => modalOverlay.remove(), 400); }; document.getElementById("gmCloseBtn").addEventListener("click", closePopup); modalOverlay.addEventListener("click", function (e) { if (e.target === modalOverlay) closePopup(); }); }); //////// لوجو على البانر (function () { const GM_LOGO_URL = "https://cdn.files.salla.network/other/591337445/693ea6c1-398d-49d4-9958-e86ca8354f82-original.webp"; function placeBannerLogo() { if (document.getElementById("gmBannerLogo")) return; // استهداف زر تسوق الآن داخل البانر const shopBtn = document.querySelector('a[href*="our-products"]') || document.querySelector('a[href*="search"]'); if (shopBtn && shopBtn.parentElement) { const logoImg = document.createElement("img"); logoImg.id = "gmBannerLogo"; logoImg.className = "gm-banner-logo"; logoImg.src = GM_LOGO_URL; logoImg.alt = "Golden M"; shopBtn.parentElement.appendChild(logoImg); } } placeBannerLogo(); document.addEventListener("DOMContentLoaded", placeBannerLogo); window.addEventListener("load", placeBannerLogo); let tries = 0; const timer = setInterval(() => { placeBannerLogo(); tries++; if (tries > 25 || document.getElementById("gmBannerLogo")) { clearInterval(timer); } }, 200); })(); ///// كود الارقام التصاعديه /* ========================================================== 1. حقن اللوجو في بانر الصفحة الرئيسية فقط (حصرياً) ========================================================== */ (function () { const isHomePage = window.location.pathname === '/' || window.location.pathname === '/ar' || window.location.pathname === '/ar/' || window.location.pathname === ''; // إذا لم نكن في الصفحة الرئيسية، نتوقف فوراً ولا نحقن اللوجو if (!isHomePage) return; const GM_LOGO_URL = "https://cdn.files.salla.network/other/591337445/693ea6c1-398d-49d4-9958-e86ca8354f82-original.webp"; function placeBannerLogo() { if (document.getElementById("gmBannerLogo")) return; // استهداف سلايدر أو بانر الصفحة الرئيسية فقط const bannerTarget = document.querySelector('.s-block--slider') || document.querySelector('.s-block--hero-banner') || document.querySelector('.banner-entry'); if (bannerTarget) { bannerTarget.style.position = "relative"; const logoImg = document.createElement("img"); logoImg.id = "gmBannerLogo"; logoImg.className = "gm-banner-logo"; logoImg.src = GM_LOGO_URL; logoImg.alt = "Golden M"; bannerTarget.appendChild(logoImg); } } placeBannerLogo(); document.addEventListener("DOMContentLoaded", placeBannerLogo); window.addEventListener("load", placeBannerLogo); let tries = 0; const timer = setInterval(() => { placeBannerLogo(); tries++; if (tries > 20 || document.getElementById("gmBannerLogo")) { clearInterval(timer); } }, 250); })(); /* ========================================================== 1. تنظيف وإدارة لوجو البانر ========================================================== */ (function () { // فحص صارم: هل نحن في الصفحة الرئيسية فعلاً؟ const path = window.location.pathname.replace(/\/+$/, ""); // إزالة الشرطة المائلة الأخيرة const isHome = path === "" || path === "/ar" || path === "/en"; // إذا كنا في صفحة من نحن أو أي صفحة أخرى: نحذف اللوجو فوراً إن وجد if (!isHome || document.getElementById("gmAboutLuxury")) { const strayLogo = document.getElementById("gmBannerLogo"); if (strayLogo) strayLogo.remove(); return; } // إذا كنا في الصفحة الرئيسية فقط: const GM_LOGO_URL = "https://cdn.files.salla.network/other/591337445/693ea6c1-398d-49d4-9958-e86ca8354f82-original.webp"; function placeBannerLogo() { if (document.getElementById("gmBannerLogo")) return; // استهداف سلايدر الصفحة الرئيسية حصراً const banner = document.querySelector('.s-block--slider') || document.querySelector('.s-block--hero-banner'); if (banner) { banner.style.position = "relative"; const img = document.createElement("img"); img.id = "gmBannerLogo"; img.className = "gm-banner-logo"; img.src = GM_LOGO_URL; img.alt = "Golden M"; banner.appendChild(img); } } placeBannerLogo(); document.addEventListener("DOMContentLoaded", placeBannerLogo); window.addEventListener("load", placeBannerLogo); })(); /* ========================================================== حل مشكلة تصفير العدادات النهائي في سلة ========================================================== */ (function () { const TARGETS = [1500, 99, 2, 24]; // الأرقام المستهدفة بالترتيب let hasFinished = false; function runSafeCounters() { if (hasFinished) return; const counters = document.querySelectorAll("#gmAboutLuxury .gm-counter"); if (!counters || counters.length === 0) return; // إذا كانت الأرقام مكتملة بالفعل لا نلمسها if (parseInt(counters[0].textContent, 10) >= 1500) { hasFinished = true; return; } hasFinished = true; counters.forEach((el, index) => { const target = TARGETS[index] || 100; let start = 0; const duration = 1200; const stepTime = 25; const steps = duration / stepTime; const stepVal = Math.max(1, Math.ceil(target / steps)); el.textContent = "0"; const timer = setInterval(() => { start += stepVal; if (start >= target) { el.textContent = target; clearInterval(timer); } else { el.textContent = start; } }, stepTime); }); } // تشغيل عند التحميل if (document.readyState === "complete") { runSafeCounters(); } else { window.addEventListener("load", runSafeCounters); document.addEventListener("DOMContentLoaded", runSafeCounters); } // حماية إضافية ضد إعادة سلة لتفريغ الصفحة (Re-render Protection) setTimeout(function() { const counters = document.querySelectorAll("#gmAboutLuxury .gm-counter"); if (counters.length) { counters.forEach((el, idx) => { // إذا أعادت سلة القيمة إلى 0 أو نص فارغ، نثبت الرقم النهائي فوراً const currentVal = parseInt(el.textContent, 10); if (isNaN(currentVal) || currentVal === 0) { el.textContent = TARGETS[idx]; } }); } }, 2000); })(); ///////// كود ربط مع المركز السعودي للاعمال (function() { if (!document.querySelector('meta[name="domain-verification"]')) { var meta = document.createElement('meta'); meta.name = 'domain-verification'; meta.content = '76cf349de87f1a46b766569d873bf8e0a1d3e74e28afc72e103b1616536697cd'; document.head.appendChild(meta); } })(); /* ========================================================== قائمة المنتجات المنسدلة في الهيدر بروابط دقيقة ومباشرة ========================================================== */ (function () { function getHeaderNavMenu() { return document.querySelector('.header__nav ul') || document.querySelector('.header-nav ul') || document.querySelector('.main-nav ul') || document.querySelector('header nav ul') || document.querySelector('.site-header ul') || document.querySelector('.nav-list') || document.querySelector('header .menu'); } function setupProductsMenu() { if (document.getElementById("gmProductsMenu")) return true; const nav = getHeaderNavMenu(); if (!nav) return false; // 1. رابط كل المنتجات الأساسي const allProductsUrl = "https://goldenm.store/ar/our-products/c377407363"; // 2. روابط تصنيفات متجرك الحقيقية (عدل الروابط هنا بما يطابق أقسامك) const smartLocksUrl = "https://goldenm.store/ar/our-products/c377407363"; // استبدله برابط قسم الأقفال الذكية const intercomUrl = "https://goldenm.store/ar/our-products/c377407363"; // استبدله برابط قسم الإنتركوم const screensUrl = "https://goldenm.store/ar/our-products/c377407363"; // استبدله برابط قسم الشاشات والمفاتيح const li = document.createElement("li"); li.id = "gmProductsMenu"; li.className = "gm-nav-dropdown"; li.innerHTML = ` المنتجات ▼ `; if (nav.children.length > 0) { nav.insertBefore(li, nav.children[1] || nav.children[0]); } else { nav.appendChild(li); } return true; } if (!setupProductsMenu()) { const timer = setInterval(function () { if (setupProductsMenu()) clearInterval(timer); }, 250); setTimeout(function () { clearInterval(timer); }, 4000); } })(); (function () { function removeQuickLinkBoxes() { // البحث عن جميع الكروت داخل قسم الروابط السريعة const linksSection = document.querySelector('[class*="main-links"], [class*="quick-links"], .s-block--main-links'); if (!linksSection) return; const cards = linksSection.querySelectorAll('.swiper-slide, .swiper-slide a, .swiper-slide > div'); cards.forEach(card => { card.style.backgroundColor = 'transparent'; card.style.boxShadow = 'none'; card.style.border = 'none'; }); } window.addEventListener('load', removeQuickLinkBoxes); document.addEventListener('DOMContentLoaded', removeQuickLinkBoxes); setTimeout(removeQuickLinkBoxes, 600); })(); /* إزالة خلفية كروت الفئات برمجياً فور تحميل الصفحة */ (function () { function stripCategoryCards() { // استهداف بطاقات الفئات داخل سلة const cards = document.querySelectorAll( '.s-block--categories .swiper-slide > a, .s-block--categories .swiper-slide > div, .s-block--categories .slide--item' ); cards.forEach(card => { card.style.setProperty('background', 'transparent', 'important'); card.style.setProperty('background-color', 'transparent', 'important'); card.style.setProperty('box-shadow', 'none', 'important'); card.style.setProperty('border', 'none', 'important'); }); } window.addEventListener('load', stripCategoryCards); document.addEventListener('DOMContentLoaded', stripCategoryCards); setTimeout(stripCategoryCards, 500); setTimeout(stripCategoryCards, 1500); })();