/* ========================================================================== ألوان العالم | Alwan Al-alem — تخصيص متقدم (JavaScript) متجر قطع غيار Range Rover و Jaguar — ثيم رائد (Raed) — منصة سلة ========================================================================== */ const rangeRoverLogo = "https://cdn.phototourl.com/free/2026-07-26-51c0bb58-3a11-45f4-9962-67a9b8a5a475.png"; const jaguarLogo = "https://cdn.phototourl.com/free/2026-07-26-29449aad-fa1f-4d17-9ddf-70b0ecf27df5.png"; document.addEventListener('DOMContentLoaded', function () { /* ------------------------------------------------------------------ 0) دالة مساعدة جديدة: التأكد أننا في الصفحة الرئيسية فقط نعتمد أولاً على واجهة سلة الرسمية salla.config.get('page.type') وهذه أدق طريقة لأنها لا تتأثر بالدومين المخصص أو المسارات الفرعية. في حال لم تكن salla.config متاحة بعد، نستخدم فحص المسار كخطة بديلة. ------------------------------------------------------------------ */ function isHomePage() { try { if (window.salla && salla.config && typeof salla.config.get === 'function') { var pageType = salla.config.get('page.type'); if (pageType) { return pageType === 'index' || pageType === 'home'; } } } catch (e) { // نتجاهل الخطأ وننتقل للخطة البديلة } // خطة بديلة: التأكد أن المسار هو الجذر فقط (الصفحة الرئيسية) var path = window.location.pathname.replace(/\/+$/, ''); return path === '' || path === '/'; } function findFirst(selectors) { for (var i = 0; i < selectors.length; i++) { var el = document.querySelector(selectors[i]); if (el) return el; } return null; } function injectChooseCarSection() { var RANGE_ROVER_URL = '/رنج-روفر-range-rover/c1363028479'; var JAGUAR_URL = '/جاكوار-jaguar/c215268110'; var section = document.createElement('section'); section.id = 'aa-choose-car'; section.className = 'aa-fade-in'; section.innerHTML = '
أرسل رقم الهيكل VIN وسنساعدك في اختيار القطعة المناسبة.
' + '' + 'تواصل عبر واتساب'; var latestProducts = document.querySelector('#aa-latest-products, .s-block-latest-products, .latest-products'); if (latestProducts && latestProducts.parentNode) { latestProducts.parentNode.insertBefore(banner, latestProducts); } else { var footer = document.querySelector('.s-footer, salla-footer, footer'); if (footer && footer.parentNode) { footer.parentNode.insertBefore(banner, footer); } else { document.body.appendChild(banner); } } } function initScrollReveal() { var targets = document.querySelectorAll( '.aa-fade-in, #aa-features .aa-feature-card, .s-product-card, salla-product-card' ); targets.forEach(function (el) { if (!el.classList.contains('aa-fade-in')) { el.classList.add('aa-fade-in'); } }); if (!('IntersectionObserver' in window)) { targets.forEach(function (el) { el.classList.add('aa-visible'); }); return; } var observer = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { entry.target.classList.add('aa-visible'); observer.unobserve(entry.target); } }); }, { threshold: 0.15 }); targets.forEach(function (el) { observer.observe(el); }); } function injectFeaturesSection() { var features = [ { icon: '✓', title: 'قطع أصلية وبديلة' }, { icon: '🚚', title: 'شحن سريع' }, { icon: '🛡️', title: 'ضمان جودة عالية ' }, { icon: '💬', title: 'دعم سريع عبر الواتساب اثناء اوقات الدوام الرسمي' }, { icon: '🏬', title: 'إمكانية الاستلام من الفروع خلال يوم عمل واحد من تاريخ الطلب' } ]; var section = document.createElement('section'); section.id = 'aa-features'; section.className = 'aa-fade-in'; var grid = document.createElement('div'); grid.className = 'aa-features-grid'; features.forEach(function (f) { var card = document.createElement('div'); card.className = 'aa-feature-card'; card.innerHTML = '' + '