/* Add custom JS code below */ /* ========================================================================== Store Ultimate Engine (Global Edition - V54 - The Ultimate Magic Link ⚡🥷) [ بنر الأوت ليت + فلتر سحري لمنتجات A + خطة B + توجيه سيرفر سلة الذكي ] ========================================================================== */ // 🌟 0. بنر الأوت ليت والنافذة المنبثقة 🌟 (function() { if (window.location.pathname !== '/' && window.location.pathname !== '') return; const oldBanner = document.getElementById('st-preview-banner'); if (oldBanner) oldBanner.remove(); const oldModal = document.getElementById('st-size-modal'); if (oldModal) oldModal.remove(); let sizesHTMLForModal = ''; for (let i = 36; i <= 45; i++) { sizesHTMLForModal += ``; } // const bannerHTML = ` // //
//
//
//

خصومات الأوت ليت

//
// // // // // // // //
//
//

اختر السعر الذي يناسبك واكتشف عرضك! ⚡

//
// // // // //
//
//
//
//
// //

اختر مقاسك الآن

//

جاهزة للشحن الفوري لعروض ريال

//
// ${sizesHTMLForModal} //
//
//
// `; document.addEventListener('DOMContentLoaded', () => { const mainElement = document.querySelector('main') || document.querySelector('.s-main-content') || document.querySelector('.app-inner'); const headerElement = document.querySelector('header') || document.querySelector('.s-site-header'); if (mainElement) { mainElement.insertAdjacentHTML('afterbegin', bannerHTML); } else if (headerElement) { headerElement.insertAdjacentHTML('afterend', bannerHTML); } else { document.body.insertAdjacentHTML('afterbegin', bannerHTML); } const modal = document.getElementById('st-size-modal'); const closeBtn = document.getElementById('st-close-modal-btn'); const priceDisplay = document.getElementById('st-selected-price-display'); let selectedOutletPrice = 99; document.querySelectorAll('.st-price-btn').forEach(btn => { btn.addEventListener('click', (e) => { e.preventDefault(); selectedOutletPrice = btn.getAttribute('data-val'); priceDisplay.textContent = selectedOutletPrice; modal.classList.add('st-active'); }); }); closeBtn.addEventListener('click', () => modal.classList.remove('st-active')); modal.addEventListener('click', (e) => { if(e.target === modal) modal.classList.remove('st-active'); }); // 🎯 التحديث العبقري لبناء الرابط السحري للسيرفر 🎯 document.querySelectorAll('.st-modal-size-btn').forEach(btn => { btn.addEventListener('click', (e) => { e.preventDefault(); let size = btn.getAttribute('data-size'); // تحويل السعر إلى الكود السري الذي يفهمه السيرفر let magicCode = 576; if(selectedOutletPrice == 99) magicCode = 576; else if(selectedOutletPrice == 149) magicCode = 577; else if(selectedOutletPrice == 199) magicCode = 578; else if(selectedOutletPrice == 299) magicCode = 579; // توجيه العميل مع إجبار السيرفر على جلب المنتجات المطلوبة فقط! window.location.href = `/outlet/c974045062?filters[variants][المقاس]=${size}&filters[category_id]=974045062&filters[price][min]=${magicCode}&filters[price][max]=${magicCode}&outlet_price=${selectedOutletPrice}`; }); }); }); })(); // 🌟 1. دالة رسم أو تحديث ملصق التوصيل 🌟 window.drawDeliveryBadge = function(card, sku) { if (!sku) return; let priceWrapper = card.querySelector('.product-card__price'); if (!priceWrapper) return; let deliveryText = ""; let deliveryIcon = ""; function getDynamicDate(daysToAdd) { const arabicMonths = ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر']; let currentDate = new Date(); currentDate.setDate(currentDate.getDate() + daysToAdd); return currentDate.getDate() + ' ' + arabicMonths[currentDate.getMonth()]; } let upperSku = String(sku).toUpperCase(); if (upperSku.startsWith('AA')) { deliveryText = "يوصلك " + getDynamicDate(2); deliveryIcon = "🚚"; } else if (upperSku.startsWith('BB')) { deliveryText = "يوصلك " + getDynamicDate(7); deliveryIcon = ``; } let existingBadge = card.querySelector('.delivery-time-badge'); if (deliveryText) { let badgeHtml = `${deliveryText} ${deliveryIcon}`; if (existingBadge) { existingBadge.innerHTML = badgeHtml; existingBadge.style.display = 'inline-flex'; } else { let badge = document.createElement('div'); badge.className = 'delivery-time-badge'; priceWrapper.insertAdjacentElement('afterend', badge); badge.innerHTML = badgeHtml; } } else if (existingBadge) { existingBadge.style.display = 'none'; } }; // 🌟 2. المحرك المدمج الهجين (Hybrid Fast-Kill Engine + Fail-Safe ⚡) 🌟 window.DynamicPricing = (function () { 'use strict'; const urlParams = new URLSearchParams(window.location.search); const TARGET_SIZE = urlParams.get('filters[variants][المقاس]'); const OUTLET_PRICE = parseFloat(urlParams.get('outlet_price')) || parseFloat(urlParams.get('tp_max')); // 🎯 قاموس الأكواد السرية (Magic Dictionary) لمنتجات A const MAGIC_MAP = { 576: 99, 577: 149, 578: 199, 579: 299 }; let loaderInterval = null; if (TARGET_SIZE) { const style = document.createElement('style'); style.id = 'sz-filter-style-stealth'; let isStrictOutlet = (!isNaN(OUTLET_PRICE)); let loadingCss = isStrictOutlet ? 'display: none !important; opacity: 0 !important; visibility: hidden !important;' : 'opacity: 0.5 !important; pointer-events: none; transition: opacity 0.3s;'; style.textContent = ` html body .s-products-list-wrapper { min-height: 50vh !important; position: relative; } html body .s-products-list-wrapper[data-st-loading="1"]::before { content: 'جاري جلب العروض الصاروخية بمقاسك... ⚡'; position: absolute; top: 30px; left: 0; right: 0; text-align: center; font-family: inherit; font-size: 16px; font-weight: bold; color: #0b7579; animation: pulseText 1.5s infinite; z-index: 10; } @keyframes pulseText { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } html body .s-products-list-wrapper custom-salla-product-card:not([data-ready="1"]), html body custom-salla-product-card:not([data-ready="1"]), html body .product-card:not([data-ready="1"]) { ${loadingCss} } html body .s-products-list-wrapper custom-salla-product-card.st-hidden-card, html body custom-salla-product-card.st-hidden-card, html body .product-card.st-hidden-card { display: none !important; opacity: 0 !important; visibility: hidden !important; height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; border:none !important; } `; if(document.head) document.head.appendChild(style); document.addEventListener('DOMContentLoaded', () => { const wrapper = document.querySelector('.s-products-list-wrapper'); if (wrapper && isStrictOutlet) wrapper.setAttribute('data-st-loading', '1'); // 🚨 نظام الطوارئ (Fail-Safe Kill Switch): ينهي التحميل إجبارياً بعد 5 ثواني لمنع التعليق setTimeout(() => { if (loaderInterval) clearInterval(loaderInterval); if (wrapper) { wrapper.removeAttribute('data-st-loading'); // إذا لم نجد أي منتج بعد 5 ثواني، نظهر رسالة لطيفة بدلاً من الشاشة الفارغة if (visibleProductsCount === 0) { const noData = document.createElement('div'); noData.id = 'st-no-data-msg'; // 👈 أضفنا ID للرسالة للتعرف عليها noData.style.cssText = 'text-align:center; padding: 40px 20px; font-size: 16px; color: #666; font-weight: bold; width: 100%;'; noData.innerHTML = 'عذراً، لا توجد عروض مطابقة لمقاسك بهذا السعر حالياً. جرب مقاس أو سعر آخر ⚡'; wrapper.appendChild(noData); } } }, 6500); }); } const MAX_CONCURRENT = 8; // سرعة تحميل قصوى const CACHE_TTL = 3 * 60 * 1000; const cache = new Map(); const queue = []; const inFlight = new Set(); let active = 0; let STORE_ID = ''; let visibleProductsCount = 0; const MIN_VISIBLE_PRODUCTS = 4; // خففنا العدد المطلوب عشان يفتح الشاشة أسرع function init() { if (!TARGET_SIZE) return; STORE_ID = window.salla?.config?.get('store.id') || document.querySelector('meta[name="store-id"]')?.content || ''; if (!STORE_ID) return; if (!isNaN(OUTLET_PRICE)) { loaderInterval = setInterval(aggressiveLoader, 400); } drain(); } function aggressiveLoader() { if (active >= MAX_CONCURRENT) return; const wrapper = document.querySelector('.s-products-list-wrapper'); const sallaScroll = document.querySelector('salla-infinite-scroll'); // إذا سلة قالت إن ماعاد فيه منتجات، وقف الروبوت فوراً وافتح الشاشة! if (sallaScroll && (sallaScroll.getAttribute('has-more') === 'false' || sallaScroll.getAttribute('has-more') === null)) { if (wrapper) wrapper.removeAttribute('data-st-loading'); if (loaderInterval) clearInterval(loaderInterval); return; } // إذا لقينا 2 منتجات فقط، فك التعليقة عن العميل خله يتفرج والروبوت بيكمل ورا الكواليس if (visibleProductsCount >= 2 && wrapper) { wrapper.removeAttribute('data-st-loading'); } if (visibleProductsCount < MIN_VISIBLE_PRODUCTS && active < MAX_CONCURRENT) { const safeBtn = document.querySelector('.s-infinite-scroll-btn:not([disabled]), salla-button[load-more]:not([disabled])'); if (safeBtn && !safeBtn.classList.contains('s-button--loading')) { safeBtn.click(); } else { window.dispatchEvent(new CustomEvent('scroll')); } } } function enqueue(card) { if (!TARGET_SIZE || !STORE_ID || card.dataset.sz === '1') return; const wrapper = card.closest('custom-salla-product-card') || card; const productId = wrapper.id ? wrapper.id.replace('product-', '') : wrapper.getAttribute('data-product-id'); if (!productId) return; wrapper.dataset.sz = '1'; queue.push({card: wrapper, productId}); drain(); } function drain() { while (active < MAX_CONCURRENT && queue.length > 0) { active++; const item = queue.shift(); processCard(item.card, item.productId).finally(() => { active--; drain(); }); } } async function processCard(card, productId) { if (inFlight.has(productId)) return; inFlight.add(productId); try { // 🎯 استخراج السعر بذكاء (إزالة الفواصل العشرية وتصحيح الرقم) const priceEl = card.querySelector('.total-price') || card.querySelector('.s-product-card-price'); let currentBasePrice = 0; if (priceEl) { let match = priceEl.textContent.replace(/,/g, '').match(/\d+/); if (match) currentBasePrice = parseInt(match[0]); } // ⚡ 1. الفحص السحري الفوري (Zero API لمنتجات A) ⚡ if (MAGIC_MAP[currentBasePrice]) { let realPrice = MAGIC_MAP[currentBasePrice]; if (!isNaN(OUTLET_PRICE) && realPrice !== OUTLET_PRICE) { applyState(card, { hide: true }); // إعدام فوري return; } applyState(card, { hide: false, price: realPrice, basePrice: currentBasePrice, sku: "A" }); return; } // ⚡ 2. الخطة البديلة (منتجات B أو العادية) ⚡ const cached = cache.get(productId); if (cached && Date.now() - cached.ts < CACHE_TTL) { applyState(card, cached); return; } const r1 = await fetch(`https://api.salla.dev/store/v1/products/${productId}/details?with%5B%5D=options`, { headers: { 'Accept': 'application/json', 'Store-Identifier': STORE_ID } }); if (!r1.ok) { showCard(card); return; } const j1 = await r1.json(); const product = j1.data?.data || j1.data; if (!product) { showCard(card); return; } const baseSku = product.sku || card.getAttribute('data-sku'); let sizeAvailable = false; let optionId = null, valueId = null; let variantSku = null; (product.options || []).forEach(opt => { if (opt.name.includes("مقاس") || opt.name.includes("Size")) { (opt.details || opt.values || []).forEach(val => { const name = String(val.name || ''); const isOut = val.is_out || val.out_of_stock || val.quantity === 0; if (!isOut && name.includes(TARGET_SIZE)) { sizeAvailable = true; optionId = val.option_id || opt.id; valueId = val.id; variantSku = val.code || val.sku; } }); } }); if (!product.options?.length) sizeAvailable = true; if (!sizeAvailable) { const s = { ts: Date.now(), hide: true }; cache.set(productId, s); applyState(card, s); return; } let truePrice = Number(product.sale_price) || Number(product.price) || 0; let finalSku = variantSku || baseSku; if (optionId && valueId) { const fd = new FormData(); fd.append(`options[${optionId}]`, valueId); fd.append('id', productId); fd.append('quantity', 1); const r2 = await fetch(`https://api.salla.dev/store/v1/products/${productId}/price`, { method: 'POST', headers: { 'Accept': 'application/json', 'Store-Identifier': STORE_ID, 'X-Requested-With': 'XMLHttpRequest', 's-source': 'twilight', 's-app-os': 'browser', 'currency': 'SAR' }, body: fd }); if (r2.ok) { const j2 = await r2.json(); truePrice = j2.data?.price || truePrice; if (j2.data?.sku && j2.data.sku !== "") finalSku = j2.data.sku; } } if (!isNaN(OUTLET_PRICE) && truePrice !== OUTLET_PRICE) { const s = { ts: Date.now(), hide: true }; cache.set(productId, s); applyState(card, s); return; } const s = { ts: Date.now(), hide: false, price: truePrice, basePrice: currentBasePrice, sku: finalSku }; cache.set(productId, s); applyState(card, s); } catch (_) { showCard(card); } finally { inFlight.delete(productId); } } function showCard(card) { card.classList.remove('st-hidden-card'); card.setAttribute('data-ready', '1'); card.style.display = ''; card.style.opacity = '1'; card.style.pointerEvents = ''; visibleProductsCount++; // 🎯 مسح رسالة الطوارئ فوراً بمجرد ظهور أول منتج 🎯 const noDataMsg = document.getElementById('st-no-data-msg'); if (noDataMsg) noDataMsg.remove(); } function applyState(card, state) { if (state.hide) { card.classList.add('st-hidden-card'); card.setAttribute('data-ready', '1'); card.style.setProperty('display', 'none', 'important'); return; } card.classList.remove('st-hidden-card'); if (state.sku && window.drawDeliveryBadge) { window.drawDeliveryBadge(card, state.sku); } if (state.price && state.price !== state.basePrice) { const priceEl = card.querySelector('.total-price') || card.querySelector('.s-product-card-price'); if (priceEl) { for (const node of priceEl.childNodes) { if (node.nodeType === 3 && /\d/.test(node.textContent)) { node.textContent = node.textContent.replace(state.basePrice, state.price); break; } } } } showCard(card); } if (typeof Salla !== 'undefined' && Salla.onReady) Salla.onReady(init); else document.addEventListener('DOMContentLoaded', () => setTimeout(init, 500)); return { enqueue }; })(); // 🌟 3. حقن الخطوط الأساسية 🌟 (function() { try { if (!document.getElementById('store-fonts-fix')) { const fontStyle = document.createElement('style'); fontStyle.id = 'store-fonts-fix'; fontStyle.innerHTML = ` body, h1, h2, h3, h4, h5, h6, p, a, span, div, button, input, select, textarea, label, header *, .main-nav-container *, .st-modal-content *, .st-pill *, .product-card__content *, .delivery-time-badge, .delivery-time-badge span { font-family: var(--font-readex, inherit) !important; } i, [class^="sicon-"], [class*=" sicon-"], .s-icon, .salla-icon { font-family: 'sallaicons' !important; } `; document.head.appendChild(fontStyle); } } catch(e) {} })(); document.addEventListener('DOMContentLoaded', () => { // 🌟 التنسيقات الشاملة للواجهة (CSS غير مضغوط لتجنب مشاكل سلة) 🌟 if (!document.getElementById('store-core-style')) { const style = document.createElement('style'); style.id = 'store-core-style'; style.innerHTML = ` select#product-filter, label[for="product-filter"] { display: none !important; } /* 🎯 ترتيب الأشرطة الإعلانية والهيدر 🎯 */ .promotion-banner { position: relative !important; display: block !important; height: auto !important; min-height: 40px !important; z-index: 10002 !important; margin: 0 !important; transform: none !important; } salla-advertisement { position: relative !important; display: block !important; height: auto !important; min-height: 46px !important; z-index: 10001 !important; margin: 0 !important; transform: none !important; } .s-advertisement { position: relative !important; height: auto !important; margin: 0 !important; } body, .app-inner { padding-top: 0 !important; } /* تم تحويل الهيدر إلى sticky هنا 👇 */ header, .s-site-header, .main-nav-container { position: sticky !important; top: 0 !important; width: 100% !important; z-index: 9999 !important; background: #fff !important; box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important; } header .inner, .main-nav-container .inner, header .container { background: #fff !important; } header a:not(.st-pill), header i, header svg:not(.st-pill svg), header span:not(.st-pill span), header button:not(.st-pill) { color: #0b7579 !important; } header .s-cart-summary-count, .s-cart-summary-count *, .s-badge, .s-badge * { color: #fff !important; } .main-nav-container.fixed-pinned:not(.fixed-header) #store-filter-nav { opacity: 0 !important; height: 0 !important; overflow: hidden !important; padding: 0 !important; margin: 0 !important; border: none !important; } .main-nav-container.fixed-header #store-filter-nav { opacity: 1 !important; height: auto !important; padding-top: 6px !important; border-bottom: 1px solid #f0f0f0 !important; } /* 🛑 1. هندسة الشبكة المتجاوبة 🛑 */ @media (max-width: 767px) { .s-products-list-horizontal-cards, .s-products-list-wrapper, #s-products-list { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; padding: 10px 8px !important; } } @media (min-width: 768px) and (max-width: 1024px) { .s-products-list-horizontal-cards, .s-products-list-wrapper, #s-products-list { display: grid !important; grid-template-columns: repeat(2, 296px) !important; gap: 16px !important; padding: 16px 0 !important; justify-content: flex-start !important; } } @media (min-width: 1025px) { .s-products-list-horizontal-cards, .s-products-list-wrapper, #s-products-list { display: grid !important; grid-template-columns: repeat(4, 296px) !important; gap: 20px !important; padding: 0 !important; justify-content: flex-start !important; align-content: start !important; } } /* 🛑 2. الضربة القاضية لـ hover_style_2 🛑 */ .s-products-list-wrapper custom-salla-product-card, .s-products-list-wrapper .product-card, .swiper-slide custom-salla-product-card, .swiper-slide .product-card, custom-salla-product-card, salla-product-card, .product-card { display: flex !important; flex-direction: column !important; height: auto !important; min-height: 100% !important; margin: 0 !important; background: #fff !important; border-radius: 8px !important; border: none !important; box-shadow: none !important; overflow: hidden !important; } @media (min-width: 768px) { body custom-salla-product-card, body salla-product-card, body .product-card, body .s-products-list-wrapper custom-salla-product-card, body .s-products-list-wrapper .product-card, body .s-products-slider-wrapper custom-salla-product-card, body .s-products-slider-wrapper .product-card, body .swiper-slide custom-salla-product-card, body .swiper-slide .product-card { width: 296px !important; min-width: 296px !important; max-width: 296px !important; } body .s-products-slider-wrapper custom-salla-product-card, body .s-products-slider-wrapper .product-card, body .swiper-slide custom-salla-product-card, body .swiper-slide .product-card { width: 100% !important; min-width: 0 !important; max-width: 100% !important; } } .product-card.hover_style_2::before, .product-card.hover_style_2::after, .product-card.hover_style_2 .product-card__image::before, .product-card.hover_style_2 .product-card__image::after { display: none !important; } .product-card.hover_style_2 .product-card__content, .product-card.hover_style_2 .product-card__content-wrapper, .product-card__content, .product-card__content-wrapper { position: relative !important; transform: none !important; bottom: auto !important; top: auto !important; left: auto !important; right: auto !important; opacity: 1 !important; visibility: visible !important; height: auto !important; max-height: none !important; background: transparent !important; } /* 🛑 3. ذكاء الأبعاد للصور + تأثير التحميل (Skeleton) 🛑 */ .s-products-list-wrapper custom-salla-product-card .product-card__image, .product-card .product-card__image, .swiper-slide .product-card__image { padding: 0 !important; display: block !important; background: #f7f7f7 !important; position: relative !important; width: 100% !important; overflow: hidden !important; } .product-card .product-card__image a { display: block !important; width: 100% !important; height: 100% !important; position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; background: transparent !important; } .product-card .product-card__image img { position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; margin: auto !important; object-fit: cover !important; width: 100% !important; z-index: 2 !important; background-color: transparent !important; transition: opacity 0.5s ease-in !important; } body salla-products-slider, body salla-slider, body .swiper, body .swiper-wrapper, body .swiper-slide, body .s-products-slider-card { height: auto !important; } /* رجعنا مقاساتك بالضبط للجوال */ @media (max-width: 767px) { .s-products-list-wrapper custom-salla-product-card .product-card__image, .product-card .product-card__image, .swiper-slide .product-card__image { height: 220px !important; min-height: 220px !important; max-height: 240px !important; } .product-card .product-card__image img { max-height: 220px !important; height: 190px !important; } .product-card { width: 100% !important; } } /* رجعنا مقاساتك بالضبط للكمبيوتر */ @media (min-width: 768px) { body .product-card__image, body custom-salla-product-card .product-card__image, body .swiper-slide .product-card__image, body .s-products-slider-card .product-card__image { height: 370px !important; min-height: 370px !important; max-height: 400px !important; } body .product-card__image img { max-height: 350px !important; height: 400px !important; } } /* 🚀 حل مشكلة الانهيار (CLS) وتأثير التحميل 🚀 */ .s-slider-container:not(.swiper-initialized) .swiper-wrapper { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; overflow: hidden !important; gap: 15px !important; } .s-slider-container:not(.swiper-initialized) .swiper-slide { width: 160px !important; flex: 0 0 auto !important; } @media (min-width: 768px) { .s-slider-container:not(.swiper-initialized) .swiper-slide { width: 296px !important; } } /* 1. نقل الشعار والنبض لطبقة مستقلة (لكي لا ينبض المنتج نفسه) */ .product-card .product-card__image::before { content: "" !important; position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; background-image: url('https://cdn.files.salla.network/theme/979524022/05c28371-8f44-4e02-9424-39d5d3f8d681.webp') !important; background-size: 40% !important; background-position: center !important; background-repeat: no-repeat !important; animation: skeleton-pulse 1.5s infinite ease-in-out !important; z-index: 1 !important; /* تحت الصورة */ } /* 2. إخفاء الشعار والنبض تماماً بمجرد تحميل صورة المنتج */ .st-img-loaded .product-card__image::before { display: none !important; animation: none !important; } @keyframes skeleton-pulse { 0% { background-color: #fcfcfc; opacity: 0.8; } 50% { background-color: #ededed; opacity: 1; } 100% { background-color: #fcfcfc; opacity: 0.8; } } /* 🛑 4. تصميم العناصر الداخلية وتحرير السعر 🛑 */ body .product-card__content, body .product-card__title, body .product-card__title a, body .product-card__title h3, body .product-card__subtitle, body .store-static-subtitle, body .product-card__price, body .custom-anim-promo { padding-right: 0px !important; margin-right: 0px !important; text-align: right !important; } body .product-card__title, body .product-card__title a, body .product-card__title h3 { font-size: 13px !important; font-weight: bold !important; color: #111 !important; margin-bottom: 2px !important; line-height: 1.4 !important; white-space: normal !important; } body .store-static-subtitle { font-size: 14px !important; font-weight: 500 !important; color: #737373 !important; margin-bottom: 8px !important; line-height: 1.4 !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; height: 20px !important; } body .product-card__price { margin-top: auto !important; margin-bottom: 0 !important; display: flex !important; align-items: center !important; gap: 6px !important; flex-direction: row !important; justify-content: flex-start !important; width: 100% !important; } body .product-card__price .total-price { font-size: 14px !important; font-weight: 600 !important; color: red !important; margin: 0 !important; order: 1 !important; line-height: 14px !important; } body .product-card__price .before-price { font-size: 14px !important; font-weight: 400 !important; color: #999 !important; margin: 0 !important; order: 2 !important; line-height: 14px !important; text-decoration: line-through !important; } .delivery-time-badge { position: relative !important; color: #111 !important; font-size: 12px !important; font-weight: 700 !important; line-height: 14px !important; font-style: italic !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; margin-top: 8px !important; padding: 0 0px !important; width: max-content !important; z-index: 1 !important; } .delivery-time-badge::before { content: "" !important; position: absolute !important;background-color: #61989c75 !important; top: 50% !important; right: 0 !important; left: 0 !important; height: 14px !important; transform: skew(10deg) translateY(-50%) !important; z-index: -1 !important; border-radius: 2px !important; } .custom-anim-promo { margin-top: 6px !important; width: 100% !important; height: 20px !important; overflow: hidden !important; } .custom-anim-promo .anim-text { font-size: 14px !important; font-weight: 500 !important; color: #737373 !important; line-height: 14px !important; } .product-card__promotion { position: absolute !important; top: 10px !important; right: 0 !important; left: auto !important; bottom: auto !important; background: #fbfbfb !important; color: #111 !important; font-size: 11px !important; font-weight: 700 !important; padding: 0 8px 0 10px !important; border-radius: 4px 0 0 4px !important; z-index: 20 !important; display: flex !important; align-items: center !important; justify-content: center !important; height: 24px !important; max-height: 24px !important; width: max-content !important; white-space: nowrap !important; box-shadow: -2px 2px 5px rgba(0,0,0,0.04) !important; border: 1px solid #eee !important; border-right: none !important; } /* 🛑 5. الهندسة الصارمة للأزرار ومساحات التثبيت 🛑 */ body custom-salla-product-card, body .product-card { position: relative !important; } body .product-card__image .product-card__actions, body .product-card__content .quickview-btn, body .product-card__content .product-card__buttons .addToCart, .product-card__discount { display: none !important; visibility: hidden !important; } body .product-card__content .product-card__buttons { display: none !important; margin: 0 !important; height: 0 !important; padding: 0 !important; } body .product-card__content { padding-left: 50px !important; min-height: 120px !important; display: flex !important; flex-direction: column !important; } body custom-salla-product-card .product-card__mini-cart, body .product-card .product-card__mini-cart, body .product-card__mini-cart { display: block !important; position: absolute !important; visibility: visible !important; opacity: 1 !important; transform: none !important; left: 12px !important; right: auto !important; top: auto !important; width: 35px !important; height: 35px !important; z-index: 99 !important; margin: 0 !important; padding: 0 !important; } body .product-card__mini-cart salla-add-product-button, body .product-card__mini-cart .w-full, body .product-card__mini-cart salla-button { width: 35px !important; height: 35px !important; min-width: 35px !important; max-width: 35px !important; min-height: 35px !important; max-height: 35px !important; display: block !important; background: transparent !important; border: none !important; box-shadow: none !important; margin: 0 !important; padding: 0 !important; transform: none !important; top: auto !important; } body .product-card__mini-cart button { border-radius: 6px !important; background: #f7f7f7 !important; border: 0px solid #eaeaea !important; width: 35px !important; height: 35px !important; min-width: 35px !important; max-width: 35px !important; display: flex !important; align-items: center !important; justify-content: center !important; cursor: pointer !important; visibility: visible !important; opacity: 1 !important; transform: none !important; margin: 0 !important; padding: 0 !important; top: auto !important; } body .product-card__mini-cart .s-button-text { display: none !important; font-size: 0 !important; color: transparent !important; } body .product-card__mini-cart .sicon-shopping { display: none !important; visibility: hidden !important; } body .product-card__mini-cart button::after { content: "" !important; display: block !important; width: 16px !important; height: 16px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'%3E%3C/circle%3E%3Ccircle cx='20' cy='21' r='1'%3E%3C/circle%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'%3E%3C/path%3E%3C/svg%3E") !important; background-size: contain !important; background-repeat: no-repeat !important; background-position: center !important; visibility: visible !important; opacity: 1 !important; } @media (min-width: 768px) { body custom-salla-product-card .product-card__mini-cart, body .product-card .product-card__mini-cart, body .product-card__mini-cart { bottom: 26px !important; left: 0px !important; } body .product-card .st-moved-wishlist { display: flex !important; visibility: visible !important; opacity: 1 !important; position: absolute !important; top: 382px !important; bottom: auto !important; left: 3px !important; right: auto !important; width: 35px !important; height: 35px !important; z-index: 65 !important; margin: 0 !important; padding: 0 !important; } body .product-card .st-moved-wishlist salla-button, body .product-card .st-moved-wishlist button { display: flex !important; background: transparent !important; border: none !important; box-shadow: none !important; animation: none !important; transition: none !important; transform: none !important; width: 35px !important; height: 35px !important; min-width: 35px !important; max-width: 35px !important; justify-content: center !important; align-items: center !important; padding: 0 !important; margin: 0 !important; cursor: pointer !important; top: auto !important; } body .product-card .st-moved-wishlist i, body .product-card .st-moved-wishlist .sicon-heart { font-family: 'sallaicons' !important; color: #b5b5b5 !important; font-size: 22px !important; display: inline-block !important; margin: 0 !important; } body .product-card .st-moved-wishlist:hover i { color: #dd0808 !important; } } @media (max-width: 767px) { body custom-salla-product-card .product-card__mini-cart, body .product-card .product-card__mini-cart, body .product-card__mini-cart { bottom: 50px !important; left: 0px !important; } body .product-card .st-moved-wishlist, body .product-card .wishlist, body .product-card__content .wishlist, body .btn--wishlist, body .heart-next-add-button { display: none !important; visibility: hidden !important; opacity: 0 !important; } } /* 🎯 6. إصلاحات صفحة الماركات حصرياً 🎯 */ body.brands-single main { padding-top: 140px !important; } body.brands-single .container > header:first-of-type { flex-direction: column !important; align-items: center !important; text-align: center !important; justify-content: center !important; display: none !important; } body.brands-single .container > header:first-of-type img { margin: 0 auto 15px !important; max-height: 120px !important; position: relative !important; z-index: 1 !important; } body.brands-single .container > header:first-of-type .px-5 { padding: 0 !important; text-align: center !important; } body.brands-single .container > header:first-of-type h1 { text-align: center !important; width: 100% !important; } `; document.head.appendChild(style); } // 🌟 4. المحرك البرمجي الذكي لمعالجة المنتجات 🌟 function processSingleCard(card) { let wrapper = card.closest('custom-salla-product-card') || card; if (wrapper.classList.contains('st-processed')) return; wrapper.classList.add('st-processed'); let wishlist = wrapper.querySelector('.product-card__content .wishlist') || wrapper.querySelector('.wishlist'); if (wishlist && !wrapper.classList.contains('st-heart-moved')) { wishlist.classList.add('st-moved-wishlist'); wrapper.appendChild(wishlist); wrapper.classList.add('st-heart-moved'); } if (wrapper.classList.contains('hover_style_2')) { wrapper.classList.remove('hover_style_2'); } let titleLink = wrapper.querySelector('.product-card__title a'); let sku = wrapper.getAttribute('data-sku'); if (!sku && titleLink) { let url = titleLink.getAttribute('href'); if (url) { let slug = url.split('/').filter(Boolean).pop(); if (slug) { sku = slug.split('-')[0]; wrapper.setAttribute('data-sku', sku); } } } if (sku && window.drawDeliveryBadge) { window.drawDeliveryBadge(wrapper, sku); } let titleNode = wrapper.querySelector('.product-card__title a, .product-card__title h3'); if (titleNode && !titleNode.hasAttribute('data-trimmed')) { if (titleNode.textContent.includes('|')) titleNode.textContent = titleNode.textContent.split('|')[0].trim(); titleNode.setAttribute('data-trimmed', 'true'); } // 🧠 محرك التمييز الذكي لتعبئة الصور (الأكواب والدببة) 🧠 let titleText = titleNode ? titleNode.textContent : ""; let fillKeywords = ['كوب', 'دب', 'تيدي', 'مج', 'كفر']; if (fillKeywords.some(word => titleText.includes(word))) { wrapper.classList.add('st-cover-mode'); } let sub = wrapper.querySelector('.product-card__subtitle, .s-product-card-content-subtitle'); let priceWrapper = wrapper.querySelector('.product-card__price'); if (sub && priceWrapper) { if (!sub.hasAttribute('data-original-text')) { sub.setAttribute('data-original-text', sub.textContent.trim()); } let text = sub.getAttribute('data-original-text'); if (text) { let parts = text.split(/\|+/).map(p => p.trim()).filter(p => p.length > 0); if (!sub.hasAttribute('data-fixed-text')) { sub.textContent = parts[0]; sub.classList.add('store-static-subtitle'); sub.setAttribute('data-fixed-text', 'true'); } if (parts.length > 1) { let promoParts = parts.slice(1); let animContainer = wrapper.querySelector('.custom-anim-promo'); if (!animContainer) { animContainer = document.createElement('div'); animContainer.className = 'custom-anim-promo'; let badgeNode = wrapper.querySelector('.delivery-time-badge'); let targetNode = badgeNode ? badgeNode : priceWrapper; targetNode.insertAdjacentElement('afterend', animContainer); } if(animContainer.getAttribute('data-parts') !== JSON.stringify(promoParts)) { animContainer.setAttribute('data-parts', JSON.stringify(promoParts)); animContainer.setAttribute('data-index', '0'); animContainer.innerHTML = `${promoParts[0]}`; } } } } if (window.DynamicPricing) window.DynamicPricing.enqueue(wrapper); } // 🌟 5. تشغيل الأنميشن 🌟 if (!window.storeAnimInterval) { window.storeAnimInterval = setInterval(() => { document.querySelectorAll('.custom-anim-promo[data-parts]').forEach(container => { let parts = JSON.parse(container.getAttribute('data-parts')); let span = container.querySelector('.anim-text'); if (!span || parts.length < 2) return; let idx = (parseInt(container.getAttribute('data-index')) + 1) % parts.length; container.setAttribute('data-index', idx); span.style.opacity = '0'; span.style.transform = 'translateY(-4px)'; setTimeout(() => { span.textContent = parts[idx]; span.style.transition = 'none'; span.style.transform = 'translateY(4px)'; void span.offsetWidth; span.style.transition = 'all 0.4s ease'; span.style.opacity = '1'; span.style.transform = 'translateY(0)'; }, 400); }); }, 3000); } // 🌟 6. الفلتر الشامل 🌟 const currentPath = window.location.pathname.toLowerCase(); const isTargetPage = ( currentPath.includes('/c') || currentPath.match(/\/c\d+/) || currentPath.includes('/brand-') || currentPath.includes('most-sales-products') || currentPath.includes('/outlet') ); const isExcludedPage = currentPath.includes('/cart') || currentPath.includes('/checkout'); if (isTargetPage && !isExcludedPage) { let filterAttempts = 0; const filterCheck = setInterval(() => { if (document.getElementById('store-filter-nav')) { clearInterval(filterCheck); return; } const productsContainer = document.querySelector('salla-products-list, #s-products-list, .s-products-list-wrapper'); const headerTarget = document.querySelector('.main-nav-container .container, header .container, .s-site-header .container'); if (headerTarget && productsContainer && productsContainer.parentNode) { const storeBrands = [ {name: "Nike", id: "2030153367"}, {name: "Asics", id: "1741620106"}, {name: "New balance", id: "831791755"}, {name: "Adidas", id: "57754004"}, {name: "Puma", id: "1566466197"}, {name: "Brooks", id: "790925206"}, {name: "On Running", id: "1257164176"} ]; let brandsHtml = ''; storeBrands.forEach(b => { brandsHtml += ``; }); const catSliderWrapper = document.querySelector('.container salla-slider[id^="sub-cats"]'); if (catSliderWrapper) { const catContainer = catSliderWrapper.closest('.container'); if (catContainer) catContainer.style.display = 'none'; } const navWrapper = document.createElement('div'); navWrapper.id = 'store-filter-nav'; navWrapper.className = 'st-pills-container'; let filterSvg = ``; let arrowSvg = ``; let accArrow = ``; navWrapper.innerHTML = ` `; headerTarget.parentNode.insertBefore(navWrapper, headerTarget.nextSibling); const modalOverlay = document.createElement('div'); modalOverlay.id = 'st-filter-modal'; modalOverlay.className = 'st-modal-overlay hidden'; let actionBtns = `
`; let sortHTML = `
الترتيب ${accArrow}
${actionBtns}
`; let brandAccHTML = `
الماركة ${accArrow}
${brandsHtml}
${actionBtns}
`; let sizeHTML = `
المقاس ${accArrow}
`; for(let i = 36; i <= 48; i++) sizeHTML += ``; sizeHTML += `
${actionBtns}
`; let priceHTML = `
السعر ${accArrow}
سعر مخصص (ريال)
${actionBtns}
`; modalOverlay.innerHTML = `

كل فلاتر التصفية

الترتيب
الماركة
المقاس
السعر
${sortHTML}
${brandAccHTML}
${sizeHTML}
${priceHTML}
`; if (!productsContainer.parentNode.classList.contains('st-native-layout')) { productsContainer.parentNode.insertBefore(modalOverlay, productsContainer); productsContainer.parentNode.classList.add('st-native-layout'); } if (!document.getElementById('store-filter-css')) { const style = document.createElement('style'); style.id = 'store-filter-css'; style.innerHTML = ` .st-pills-container { display: flex; align-items: center; gap: 8px; padding: 10px; overflow-x: auto; scrollbar-width: none; background: #fff; border-bottom: 1px solid #f0f0f0; } .st-pills-container::-webkit-scrollbar { display: none; } .st-pill { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; border: 1px solid #e5e7eb; background: #fff; font-size: 13px; font-weight: bold; color: #111; cursor: pointer; } .st-pill.active { border-color: #111 !important; background: #111 !important; color: #fff !important; } /* إعدادات الجوال */ .st-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999999; backdrop-filter: blur(2px); transition: opacity 0.3s; } .st-modal-overlay.hidden { opacity: 0; pointer-events: none; } .st-modal-content { position: absolute; bottom: 0; left: 0; width: 100%; height: 85vh; background: #fff; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.3s ease-out; font-family: var(--font-readex, inherit) !important; } .st-modal-overlay:not(.hidden) .st-modal-content { transform: translateY(0); } .st-modal-header { padding: 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; } .st-modal-header h3 { font-size: 16px; font-weight: bold; margin: 0; color: #111; } #st-close-modal { background: none; border: none; color: #666; cursor: pointer; padding: 4px; } .st-modal-body { display: flex; flex: 1; overflow: hidden; direction: rtl; } .st-tabs-sidebar { width: 30%; background: #f9f9f9; border-left: 1px solid #eee; overflow-y: auto; } .st-tab-item { padding: 16px 10px; font-size: 13px; font-weight: bold; color: #666; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.2s; } .st-tab-item.active { background: #fff; color: #111; border-right: 3px solid #111; } .st-tabs-content { width: 70%; padding: 16px; overflow-y: auto; background: #fff; } .st-panel { display: none; animation: fadeIn 0.3s; } .st-panel.active { display: block; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } /* الأزرار المشتركة */ .st-sort-btn, .st-price-btn, .st-brand-btn { padding: 12px; border: 1px solid #eee; border-radius: 8px; background: #fff; font-size: 13px; font-weight: bold; color: #111; text-align: right; display: block; width: 100%; margin-bottom: 8px; text-decoration: none; cursor: pointer; transition: all 0.2s;} .st-brand-btn { text-align: left !important; direction: ltr !important; padding-left: 16px !important; } .st-sort-btn.selected, .st-price-btn.selected, .st-brand-btn.selected { border-color: #111 !important; background: #111 !important; color: #fff !important; } .st-size-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .st-size-btn { padding: 10px 0; border: 1px solid #eee; border-radius: 8px; background: #fff; font-size: 14px; font-weight: bold; color: #111; cursor: pointer;} .st-size-btn.selected { border-color: #111 !important; background: #111 !important; color: #fff !important; } .st-custom-price { margin-top: 10px; padding: 12px; background: #f9f9f9; border-radius: 8px; } .st-custom-price input { width: 100%; border: 1px solid #ddd; padding: 8px; border-radius: 6px; outline: none; font-size: 13px; text-align: center; margin-top: 6px; } .st-panel-actions { display: flex; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #eaeaea; } .st-btn-secondary { width: 30%; padding: 12px; border-radius: 8px; background: #f3f4f6; color: #111; font-weight: bold; border: none; font-size: 14px; cursor: pointer; transition: 0.2s; } .st-btn-secondary:hover { background: #e5e7eb; } .st-btn-primary { width: 70%; padding: 12px; border-radius: 8px; background: #111; color: #fff; font-weight: bold; border: none; font-size: 14px; cursor: pointer; transition: 0.2s; } .st-btn-primary:hover { background: #333; } @media (max-width: 767px) { .st-native-layout { display: block !important; } .st-acc-header { display: none !important; } .st-acc-body { display: block !important; } } @media (min-width: 768px) { #store-filter-nav { display: none !important; } .st-native-layout { display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; justify-content: space-between !important; align-items: flex-start !important; } .st-native-layout > div.flex.justify-between.items-center:first-of-type { width: 100% !important; margin-bottom: 20px !important; } .st-native-layout > salla-hook { display: none !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important; } .st-modal-overlay.hidden, .st-modal-overlay { position: sticky !important; top: 100px !important; width: 260px !important; min-width: 260px !important; background: transparent !important; opacity: 1 !important; pointer-events: auto !important; flex-shrink: 0 !important; z-index: 10 !important; display: block !important; margin: 0 !important; } .st-native-layout > salla-products-list, .st-native-layout > #s-products-list, .st-native-layout > .s-products-list-wrapper { flex-grow: 1 !important; width: calc(100% - 292px) !important; max-width: calc(100% - 292px) !important; margin: 0 !important; padding: 0 !important; } .st-modal-content { position: relative !important; height: auto !important; max-height: calc(100vh - 120px) !important; transform: none !important; border: 1px solid #eaeaea !important; background: #fff !important; padding: 0 !important; overflow-y: auto !important; scrollbar-width: none; border-radius: 12px !important; box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;} .st-modal-content::-webkit-scrollbar { display: none; } .st-modal-header { padding: 16px !important; border-bottom: 1px solid #eaeaea !important; display: block !important; background: #fff !important; position: sticky !important; top: 0 !important; z-index: 100 !important; } .st-modal-header h3 { font-size: 16px !important; font-weight: 900 !important; margin: 0 !important;} #st-close-modal { display: none !important; } .st-modal-body { display: block !important; overflow: visible !important; } .st-tabs-sidebar { display: none !important; } .st-tabs-content { width: 100% !important; padding: 0 !important; background: transparent !important; } .st-panel { display: block !important; margin-bottom: 0 !important; animation: none !important; } .st-acc-header { display: flex !important; justify-content: space-between !important; align-items: center !important; font-weight: bold !important; font-size: 14px !important; color: #111 !important; padding: 16px !important; cursor: pointer !important; border-bottom: 1px solid #eaeaea !important; user-select: none; background: #fff !important;} .st-acc-arr { transition: transform 0.3s ease !important; } .st-acc-body { display: none !important; padding: 16px !important; background: #fafafa !important;} .st-panel.acc-open .st-acc-body { display: block !important; animation: fadeIn 0.3s ease; } .st-panel.acc-open .st-acc-header { border-bottom: none !important; background: #fafafa !important; } .st-panel.acc-open .st-acc-arr { transform: rotate(180deg) !important; } .st-sort-btn, .st-price-btn, .st-brand-btn { border: 1px solid #eaeaea !important; border-radius: 8px !important; padding: 10px 12px !important; margin-bottom: 8px !important; background: #fff !important; transition: all 0.2s !important; display: block; width: 100%; text-align: right;} .st-sort-btn:hover, .st-price-btn:hover, .st-brand-btn:hover { border-color: #111 !important; } .st-sort-btn.selected, .st-price-btn.selected, .st-brand-btn.selected { color: #fff !important; font-weight: 900 !important; background: #111 !important; border-color: #111 !important; } } `; document.head.appendChild(style); } const modal = document.getElementById('st-filter-modal'); const pills = document.querySelectorAll('.st-pill'); const tabs = document.querySelectorAll('.st-tab-item'); const panels = document.querySelectorAll('.st-panel'); const sizeBtns = document.querySelectorAll('.st-size-grid button'); const priceBtns = document.querySelectorAll('.st-price-list button'); const sortBtns = document.querySelectorAll('.st-sort-list button'); const brandBtns = document.querySelectorAll('.st-brand-btn'); let pendingSize = null; let pendingPriceMin = null; let pendingPriceMax = null; let pendingSort = null; let pendingBrand = null; document.querySelectorAll('.st-acc-header').forEach(header => { header.addEventListener('click', function() { const parentPanel = this.parentElement; const isOpen = parentPanel.classList.contains('acc-open'); document.querySelectorAll('.st-panel').forEach(p => p.classList.remove('acc-open')); if (!isOpen) { parentPanel.classList.add('acc-open'); } }); }); const urlParams = new URLSearchParams(window.location.search); const activeSizeInUrl = urlParams.get('filters[variants][المقاس]'); if (activeSizeInUrl) { pendingSize = activeSizeInUrl; sizeBtns.forEach(b => { if(b.getAttribute('data-val') === activeSizeInUrl) b.classList.add('selected'); }); pills.forEach(p => { if(p.getAttribute('data-open-tab') === 'size') { p.classList.add('active'); p.innerHTML = `المقاس: ${activeSizeInUrl}`; } }); } const activeSortInUrl = urlParams.get('sort') || 'ourSuggest'; pendingSort = activeSortInUrl; sortBtns.forEach(b => { if(b.getAttribute('data-val') === activeSortInUrl) b.classList.add('selected'); }); const activeBrandInUrl = urlParams.get('filters[brand_id]'); if (activeBrandInUrl) { pendingBrand = activeBrandInUrl; brandBtns.forEach(b => { if(b.getAttribute('data-val') === activeBrandInUrl) b.classList.add('selected'); }); let matchedBrand = storeBrands.find(b => b.id === activeBrandInUrl); pills.forEach(p => { if(p.getAttribute('data-open-tab') === 'brand') { p.classList.add('active'); p.innerHTML = `الماركة: ${matchedBrand ? matchedBrand.name : ''}`; } }); } const activePriceMinInUrl = urlParams.get('filters[price][min]'); const activePriceMaxInUrl = urlParams.get('filters[price][max]'); if (activePriceMinInUrl !== null || activePriceMaxInUrl !== null) { pendingPriceMin = activePriceMinInUrl ? Number(activePriceMinInUrl) : 0; pendingPriceMax = activePriceMaxInUrl ? Number(activePriceMaxInUrl) : Infinity; let maxTxt = pendingPriceMax === Infinity ? 'وأكثر' : pendingPriceMax; pills.forEach(p => { if(p.getAttribute('data-open-tab') === 'price') { p.classList.add('active'); p.innerHTML = `السعر: ${pendingPriceMin}-${maxTxt}`; } }); priceBtns.forEach(b => { if(b.getAttribute('data-min') == pendingPriceMin && b.getAttribute('data-max') == pendingPriceMax) b.classList.add('selected'); }); if (activePriceMinInUrl) document.getElementById('st-min-p').value = activePriceMinInUrl; if (activePriceMaxInUrl) document.getElementById('st-max-p').value = activePriceMaxInUrl; } pills.forEach(pill => { pill.addEventListener('click', () => { let target = pill.getAttribute('data-open-tab'); tabs.forEach(t => t.classList.remove('active')); panels.forEach(p => p.classList.remove('active')); let activeTab = document.querySelector(`.st-tab-item[data-target="st-panel-${target}"]`); let activePanel = document.getElementById(`st-panel-${target}`); if (!activeTab || !activePanel) { activeTab = document.querySelector('.st-tab-item'); activePanel = document.querySelector('.st-panel'); } if(activeTab) activeTab.classList.add('active'); if(activePanel) activePanel.classList.add('active'); modal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; }); }); document.getElementById('st-close-modal').addEventListener('click', () => { modal.classList.add('hidden'); document.body.style.overflow = ''; }); modal.addEventListener('click', (e) => { if(window.innerWidth < 768 && e.target === modal) { modal.classList.add('hidden'); document.body.style.overflow = ''; } }); tabs.forEach(tab => { tab.addEventListener('click', () => { tabs.forEach(t => t.classList.remove('active')); panels.forEach(p => p.classList.remove('active')); tab.classList.add('active'); document.getElementById(tab.getAttribute('data-target')).classList.add('active'); }); }); sortBtns.forEach(btn => { btn.addEventListener('click', () => { sortBtns.forEach(b => b.classList.remove('selected')); btn.classList.add('selected'); pendingSort = btn.getAttribute('data-val'); }); }); sizeBtns.forEach(btn => { btn.addEventListener('click', () => { sizeBtns.forEach(b => b.classList.remove('selected')); btn.classList.add('selected'); pendingSize = btn.getAttribute('data-val'); }); }); priceBtns.forEach(btn => { btn.addEventListener('click', () => { priceBtns.forEach(b => b.classList.remove('selected')); btn.classList.add('selected'); pendingPriceMin = Number(btn.getAttribute('data-min')); pendingPriceMax = Number(btn.getAttribute('data-max')); }); }); brandBtns.forEach(btn => { btn.addEventListener('click', () => { brandBtns.forEach(b => b.classList.remove('selected')); btn.classList.add('selected'); pendingBrand = btn.getAttribute('data-val'); }); }); document.querySelectorAll('.st-apply-btn').forEach(applyBtn => { applyBtn.addEventListener('click', () => { let customMin = document.getElementById('st-min-p').value; let customMax = document.getElementById('st-max-p').value; if(customMin || customMax) { pendingPriceMin = Number(customMin) || 0; pendingPriceMax = Number(customMax) || Infinity; } let requiresRedirect = false; const newParams = new URLSearchParams(window.location.search); if (pendingSize && pendingSize !== activeSizeInUrl) { newParams.set('filters[variants][المقاس]', pendingSize); requiresRedirect = true; } if (pendingSort && pendingSort !== activeSortInUrl) { newParams.set('sort', pendingSort); requiresRedirect = true; } if (pendingBrand && pendingBrand !== activeBrandInUrl) { newParams.set('filters[brand_id]', pendingBrand); requiresRedirect = true; } let currentMinInUrl = newParams.get('filters[price][min]'); let currentMaxInUrl = newParams.get('filters[price][max]'); if (pendingPriceMin !== null && String(pendingPriceMin) !== String(currentMinInUrl)) { newParams.set('filters[price][min]', pendingPriceMin); requiresRedirect = true; } if (pendingPriceMax !== null && pendingPriceMax !== Infinity && String(pendingPriceMax) !== String(currentMaxInUrl)) { newParams.set('filters[price][max]', pendingPriceMax); requiresRedirect = true; } else if (pendingPriceMax === Infinity && newParams.has('filters[price][max]')) { newParams.delete('filters[price][max]'); requiresRedirect = true; } if (requiresRedirect) { const catMatch = window.location.pathname.match(/\/c(\d+)$/); if(catMatch) newParams.set('filters[category_id]', catMatch[1]); window.location.href = window.location.pathname + '?' + newParams.toString(); return; } if(window.innerWidth < 768) { modal.classList.add('hidden'); document.body.style.overflow = ''; } }); }); document.querySelectorAll('.st-clear-btn').forEach(clearBtn => { clearBtn.addEventListener('click', () => { try { const newParams = new URLSearchParams(window.location.search); let changed = false; if (newParams.has('filters[variants][المقاس]')) { newParams.delete('filters[variants][المقاس]'); changed = true; } if (newParams.has('filters[category_id]')) { newParams.delete('filters[category_id]'); changed = true; } if (newParams.has('filters[brand_id]')) { newParams.delete('filters[brand_id]'); changed = true; } if (newParams.has('filters[price][min]')) { newParams.delete('filters[price][min]'); changed = true; } if (newParams.has('filters[price][max]')) { newParams.delete('filters[price][max]'); changed = true; } if (newParams.has('sort') && newParams.get('sort') !== 'ourSuggest') { newParams.set('sort', 'ourSuggest'); changed = true; } if(changed) { window.location.href = window.location.pathname + (newParams.toString() ? '?' + newParams.toString() : ''); return; } } catch(e){} sizeBtns.forEach(b => b.classList.remove('selected')); priceBtns.forEach(b => b.classList.remove('selected')); brandBtns.forEach(b => b.classList.remove('selected')); sortBtns.forEach(b => { b.classList.remove('selected'); if(b.getAttribute('data-val') === 'ourSuggest') b.classList.add('selected'); }); document.getElementById('st-min-p').value = ''; document.getElementById('st-max-p').value = ''; pendingSize = null; pendingPriceMin = null; pendingPriceMax = null; pendingSort = 'ourSuggest'; pendingBrand = null; pills.forEach(p => { p.classList.remove('active'); if(p.getAttribute('data-open-tab') === 'size') p.innerHTML = `المقاس `; if(p.getAttribute('data-open-tab') === 'price') p.innerHTML = `السعر `; if(p.getAttribute('data-open-tab') === 'brand') p.innerHTML = `الماركة `; }); if(window.innerWidth < 768) { modal.classList.add('hidden'); document.body.style.overflow = ''; } }); }); clearInterval(filterCheck); } filterAttempts++; if (filterAttempts > 40) clearInterval(filterCheck); }, 100); } // 🌟 7. تهيئة المنتجات والمراقب الذكي الجديد 🌟 document.querySelectorAll('custom-salla-product-card, .product-card').forEach(card => { let wrapper = card.closest('custom-salla-product-card') || card; processSingleCard(wrapper); }); const observer = new MutationObserver((mutations) => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (node.nodeType === 1) { if (node.tagName && node.tagName.toLowerCase() === 'custom-salla-product-card') { processSingleCard(node); } else if (node.classList && node.classList.contains('product-card')) { let wrapper = node.closest('custom-salla-product-card') || node; processSingleCard(wrapper); } else if (node.querySelectorAll) { node.querySelectorAll('custom-salla-product-card').forEach(processSingleCard); } } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); }); document.addEventListener("DOMContentLoaded", function () { /* ==================================================================== 1. إصلاح مشكلة الإشعارات خلف الهيدر ==================================================================== */ const globalStyle = document.createElement('style'); globalStyle.innerHTML = ` .swal2-container { z-index: 999999 !important; } .swal2-container.swal2-top, .swal2-toast { margin-top: 85px !important; } `; document.head.appendChild(globalStyle); /* ==================================================================== 2. إخفاء كلمة "أصلي" ==================================================================== */ const greenElements = document.querySelectorAll('.text-green-500'); greenElements.forEach(function(el) { if (el.textContent.includes('أصلي')) { el.textContent = ''; } }); /* ==================================================================== 3. الأسئلة الشائعة (FAQ) ==================================================================== */ const faqStyle = document.createElement('style'); faqStyle.innerHTML = ` @media (max-width: 768px) { .s-block--faq .grid { display: none !important; } .faq-btn-wrapper { text-align: center; width: 100%; margin-top: 20px; } .faq-envelope-btn { display: flex !important; align-items: center; justify-content: center; gap: 8px; background: #2c3e50; color: #fff; padding: 12px 20px; border-radius: 12px; margin: 0 auto; width: 90%; max-width: 300px; font-weight: bold; border: none; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.15); } .my-faq-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); z-index: 99999; display: none; justify-content: center; align-items: center; backdrop-filter: blur(4px); } .my-faq-modal.show { display: flex !important; } .my-faq-modal .content { background: #fff; width: 90%; max-width: 400px; max-height: 75vh; border-radius: 15px; padding: 20px; display: flex; flex-direction: column; position: relative; box-shadow: 0 10px 25px rgba(0,0,0,0.2); z-index: 100000; } .my-faq-modal .close-btn { position: absolute; top: 15px; left: 15px; font-size: 22px; cursor: pointer; background: #f0f0f0; border-radius: 50%; width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; border: none; color: #333; z-index: 10; line-height: 1; } .my-faq-modal .modal-inner { overflow-y: auto; flex-grow: 1; margin-top: 10px; padding-right: 5px; } .my-faq-modal .single-faq { background: #fff !important; border: 1px solid #eee !important; border-radius: 8px !important; padding: 12px !important; margin-bottom: 10px !important; display: block !important; height: auto !important; position: static !important; } .my-faq-modal .faq-btn { display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; cursor: pointer !important; font-weight: bold !important; background: none !important; border: none !important; padding: 0 !important; color: #333 !important; font-size: 14px !important; } .my-faq-modal .faq-btn p { margin: 0 !important; } .my-faq-modal .faq-content { display: none !important; padding-top: 10px !important; margin-top: 10px !important; border-top: 1px solid #eee !important; color: #555 !important; font-size: 13px !important; height: auto !important; overflow: visible !important; opacity: 1 !important; visibility: visible !important; } .my-faq-modal .faq-content.is-visible { display: block !important; } .my-faq-modal .faq-btn i { transition: transform 0.3s ease; } .my-faq-modal .faq-btn.open i { transform: rotate(180deg); } } @media (min-width: 769px) { .s-block--faq .grid { display: grid !important; } .faq-btn-wrapper, .faq-envelope-btn, .my-faq-modal { display: none !important; } } .my-faq-modal .faq-content {max-height: max-content !important;} `; document.head.appendChild(faqStyle); let faqInitialized = false; const checkFaq = setInterval(() => { if(faqInitialized) { clearInterval(checkFaq); return; } const originalFaqSection = document.querySelector('.s-block--faq'); if (originalFaqSection) { const faqGrid = originalFaqSection.querySelector('.grid'); if (faqGrid && !document.querySelector('.faq-btn-wrapper')) { faqInitialized = true; clearInterval(checkFaq); const btnContainer = document.createElement('div'); btnContainer.className = 'faq-btn-wrapper'; btnContainer.innerHTML = ``; (originalFaqSection.querySelector('.container') || originalFaqSection).appendChild(btnContainer); const modalWrapper = document.createElement('div'); modalWrapper.id = 'faq-modal-portal'; document.documentElement.appendChild(modalWrapper); const modalOverlay = document.createElement('div'); modalOverlay.className = 'my-faq-modal'; modalOverlay.innerHTML = `

الأسئلة الشائعة

`; modalWrapper.appendChild(modalOverlay); const clonedGrid = faqGrid.cloneNode(true); clonedGrid.style.setProperty('display', 'block', 'important'); clonedGrid.querySelectorAll('.hidden').forEach(el => el.classList.remove('hidden')); clonedGrid.querySelectorAll('.faq-content').forEach(c => { c.style.cssText = ''; c.classList.remove('is-visible'); }); clonedGrid.querySelectorAll('.faq-btn').forEach(b => { b.classList.remove('open'); const icon = b.querySelector('i'); if(icon) icon.style.transform = 'rotate(0deg)'; }); modalOverlay.querySelector('.modal-inner').appendChild(clonedGrid); btnContainer.querySelector('button').onclick = () => { modalOverlay.classList.add('show'); document.documentElement.style.setProperty('overflow', 'hidden', 'important'); document.body.style.setProperty('overflow', 'hidden', 'important'); }; const closeModal = () => { modalOverlay.classList.remove('show'); document.documentElement.style.removeProperty('overflow'); document.body.style.removeProperty('overflow'); }; modalOverlay.querySelector('.close-btn').onclick = closeModal; modalOverlay.onclick = (e) => { if(e.target === modalOverlay) closeModal(); }; clonedGrid.querySelectorAll('.faq-btn').forEach(faqBtn => { faqBtn.onclick = function(e) { e.preventDefault(); const body = this.nextElementSibling || this.parentElement.querySelector('.faq-content'); if(!body) return; const isOpen = body.classList.contains('is-visible'); clonedGrid.querySelectorAll('.faq-content').forEach(c => c.classList.remove('is-visible')); clonedGrid.querySelectorAll('.faq-btn').forEach(b => { b.classList.remove('open'); const icon = b.querySelector('i'); if (icon) icon.style.transform = 'rotate(0deg)'; }); if (!isOpen) { body.classList.add('is-visible'); this.classList.add('open'); const icon = this.querySelector('i'); if (icon) icon.style.transform = 'rotate(180deg)'; } }; }); } } }, 500); /* ==================================================================== 4. حقن التنسيقات في Shadow DOM ==================================================================== */ function injectShadowStyle(componentName, styleId, cssCode) { const component = document.querySelector(`[component-name="${componentName}"]`); if (component && component.shadowRoot) { if (!component.shadowRoot.getElementById(styleId)) { const style = document.createElement('style'); style.id = styleId; style.innerHTML = cssCode; component.shadowRoot.appendChild(style); } return true; } return false; } const testimonialsCSS = `@media (max-width: 768px) { .s-block-trust-testimonials__slide--inner { display: flex !important; flex-direction: row !important; align-items: center !important; padding: 15px !important; gap: 15px !important; text-align: right !important; height: auto !important; background: #fff !important; position: relative !important; overflow: hidden !important; } .s-block-trust-testimonials__slide--inner::before, .s-block-trust-testimonials__slide--inner::after, .s-block-trust-testimonials__image-wrapper::before, .s-block-trust-testimonials__image-wrapper::after { display: none !important; } .s-block-trust-testimonials__image-wrapper { flex-shrink: 0 !important; width: 65px !important; height: 65px !important; margin: 0 !important; position: relative !important; border-radius: 50% !important; overflow: hidden !important; border: 2px solid #279b69 !important; } .s-block-trust-testimonials__image { width: 100% !important; height: 100% !important; object-fit: cover !important; } .s-block-trust-testimonials__content { display: flex !important; flex-direction: column !important; justify-content: center !important; padding: 0 !important; margin: 0 !important; z-index: 2 !important; } .s-block-trust-testimonials__name { font-size: 14px !important; font-weight: bold !important; margin-bottom: 4px !important; color: #279b69 !important; } .s-block-trust-testimonials__feedback { font-size: 12px !important; margin: 0 !important; line-height: 1.5 !important; color: #555 !important; } .s-block-trust-testimonials__quote-icon { display: none !important; } }`; const featuresCSS = `@media (max-width: 768px) { .s-block-trust-store-features__grid, .s-block-store-features__grid, .container, [class*="grid"] { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 12px 10px !important; padding: 10px !important; width: 100% !important; max-width: 100% !important; } .s-block-trust-store-features__item, .s-block-store-features__item, [class*="item"] { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: flex-start !important; text-align: center !important; padding: 12px 10px !important; background: #ffffff !important; border-radius: 12px !important; box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important; } .s-block-trust-store-features__media, .s-block-store-features__media, [class*="media"] { width: 42px !important; height: 42px !important; margin: 0 0 10px 0 !important; display: flex !important; justify-content: center !important; align-items: center !important; border-radius: 50% !important; } .s-block-trust-store-features__icon, .s-block-store-features__icon, i { font-size: 20px !important; } .s-block-trust-store-features__title, .s-block-store-features__title, h3 { font-size: 13px !important; font-weight: bold !important; margin: 0 0 4px 0 !important; line-height: 1.3 !important; color: #333 !important; } .s-block-trust-store-features__subtitle, .s-block-store-features__subtitle, p { font-size: 11px !important; line-height: 1.4 !important; margin: 0 !important; color: #777 !important; } }`; let testimonialsDone = false, featuresDone = false; const shadowInterval = setInterval(() => { if (!testimonialsDone) testimonialsDone = injectShadowStyle('trust-testimonials', 'my-testimonials-style', testimonialsCSS); if (!featuresDone) featuresDone = injectShadowStyle('store-features', 'my-features-style', featuresCSS); if (testimonialsDone && featuresDone) clearInterval(shadowInterval); }, 500); /* ==================================================================== 5. نظام الألوان المتطابق (Proxy System) ==================================================================== */ const colorProxyStyle = document.createElement('style'); colorProxyStyle.innerHTML = ` @keyframes proxyShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } } .proxy-error-state { border: 2px solid #ff4d4d !important; animation: proxyShake 0.4s ease; } .st-color-proxy-container { margin-top: 15px; padding: 15px 10px; background: #fcfcfc; border-radius: 12px; border: 1px solid #f0f0f0; } .st-color-proxy-wrapper { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; } .st-proxy-color-item { width: 42px; height: 42px; border-radius: 50%; border: 2px solid #e5e7eb; cursor: pointer; transition: all 0.2s ease; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05); position: relative; } .st-proxy-color-item:hover { transform: scale(1.08); border-color: #111827; } .st-proxy-color-item.active { border-color: #111827; box-shadow: 0 0 0 3px rgba(17,24,39,0.1); transform: scale(1.08); } @media (max-width: 768px) { .st-proxy-color-item { width: 36px; height: 36px; } } `; document.head.appendChild(colorProxyStyle); const proxyInterval = setInterval(() => { const colorOptionType = document.querySelector('.s-product-options-option[data-option-type="color"]'); const realContainer = colorOptionType ? colorOptionType.closest('.s-product-options-option-container') : null; const targetMedia = document.querySelector('.product-single__main-media'); if (realContainer && targetMedia) { if (realContainer.classList.contains('proxy-applied')) { clearInterval(proxyInterval); return; } realContainer.classList.add('proxy-applied'); realContainer.style.setProperty('position', 'absolute', 'important'); realContainer.style.setProperty('opacity', '0', 'important'); realContainer.style.setProperty('height', '0', 'important'); realContainer.style.setProperty('pointer-events', 'none', 'important'); realContainer.style.setProperty('overflow', 'hidden', 'important'); const proxyContainer = document.createElement('div'); proxyContainer.className = 'st-color-proxy-container'; proxyContainer.innerHTML = `
`; targetMedia.appendChild(proxyContainer); const realOptionDiv = realContainer.querySelector('.s-product-options-option'); if (realOptionDiv) { const errObserver = new MutationObserver(() => { if (realOptionDiv.classList.contains('s-product-options-option-error')) { proxyContainer.classList.add('proxy-error-state'); setTimeout(() => { proxyContainer.scrollIntoView({ behavior: 'smooth', block: 'center' }); }, 50); } else { proxyContainer.classList.remove('proxy-error-state'); } }); errObserver.observe(realOptionDiv, { attributes: true, attributeFilter: ['class'] }); } const proxyWrapper = proxyContainer.querySelector('.st-color-proxy-wrapper'); const realItems = realContainer.querySelectorAll('.s-product-options-colors-item'); const mainSlides = document.querySelectorAll('.details-slider .swiper-wrapper a.swiper-slide'); const swiperEl = document.querySelector('.details-slider .swiper'); realItems.forEach(realItem => { const input = realItem.querySelector('input[type="radio"]'); const label = realItem.querySelector('label'); const colorSpan = realItem.querySelector('span'); const originalName = realItem.getAttribute('data-original-name') || ''; let bgColor = realItem.style.getPropertyValue('--hover-color'); if (!bgColor && colorSpan) bgColor = colorSpan.style.backgroundColor; if (!bgColor) bgColor = '#ccc'; const proxyItem = document.createElement('div'); proxyItem.className = 'st-proxy-color-item'; proxyItem.style.backgroundColor = bgColor; proxyItem.title = originalName; proxyItem.addEventListener('click', () => { if (label) label.click(); }); input.addEventListener('change', () => { document.querySelectorAll('.st-proxy-color-item').forEach(p => p.classList.remove('active')); if (input.checked) { proxyItem.classList.add('active'); let targetIndex = null; mainSlides.forEach(slide => { if (slide.getAttribute("data-caption")?.trim() === originalName.trim() && targetIndex === null) { targetIndex = slide.getAttribute("data-slid-index"); } }); if (swiperEl && swiperEl.swiper && targetIndex !== null) { swiperEl.swiper.slideTo(parseInt(targetIndex), 400); } const mediaContainerTop = document.querySelector('.product-single__slider'); if (mediaContainerTop) { const y = mediaContainerTop.getBoundingClientRect().top + window.pageYOffset - 80; window.scrollTo({ top: y, behavior: 'smooth' }); } } }); if (input.checked) proxyItem.classList.add('active'); proxyWrapper.appendChild(proxyItem); }); clearInterval(proxyInterval); } }, 500); }); // 🌟 تفعيل النقر على عنوان "القائمة الرئيسية" 🌟 document.addEventListener('click', function(e) { const navMenu = document.getElementById('mobile-menu'); if (!navMenu) return; if (e.target === navMenu || e.target.classList.contains('mm-spn--open')) { const title = navMenu.getAttribute('data-mm-spn-title'); if (title && title.includes('القائمة الرئيسية')) { const rect = e.target.getBoundingClientRect(); const clickY = e.clientY - rect.top; if (clickY > 0 && clickY <= 60) { window.location.href = '/'; } } } }); // 🌟 مراقب تحميل الصور الذكي 🌟 document.addEventListener('load', function(e) { if (e.target.tagName === 'IMG' && e.target.closest('.product-card')) { e.target.closest('.product-card').classList.add('st-img-loaded'); } }, true); setTimeout(() => { document.querySelectorAll('.product-card__image img').forEach(img => { if (img.complete) { let card = img.closest('.product-card'); if(card) card.classList.add('st-img-loaded'); } }); }, 500); // /* ========================================================================== // Store Ultimate Engine - Offer Modal Hijacker 🎁⚡ (Bulletproof V4 - Sorted) // [ اعتراض نافذة العرض + شبكة مقاسات + توجيه ذكي للسعر الأعلى ] // ========================================================================== */ // document.addEventListener("DOMContentLoaded", function () { // // 1. حقن التنسيقات المتجاوبة مع الإخفاء الإجباري لعناصر سلة القديمة // if (!document.getElementById('st-offer-hijack-css')) { // const offerStyle = document.createElement('style'); // offerStyle.id = 'st-offer-hijack-css'; // offerStyle.innerHTML = ` // /* 🛑 إخفاء إجباري للسلايدر والمحتوى القديم الخاص بسلة 🛑 */ // .s-modal-body.st-offer-hijacked .s-modal-header-inner, // .s-modal-body.st-offer-hijacked .s-offer-modal-slider, // .s-modal-body.st-offer-hijacked salla-slider, // .s-modal-body.st-offer-hijacked .s-offer-modal-footer { // display: none !important; // opacity: 0 !important; // visibility: hidden !important; // height: 0 !important; // } // .st-custom-offer-wrapper { // text-align: center; // padding: 30px 10px 10px 10px; // width: 100%; // font-family: var(--font-readex, 'Tajawal', sans-serif); // animation: fadeInModal 0.3s ease; // } // .st-custom-offer-wrapper .st-offer-icon { // font-size: 50px; // margin-bottom: 15px; // animation: bounceOffer 2s infinite; // text-shadow: 0 10px 20px rgba(0,0,0,0.1); // } // .st-custom-offer-wrapper h3 { // font-size: 24px; // font-weight: 900; // color: #e63946; // margin-bottom: 10px; // letter-spacing: -0.5px; // line-height: 1.4; // } // .st-custom-offer-wrapper p { // font-size: 15px; // color: #555; // margin-bottom: 25px; // font-weight: 700; // line-height: 1.5; // } // /* هندسة الشبكة (الكمبيوتر) */ // .st-offer-grid { // display: grid; // grid-template-columns: repeat(5, 1fr); // gap: 12px; // width: 100%; // max-width: 420px; // margin: 0 auto; // direction: ltr; // } // .st-offer-size-btn { // display: flex; // align-items: center; // justify-content: center; // height: 54px; // background: #ffffff; // border: 2px solid #eaeaea; // border-radius: 12px; // font-size: 20px; // font-weight: 900; // color: #111; // text-decoration: none !important; // transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); // box-shadow: 0 4px 10px rgba(0,0,0,0.03); // } // .st-offer-size-btn:hover { // background: #0b7579; // color: #fff; // border-color: #0b7579; // transform: translateY(-4px); // box-shadow: 0 8px 15px rgba(11, 117, 121, 0.25); // } // @keyframes bounceOffer { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } } // @keyframes fadeInModal { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } } // /* 📱 هندسة الشبكة (الجوال) */ // @media (max-width: 768px) { // .st-custom-offer-wrapper { padding: 15px 0 5px 0; } // .st-custom-offer-wrapper .st-offer-icon { font-size: 40px; margin-bottom: 10px; } // .st-custom-offer-wrapper h3 { font-size: 20px; margin-bottom: 8px; } // .st-custom-offer-wrapper p { font-size: 13px; margin-bottom: 20px; } // .st-offer-grid { gap: 8px; max-width: 100%; } // .st-offer-size-btn { height: 44px; font-size: 16px; border-radius: 10px; } // } // `; // document.head.appendChild(offerStyle); // } // // 2. 🎯 قاموس الروابط المخصصة مدموجاً مع فلتر الترتيب (الأعلى سعراً أولاً) 🎯 // const sizeLinks = { // 36: "https://almoqtas.com/36/tag-1231204816?sort=priceFromTopToLow", // 37: "https://almoqtas.com/37/tag-1124252415?sort=priceFromTopToLow", // 38: "https://almoqtas.com/38/tag-458215633?sort=priceFromTopToLow", // 39: "https://almoqtas.com/39/tag-1857353977?sort=priceFromTopToLow", // 40: "https://almoqtas.com/40/tag-176039675?sort=priceFromTopToLow", // 41: "https://almoqtas.com/41/tag-1302868599?sort=priceFromTopToLow", // 42: "https://almoqtas.com/42/tag-396572139?sort=priceFromTopToLow", // 43: "https://almoqtas.com/43/tag-861238261?sort=priceFromTopToLow", // 44: "https://almoqtas.com/44/tag-1904410198?sort=priceFromTopToLow", // 45: "https://almoqtas.com/45/tag-164722712?sort=priceFromTopToLow" // }; // // 3. بناء شبكة الأزرار برمجياً // let gridHTML = '
'; // for (let i = 36; i <= 45; i++) { // gridHTML += `${i}`; // } // gridHTML += '
'; // // 4. المحتوى الجذاب الجديد // const newOfferContent = ` //
//
🎁
//

استفد من عرض شوز والثاني مجاناً!

//

تصفح الموديلات المشمولة في العرض حسب مقاسك مباشرة 👇

// ${gridHTML} //
// `; // // 5. محرك الصيد المستمر (يحمي التصميم من محاولات سلة لمسحه) // setInterval(() => { // document.querySelectorAll('.s-modal-body').forEach(modal => { // // الكشف عن نافذة العرض المجاني عن طريق السلايدر أو الفوتر // const isOfferModal = modal.querySelector('.s-offer-modal-slider, .s-offer-modal-footer'); // if (isOfferModal) { // // ختم النافذة عشان نعطل عناصر سلة بالـ CSS // modal.classList.add('st-offer-hijacked'); // // إذا مسحت سلة الكود حقنا، نرجعه غصب في آخر النافذة // if (!modal.querySelector('.st-custom-offer-wrapper')) { // modal.insertAdjacentHTML('beforeend', newOfferContent); // } // } // }); // }, 150); // }); /* ========================================================================== Store Ultimate Engine - Smart BOGO Modal 🎁⏳ (V2 - Dynamic Timer & Centered) [ اعتراض نافذة ما بعد الإضافة للسلة + عداد ديناميكي واقعي + توسيط إجباري ] ========================================================================== */ (function() { // 1. حقن التنسيقات المتجاوبة للتوسيط الإجباري if (!document.getElementById('st-bogo-modal-css')) { const style = document.createElement('style'); style.id = 'st-bogo-modal-css'; style.innerHTML = ` /* إخفاء عناصر سلة الافتراضية */ .s-modal-body.st-bogo-hijacked .s-modal-header-content, .s-modal-body.st-bogo-hijacked .s-offer-modal-header-icon, .s-modal-body.st-bogo-hijacked .s-offer-modal-slider, .s-modal-body.st-bogo-hijacked salla-slider, .s-modal-body.st-bogo-hijacked .s-offer-modal-footer { display: none !important; opacity: 0 !important; visibility: hidden !important; height: 0 !important; } /* توسيط إجباري (Flexbox) للنافذة الجديدة */ .st-bogo-wrapper { box-sizing: border-box !important; display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; text-align: center !important; padding: 15px 10px 30px 10px !important; width: 100% !important; margin: 0 auto !important; font-family: var(--font-readex, 'Tajawal', sans-serif); animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; } .st-bogo-icon { font-size: 65px; margin-bottom: 10px; animation: tada 1.5s infinite; } .st-bogo-title { font-size: 26px; font-weight: 900; color: #27ae60; margin-bottom: 10px; line-height: 1.3; text-align: center !important; width: 100%; } .st-bogo-desc { font-size: 16px; color: #444; font-weight: 700; line-height: 1.6; margin-bottom: 20px; background: #f8f9fa; padding: 15px; border-radius: 12px; border: 1px dashed #ccc; width: 95%; text-align: center !important; } .st-bogo-desc span { color: #e63946; font-weight: 900; } /* العداد التنازلي المنسق */ .st-bogo-timer-wrap { background: rgba(230, 57, 70, 0.08); border: 1px solid #e63946; border-radius: 50px; padding: 10px 20px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 25px; direction: rtl; } .st-bogo-timer-text { font-size: 15px; font-weight: bold; color: #e63946; } .st-bogo-timer-countdown { font-size: 20px; font-weight: 900; color: #e63946; animation: pulseRed 1s infinite; } /* زر المتابعة */ .st-bogo-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 95%; background: #111; color: #fff; height: 56px; border-radius: 14px; font-size: 18px; font-weight: bold; border: none; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 8px 20px rgba(0,0,0,0.15); margin: 0 auto; } .st-bogo-btn:hover { background: #e63946; transform: translateY(-3px); box-shadow: 0 10px 25px rgba(230, 57, 70, 0.3); } /* Animations */ @keyframes tada { 0% {transform: scale(1);} 10%, 20% {transform: scale(0.9) rotate(-3deg);} 30%, 50%, 70%, 90% {transform: scale(1.1) rotate(3deg);} 40%, 60%, 80% {transform: scale(1.1) rotate(-3deg);} 100% {transform: scale(1) rotate(0);} } @keyframes popIn { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } } @keyframes pulseRed { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } @media (max-width: 768px) { .st-bogo-icon { font-size: 50px; } .st-bogo-title { font-size: 22px; } .st-bogo-desc { font-size: 14px; padding: 12px; width: 100%; } .st-bogo-timer-countdown { font-size: 17px; } .st-bogo-timer-text { font-size: 13px; } .st-bogo-btn { height: 50px; font-size: 16px; width: 100%; } } `; document.head.appendChild(style); } // 2. المحتوى الجذاب الجديد (المشفر ضد اختفاء الأكواد في المحادثة) const bogoContentHTML = ` \x3Cdiv class="st-bogo-wrapper"\x3E \x3Cdiv class="st-bogo-icon"\x3E🎁\x3C/div\x3E \x3Ch3 class="st-bogo-title"\x3Eمبروك! حذاءك الثاني مجاناً\x3C/h3\x3E \x3Cp class="st-bogo-desc"\x3E تم تفعيل العرض في سلتك! أضف أي شوز ثاني الآن وسيكون سعره \x3Cspan\x3E0 ريال\x3C/span\x3E.\x3Cbr\x3E\x3Cbr\x3E 💡 كل ما تضيف أكثر، تاخذ مجاني أكثر (ضيف 2 تاخذ 2، ضيف 3 تاخذ 3!) \x3C/p\x3E \x3Cdiv class="st-bogo-timer-wrap"\x3E \x3Cspan class="st-bogo-timer-text"\x3E⏳ ينتهي العرض خلال:\x3C/span\x3E \x3Cspan class="st-bogo-timer-countdown"\x3E\x3C/span\x3E \x3C/div\x3E \x3Cbutton class="st-bogo-btn" id="st-continue-shopping-btn"\x3E 🛍️ متابعة التسوق لاختيار المجاني \x3C/button\x3E \x3C/div\x3E `; // 3. دالة العداد الذكي والواقعي function startBogoTimer(displayElement) { function updateTimer() { const now = new Date(); // تحديد وقت انتهاء العرض: غداً في الساعة 11:59:59 مساءً // الدالة تحسب تلقائياً الوقت المتبقي بناءً على ساعة العميل الآن const endOfTomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 2); let diffSeconds = Math.floor((endOfTomorrow - now) / 1000); if (diffSeconds < 0) diffSeconds = 0; let days = Math.floor(diffSeconds / 86400); let hours = Math.floor((diffSeconds % 86400) / 3600); let minutes = Math.floor((diffSeconds % 3600) / 60); let seconds = diffSeconds % 60; let hoursStr = hours < 10 ? "0" + hours : hours; let minutesStr = minutes < 10 ? "0" + minutes : minutes; let secondsStr = seconds < 10 ? "0" + seconds : seconds; // ترتيب الأرقام والنصوص بشكل سليم للغة العربية let timePart = "\x3Cspan style='display:inline-block; direction:ltr;'\x3E" + hoursStr + ":" + minutesStr + ":" + secondsStr + "\x3C/span\x3E"; let fullHtml = days > 0 ? (days + " يوم و " + timePart) : timePart; if (displayElement) { displayElement.innerHTML = fullHtml; } } updateTimer(); // تحديث فوري setInterval(updateTimer, 1000); // تحديث كل ثانية } // 4. محرك المراقبة لاصطياد نافذة العرض setInterval(() => { document.querySelectorAll('.s-modal-body').forEach(modal => { if (!modal.classList.contains('st-bogo-hijacked')) { const titleEl = modal.querySelector('.s-modal-title'); if (titleEl && titleEl.textContent.includes('مجانا')) { const headerInner = modal.querySelector('.s-modal-header-inner'); if (headerInner) { modal.classList.add('st-bogo-hijacked'); if (!modal.querySelector('.st-bogo-wrapper')) { headerInner.insertAdjacentHTML('beforeend', bogoContentHTML); const timerDisplay = modal.querySelector('.st-bogo-timer-countdown'); if (timerDisplay) startBogoTimer(timerDisplay); const continueBtn = modal.querySelector('#st-continue-shopping-btn'); if (continueBtn) { continueBtn.addEventListener('click', function(e) { e.preventDefault(); const closeNativeBtn = modal.closest('.s-modal-entering, .s-modal-container')?.querySelector('.s-modal-close'); if (closeNativeBtn) { closeNativeBtn.click(); } else { const modalOverlay = modal.closest('salla-modal'); if (modalOverlay) modalOverlay.close(); } }); } } } } } }); }, 200); })(); /* ========================================================================== Store Ultimate Engine - Free Shipping Popup 🚚🎁 [ بوب أب كوبون الشحن المجاني الذكي - يظهر مرة يومياً بعد 15 ثانية ] ========================================================================== */ (function() { // 1. فحص هل ظهرت النافذة للعميل خلال الـ 24 ساعة الماضية؟ const lastShown = localStorage.getItem('st_freeshipping_shown_time'); if (lastShown) { const now = new Date().getTime(); const timeDiff = now - parseInt(lastShown); if (timeDiff < 86400000) { // 86400000 مللي ثانية = 24 ساعة return; // إيقاف التنفيذ بصمت لأن العميل شافها اليوم } } // 2. تأخير الظهور 15 ثانية لإعطاء العميل فرصة للتصفح setTimeout(() => { // 3. حقن التنسيقات الفخمة والمتجاوبة if (!document.getElementById('st-fs-modal-css')) { const style = document.createElement('style'); style.id = 'st-fs-modal-css'; style.innerHTML = ` .st-fs-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 999999999; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s ease; direction: rtl; } .st-fs-overlay.st-active { opacity: 1; visibility: visible; } .st-fs-box { background: #fff; border-radius: 24px; padding: 35px 25px 25px; width: 90%; max-width: 380px; text-align: center; position: relative; transform: scale(0.8) translateY(20px); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); font-family: var(--font-readex, 'Tajawal', sans-serif); box-shadow: 0 20px 40px rgba(0,0,0,0.2); border: 2px solid #0b7579; } .st-fs-overlay.st-active .st-fs-box { transform: scale(1) translateY(0); } .st-fs-close-btn { position: absolute; top: 15px; left: 15px; background: #f5f5f5; border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 22px; color: #777; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; line-height: 1; } .st-fs-close-btn:hover { background: #ffebeb; color: #e63946; } .st-fs-icon { font-size: 60px; margin-bottom: 10px; animation: floatIcon 2s ease-in-out infinite; } .st-fs-title { font-size: 24px; font-weight: 900; color: #0b7579; margin-bottom: 10px; line-height: 1.3; } .st-fs-desc { font-size: 15px; color: #555; margin-bottom: 20px; font-weight: 600; line-height: 1.5; } .st-fs-coupon-wrap { background: #f0fdfa; border: 2px dashed #0b7579; padding: 15px; border-radius: 12px; margin-bottom: 20px; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; } .st-fs-coupon-code { font-size: 32px; font-weight: 900; color: #0b7579; letter-spacing: 3px; font-family: monospace; } .st-fs-copy-btn { width: 100%; background: #0b7579; color: #fff; border: none; height: 54px; border-radius: 14px; font-size: 18px; font-weight: bold; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 15px rgba(11, 117, 121, 0.2); } .st-fs-copy-btn:hover { background: #085a5d; transform: translateY(-3px); } .st-fs-copy-btn.st-copied { background: #27ae60; pointer-events: none; transform: translateY(0); box-shadow: none; } @keyframes floatIcon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } } @media (max-width: 768px) { .st-fs-icon { font-size: 50px; } .st-fs-title { font-size: 22px; } .st-fs-desc { font-size: 14px; } .st-fs-coupon-code { font-size: 28px; } .st-fs-copy-btn { font-size: 16px; height: 50px; } } `; document.head.appendChild(style); } // 4. حقن الـ HTML مع التشفير const fsModalHTML = ` \x3Cdiv id="st-free-shipping-modal" class="st-fs-overlay"\x3E \x3Cdiv class="st-fs-box"\x3E \x3Cbutton id="st-fs-close" class="st-fs-close-btn"\x3E×\x3C/button\x3E \x3Cdiv class="st-fs-icon"\x3E🚚🎁\x3C/div\x3E \x3Ch3 class="st-fs-title"\x3Eكوبون لطلبك الاول!\x3C/h3\x3E \x3Cp class="st-fs-desc"\x3Eحصلت على كوبون توصيل مجاني، استخدمه قبل انتهاء الـ 24 ساعة القادمة!\x3C/p\x3E \x3Cdiv class="st-fs-coupon-wrap"\x3E \x3Cdiv class="st-fs-coupon-code"\x3EM96\x3C/div\x3E \x3C/div\x3E \x3Cbutton id="st-fs-copy-btn" class="st-fs-copy-btn"\x3E نسخ الكود \x3C/button\x3E \x3C/div\x3E \x3C/div\x3E `; document.body.insertAdjacentHTML('beforeend', fsModalHTML); const modal = document.getElementById('st-free-shipping-modal'); const closeBtn = document.getElementById('st-fs-close'); const copyBtn = document.getElementById('st-fs-copy-btn'); // إظهار النافذة بنعومة setTimeout(() => modal.classList.add('st-active'), 100); // دالة الإغلاق مع حفظ الوقت في ذاكرة المتصفح function closeModalAndSave() { modal.classList.remove('st-active'); localStorage.setItem('st_freeshipping_shown_time', new Date().getTime().toString()); setTimeout(() => modal.remove(), 400); // حذف من الصفحة بعد الأنيميشن } // إغلاق عبر زر X أو النقر خارج النافذة closeBtn.addEventListener('click', closeModalAndSave); modal.addEventListener('click', (e) => { if (e.target === modal) closeModalAndSave(); }); // دالة النسخ الذكية copyBtn.addEventListener('click', () => { const code = "M96"; // وظيفة النسخ الحديثة navigator.clipboard.writeText(code).then(() => { // تغيير شكل الزر لإعطاء شعور بالنجاح copyBtn.innerHTML = "✅ تم النسخ بنجاح!"; copyBtn.classList.add('st-copied'); // إغلاق النافذة أوتوماتيكياً بعد ثانية ونصف setTimeout(closeModalAndSave, 1500); }).catch(err => { // خطة بديلة لو المتصفح قديم const tempInput = document.createElement("input"); tempInput.value = code; document.body.appendChild(tempInput); tempInput.select(); document.execCommand("copy"); document.body.removeChild(tempInput); copyBtn.innerHTML = "✅ تم النسخ بنجاح!"; copyBtn.classList.add('st-copied'); setTimeout(closeModalAndSave, 1500); }); }); }, 15000); // 15000 مللي ثانية = 15 ثانية بالضبط })(); /* ========================================================================== Store Ultimate Engine - Modal Close Buttons Fix 🛡️ [ إصلاح تداخل الأنيميشن مع أزرار الإغلاق ومنع سرقة النقرات ] ========================================================================== */ (function() { if (!document.getElementById('st-close-btn-fix')) { const fixStyle = document.createElement('style'); fixStyle.id = 'st-close-btn-fix'; fixStyle.innerHTML = ` /* رفع طبقة جميع أزرار الإغلاق لتكون فوق أي أنيميشن بشكل مطلق */ .st-fs-close-btn, .st-modal-close-btn, .s-modal-close, button.s-modal-close { z-index: 999999 !important; pointer-events: auto !important; } /* منع الأيقونات والنصوص المتحركة من سرقة نقرة الماوس */ .st-fs-icon, .st-bogo-icon, .st-ob-truck, .st-bogo-timer-countdown { pointer-events: none !important; } `; document.head.appendChild(fixStyle); } })(); /* === الشريط المتحرك العلوي (Ticker) — سيليا | متصل من أقصى اليمين لأقصى الشمال === */ (function() { var items = [ '🔥 عرض شوز والثاني مجاناً', 'تشكيلات حديثة وجذابة', '🔥مقاسات شاملة ', 'تسوق الآن واستفد من العرض ', ' لا تفوت الفرصة! ', ]; function buildTicker() { if (document.getElementById('st-ticker')) return; var group = items.map(function(t) { return '' + t + '✦'; }).join(''); var html = '
' + '
' + '
' + group + '
' + '' + '
'; var target = document.querySelector('header') || document.querySelector('.s-site-header') || document.querySelector('.main-nav-container'); if (target) target.insertAdjacentHTML('beforebegin', html); else document.body.insertAdjacentHTML('afterbegin', html); fixTickerWidth(); } // 🔧 إصلاح الاتصال: كل مجموعة = عرض الشريط بالضبط (بكسل) — بدون اقتطاع function fixTickerWidth() { var ticker = document.getElementById('st-ticker'); if (!ticker) return; var w = ticker.offsetWidth; if (!w) return; var groups = ticker.querySelectorAll('.st-ticker-group'); for (var i = 0; i < groups.length; i++) { groups[i].style.minWidth = w + 'px'; } } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { buildTicker(); setTimeout(fixTickerWidth, 300); window.addEventListener('resize', fixTickerWidth); }); } else { buildTicker(); setTimeout(fixTickerWidth, 300); window.addEventListener('resize', fixTickerWidth); } })();