document.addEventListener("DOMContentLoaded", function () { // ✅ إنشاء اللودر const loader = document.createElement('div'); loader.id = 'loaderr'; loader.style.cssText = ` position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #FCE8E8; display: flex; justify-content: center; align-items: center; z-index: 999999; transition: opacity 2s ease; `; // ✅ شكل اللوجو + 4 دواير متحركة loader.innerHTML = `
logo
`; document.body.appendChild(loader); // ✅ إزالة اللودر بعد تحميل الصفحة window.addEventListener('load', function () { const loader = document.getElementById('loaderr'); if (loader) { loader.style.opacity = '0'; setTimeout(() => loader.remove(), 5000); } }); }); document.addEventListener("DOMContentLoaded", function () { // اختيار كل أقسام الصفحة const sections = document.querySelectorAll("section"); // ✅ تفعيل الأنيميشن عند ظهور الأقسام أثناء التمرير function checkVisibility() { sections.forEach(section => { const position = section.getBoundingClientRect(); if (position.top < window.innerHeight && position.bottom >= 0) { section.classList.add('visible'); } else { section.classList.remove('visible'); } }); } // إضافة مستمع لحدث التمرير window.addEventListener("scroll", checkVisibility); checkVisibility(); // تنفيذ التحقق أول مرة عند تحميل الصفحة // ✅ تعيين لون الخلفية لكل section إلى 'inherit' sections.forEach(function(section) { section.style.backgroundColor = 'white'; }); // ✅ تعديل خلفية عنصر معين عند ظهوره const interval = setInterval(() => { const el = document.querySelector(".mm-spn.mm-spn--light"); if (el) { el.style.backgroundColor = "white"; el.style.color = "#dc6494"; el.style.backgroundImage = "none"; clearInterval(interval); } }, 300); }); /* لون الزرار في سياسة الاستبدال والإسترجاع */ const style = document.createElement('style'); style.textContent = ` .s-button-primary { background-color: white !important; color:#dc6494 !important; } `; document.head.appendChild(style); /* أبعاد صفحة المنتجات على الموبايل */ (function () { const style = document.createElement('style'); style.innerHTML = ` @media screen and (max-width: 768px) { .s-products-list-vertical-cards { display: inline-grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; max-width: 86% !important; margin: auto !important; position: relative !important; left: -20px !important; } button.undefined.s-button-element.s-button-btn.s-button-outline.s-button-wide.s-button-primary-outline.s-button-loader-center:hover { width: 146px !important; } } `; document.head.appendChild(style); })(); /* لون الجزء اللي تحت في المنتجات (موبايل فقط) */ window.addEventListener('load', () => { const style = document.createElement('style'); style.textContent = ` @media screen and (max-width: 768px) { .s-product-card-content { position: relative !important; display: flex !important; flex-direction: column !important; align-items: center !important; background-color: transparent !important; } .s-product-card-entry, .s-product-card-entry *, .s-product-card-content, .s-product-card-content * { background-color: transparent !important; background: transparent !important; } } `; document.head.appendChild(style); }); document.addEventListener("DOMContentLoaded", () => { // دالة لإضافة النجوم في أعلى كارت المنتج function addStarsToTop() { const cards = document.querySelectorAll(".s-product-card-content"); cards.forEach(card => { // لو مفيش نجوم مضافة قبل كده if (!card.querySelector(".stars-custom")) { const stars = document.createElement("div"); stars.className = "stars-custom"; stars.textContent = "★★★★★"; stars.style.display = "block"; stars.style.color = "#facc15"; stars.style.fontSize = "0.75rem"; stars.style.marginBottom = "0.25rem"; stars.style.letterSpacing = "1px"; stars.style.textAlign = "center"; // نضيف النجوم في أول الكارت card.insertBefore(stars, card.firstChild); } }); } // شغل الدالة فورًا addStarsToTop(); // راقب الصفحة لو في منتجات بتظهر بعدين const observer = new MutationObserver(() => { addStarsToTop(); }); observer.observe(document.body, { childList: true, subtree: true }); }); document.addEventListener("DOMContentLoaded", () => { const style = document.createElement("style"); style.innerHTML = ` /* تأثير النور للكلمة */ @keyframes glowText { 0%, 100% { text-shadow: 0 0 0px transparent; } 50% { text-shadow: 0 0 8px #dc6494; } } /* اهتزاز للسلة */ @keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1px); } 50% { transform: translateX(1px); } 75% { transform: translateX(-1px); } } /* الزرار */ .s-button-element { background-color: #FCE8E8 !important; border: 1px solid #dc6494 !important; color: #dc6494 !important; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.25rem; border-radius: 9999px; font-weight: bold; transition: none !important; } /* الزرار لما يتعمل عليه hover */ .s-button-element:hover { background-color: #FCE8E8 !important; border: 1px solid #dc6494 !important; color: #dc6494 !important; } /* النص */ .s-button-element .s-button-text { color: #dc6494 !important; animation: glowText 1.5s infinite ease-in-out; font-weight: bold; } /* السلة */ .s-button-element .sicon-shopping-bag { font-size: 1.2rem; animation: shake 1.5s infinite ease-in-out; } `; document.head.appendChild(style); }); document.addEventListener("DOMContentLoaded", function () { // لو تم اغلاق الرسالة سابقاً ما نعرضهاش if (localStorage.getItem("wpMessageDismissed") === "true") { return; } // إضافة الاستايل const styleWp = document.createElement("style"); styleWp.textContent = ` #wp-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 999999; } #wp-box { background: #fff; padding: 20px; border-radius: 12px; max-width: 420px; width: 90%; text-align: center; position: relative; box-shadow: 0 6px 24px rgba(0,0,0,0.2); font-family: Arial, sans-serif; } #wp-box h2 { margin: 0 0 8px; font-size: 20px; } #wp-box p { margin: 0 0 16px; color: #444; } .wp-buttons { display: flex; flex-direction: column; gap: 10px; } .wp-btn { display: inline-block; padding: 10px 16px; background: #fcf4f4; color: #dc6494; border: 2px solid #dc6494; border-radius: 8px; text-decoration: none; font-weight: 600; cursor: pointer; } .wp-btn:hover { background: #dc6494; color: #fff; } .wp-close { position: absolute; top: 8px; right: 10px; border: none; background: transparent; font-size: 20px; cursor: pointer; color: #666; } @media (min-width: 560px) { .wp-buttons { flex-direction: row; justify-content: center } .wp-btn { min-width: 120px } } `; document.head.appendChild(styleWp); // إنشاء البوب أب const overlay = document.createElement("div"); overlay.id = "wp-overlay"; overlay.innerHTML = `

اهلا بك في متجرنا!

متجرنا يقدم لك أحدث وأفضل المنتجات في مجال التجميل والعناية

اختر المجال اللذي تود الإطلاع عليه

مستحضرات التجميل العناية
`; document.body.appendChild(overlay); // دالة لإخفاء الرسالة وتخزين الحالة function dismissMessage() { localStorage.setItem("wpMessageDismissed", "true"); overlay.remove(); } // زر إغلاق الرسالة overlay.querySelector(".wp-close").addEventListener("click", dismissMessage); // لكل زرار، لما يضغط، يخزن الحالة ويحول للينك بدون فتح تاب جديد overlay.querySelectorAll(".wp-btn").forEach(btn => { btn.addEventListener("click", function (e) { e.preventDefault(); // منع الانتقال السريع dismissMessage(); window.location.href = this.href; // تحويل في نفس الصفحة }); }); }); document.addEventListener("DOMContentLoaded", function () { // 1️⃣ إنشاء زر الأيقونة const infoBtn = document.createElement("div"); infoBtn.innerHTML = `
ما يميزنا!
🤩
`; document.body.appendChild(infoBtn); // 2️⃣ إنشاء البوكس const faqBox = document.createElement("div"); faqBox.style.cssText = ` position: fixed; bottom: 170px; left: 20px; width: 300px; background: white; border-radius: 16px; box-shadow: 0 6px 16px #dc6494; padding: 15px; font-family: sans-serif; direction: rtl; display: none; z-index: 9999; max-height: 400px; overflow-y: auto; `; // 3️⃣ محتوى الأسئلة const faqs = [ { q: "🚚 الشحن والتوصيل", a: "مدة التوصيل من 7-14 يوم عمل حسب موقعك." }, { q: "💳 الدفع ", a: "نوفر طرق دفع امنة ومتنوعة ." }, { q: "🎁 المنتجات والإرجاع", a: "كل منتجاتنا أصلية ونوفر سياسة إرجاع سهلة." }, { q: "👩‍⚕️ العناية والتجميل", a: "نوفر لك اخصائية العناية والتجميل لمساعدتك والرد على استفساراتك." } ]; faqs.forEach(item => { const qDiv = document.createElement("div"); qDiv.style.cssText = ` padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: bold; color: #dc6494; `; qDiv.innerHTML = `${item.q} `; const aDiv = document.createElement("div"); aDiv.textContent = item.a; aDiv.style.cssText = ` display: none; padding: 8px; font-size: 14px; color: #dc6494; background:white; border-radius: 8px; margin-top: 5px; `; qDiv.addEventListener("click", () => { const arrow = qDiv.querySelector("span:last-child"); if (aDiv.style.display === "none") { aDiv.style.display = "block"; arrow.style.transform = "rotate(90deg)"; } else { aDiv.style.display = "none"; arrow.style.transform = "rotate(0deg)"; } }); faqBox.appendChild(qDiv); faqBox.appendChild(aDiv); }); document.body.appendChild(faqBox); // 4️⃣ إظهار/إخفاء البوكس عند الضغط على الأيقونة infoBtn.addEventListener("click", () => { faqBox.style.display = faqBox.style.display === "none" ? "block" : "none"; }); });