/* 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 = ` // //
// // `; 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 = `تصفح الموديلات المشمولة في العرض حسب مقاسك مباشرة 👇
// ${gridHTML} //