(() => { const mountAgeFinder = () => { if (window.location.pathname !== '/' || document.getElementById('hm-age-finder')) return; const hero = document.querySelector('main .s-block--hero-slider'); if (!hero) return; const template = document.createElement('template'); template.innerHTML = "
\n \n
\n

دليل الاختيار السريع

\n

تسوّق حسب عمر طفلك

\n

اختيارات آمنة وممتعة لكل مرحلة

\n
\n
\n \n \n \n \n \n
\n \n \n
"; const root = template.content.firstElementChild; if (!root) return; hero.insertAdjacentElement('afterend', root); (() => { const root = document.getElementById('hm-age-finder'); if (!root || root.dataset.ready === 'true') return; root.dataset.ready = 'true'; const routes = {"0-6m|sleep-rest":{"url":"https://hallmark2030.com/0-6-أشهر-النوم-والراحة/c1796102734","count":6},"0-6m|mobility":{"url":"https://hallmark2030.com/0-6-أشهر-الحركة-والتنقل/c846972490","count":2},"0-6m|learn-play":{"url":"https://hallmark2030.com/0-6-أشهر-التعلم-واللعب/c380737608","count":2},"0-6m|feeding-care":{"url":"https://hallmark2030.com/0-6-أشهر-الطعام-والعناية/c205579595","count":1},"6-12m|sleep-rest":{"url":"https://hallmark2030.com/6-12-شهر-النوم-والراحة/c1580008532","count":6},"6-12m|mobility":{"url":"https://hallmark2030.com/6-12-شهر-الحركة-والتنقل/c671753045","count":7},"6-12m|learn-play":{"url":"https://hallmark2030.com/6-12-شهر-التعلم-واللعب/c563773520","count":4},"6-12m|feeding-care":{"url":"https://hallmark2030.com/6-12-شهر-الطعام-والعناية/c1936174929","count":5},"1-2y|sleep-rest":{"url":"https://hallmark2030.com/1-2-سنة-النوم-والراحة/c1296879186","count":1},"1-2y|mobility":{"url":"https://hallmark2030.com/1-2-سنة-الحركة-والتنقل/c986917725","count":8},"1-2y|learn-play":{"url":"https://hallmark2030.com/1-2-سنة-التعلم-واللعب/c1544926810","count":3},"1-2y|feeding-care":{"url":"https://hallmark2030.com/1-2-سنة-الطعام-والعناية/c703780187","count":4},"3-5y|mobility":{"url":"https://hallmark2030.com/3-5-سنوات-الحركة-والتنقل/c1436816037","count":2},"3-5y|learn-play":{"url":"https://hallmark2030.com/3-5-سنوات-التعلم-واللعب/c662778278","count":1},"3-5y|feeding-care":{"url":"https://hallmark2030.com/3-5-سنوات-الطعام-والعناية/c1903055015","count":2}}; const ageButtons = [...root.querySelectorAll('[data-age]')]; const needButtons = [...root.querySelectorAll('[data-need]')]; const stepTwo = root.querySelector('.hm-age-finder__step-two'); const changeButton = root.querySelector('.hm-age-finder__change'); const action = root.querySelector('.hm-age-finder__action'); const status = root.querySelector('.hm-age-finder__status'); let selectedAge = null; let selectedNeed = null; const announce = message => { status.textContent = message; }; const event = (name, detail) => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({event: name, ...detail}); }; const selectedAgeLabel = () => ageButtons.find(button => button.dataset.age === selectedAge)?.querySelector('strong')?.textContent || ''; const routeFor = needKey => routes[selectedAge + '|' + needKey] || null; const updateNeeds = () => { needButtons.forEach(button => { const available = Boolean(routeFor(button.dataset.need)); button.disabled = !available; button.setAttribute('aria-pressed', String(button.dataset.need === selectedNeed)); button.querySelector('.hm-age-finder__availability').textContent = available ? '' : 'قريباً'; }); const destination = selectedNeed ? routeFor(selectedNeed) : null; action.disabled = !destination; }; ageButtons.forEach(button => button.addEventListener('click', () => { selectedAge = button.dataset.age; selectedNeed = null; ageButtons.forEach(item => item.setAttribute('aria-pressed', String(item === button))); stepTwo.hidden = false; updateNeeds(); announce('تم اختيار عمر ' + selectedAgeLabel() + '. اختر احتياج طفلك.'); event('age_finder_age_selected', {age_key: selectedAge}); stepTwo.scrollIntoView({behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth', block: 'nearest'}); })); needButtons.forEach(button => button.addEventListener('click', () => { if (button.disabled) return; selectedNeed = button.dataset.need; updateNeeds(); announce('تم اختيار ' + button.querySelector('.hm-age-finder__need-label').textContent + '. يمكنك الآن عرض المنتجات المناسبة.'); event('age_finder_need_selected', {age_key: selectedAge, need_key: selectedNeed}); })); changeButton.addEventListener('click', () => { selectedAge = null; selectedNeed = null; ageButtons.forEach(button => button.setAttribute('aria-pressed', 'false')); stepTwo.hidden = true; announce('اختر عمر طفلك.'); ageButtons[0]?.focus(); }); action.addEventListener('click', () => { const destination = selectedNeed ? routeFor(selectedNeed) : null; if (!destination) { announce('هذه المجموعة غير متاحة حالياً'); return; } event('age_finder_results_clicked', {age_key: selectedAge, need_key: selectedNeed, product_count: destination.count}); window.location.assign(destination.url); }); })(); }; if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mountAgeFinder, {once: true}); } else { mountAgeFinder(); } })(); ;(() => { const id = 'hm-premium-home-style'; const mount = () => { if (window.location.pathname !== '/') return; if (!document.getElementById(id)) { const style = document.createElement('style'); style.id = id; style.textContent = ":root {\n --hm-blue: #12366f;\n --hm-blue-strong: #0b2857;\n --hm-yellow: #f6c945;\n --hm-yellow-soft: #fff4bf;\n --hm-canvas: #f7f4ec;\n --hm-surface: #ffffff;\n --hm-text: #17253d;\n --hm-muted: #647084;\n --hm-border: rgba(18, 54, 111, 0.12);\n --hm-radius-control: 14px;\n --hm-radius-card: 24px;\n --hm-shadow-card: 0 16px 48px rgba(18, 54, 111, 0.08);\n --hm-shadow-hover: 0 22px 56px rgba(18, 54, 111, 0.14);\n}\n\nbody.index.theme-raed.hm-home-enhanced {\n background: var(--hm-canvas);\n color: var(--hm-text);\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n}\n\nbody.index.theme-raed.hm-home-enhanced .top-navbar {\n min-height: 36px;\n max-height: 40px;\n overflow: hidden;\n color: var(--hm-muted);\n background: #f4f6f9;\n border-bottom: 1px solid rgba(18, 54, 111, 0.06);\n}\n\nbody.index.theme-raed.hm-home-enhanced .store-header {\n background: rgba(255, 255, 255, 0.96);\n border-bottom: 1px solid var(--hm-border);\n box-shadow: 0 8px 30px rgba(18, 54, 111, 0.05);\n backdrop-filter: blur(14px);\n}\n\nbody.index.theme-raed.hm-home-enhanced .store-header input[type=\"search\"],\nbody.index.theme-raed.hm-home-enhanced .store-header input[placeholder*=\"البحث\"],\nbody.index.theme-raed.hm-home-enhanced .store-header .s-search-input {\n min-height: 44px;\n color: var(--hm-text);\n background: #f7f9fc;\n border: 1px solid transparent;\n border-radius: var(--hm-radius-control);\n transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced .store-header input[type=\"search\"]:focus-visible,\nbody.index.theme-raed.hm-home-enhanced .store-header input[placeholder*=\"البحث\"]:focus-visible,\nbody.index.theme-raed.hm-home-enhanced .store-header .s-search-input:focus-visible {\n outline: 3px solid rgba(246, 201, 69, 0.55);\n outline-offset: 2px;\n background: var(--hm-surface);\n border-color: var(--hm-blue);\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider {\n position: relative;\n height: clamp(440px, 40vw, 540px);\n overflow: hidden;\n isolation: isolate;\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider salla-slider,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider salla-slider > div,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider .swiper-slide,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider .home-slider__content {\n height: 100%;\n min-height: 100%;\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider::after {\n position: absolute;\n inset: 0;\n z-index: 0;\n content: \"\";\n pointer-events: none;\n background: linear-gradient(90deg, rgba(4, 28, 70, 0.08), rgba(4, 28, 70, 0.5));\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider h2,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider p,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider .hm-hero-actions {\n position: relative;\n z-index: 2;\n width: min(620px, 100%);\n text-shadow: 0 2px 18px rgba(3, 24, 61, 0.42);\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider h2 {\n margin-bottom: 14px;\n color: #fff;\n font-size: clamp(34px, 4vw, 58px);\n font-weight: 850;\n line-height: 1.18;\n letter-spacing: -0.025em;\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider p {\n color: rgba(255, 255, 255, 0.94);\n font-size: clamp(16px, 1.6vw, 20px);\n line-height: 1.75;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-hero-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 12px;\n margin-top: 26px;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 48px;\n padding: 0 24px;\n border: 1px solid transparent;\n border-radius: var(--hm-radius-control);\n font-size: 15px;\n font-weight: 800;\n line-height: 1;\n text-decoration: none;\n text-shadow: none;\n transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button--primary {\n color: var(--hm-blue-strong);\n background: var(--hm-yellow);\n box-shadow: 0 12px 28px rgba(246, 201, 69, 0.28);\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button--secondary {\n color: #fff;\n background: rgba(255, 255, 255, 0.13);\n border-color: rgba(255, 255, 255, 0.68);\n backdrop-filter: blur(8px);\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button:hover {\n transform: translateY(-2px);\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button--primary:hover {\n background: #ffda5d;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button--secondary:hover {\n color: var(--hm-blue-strong);\n background: #fff;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-button:focus-visible,\nbody.index.theme-raed.hm-home-enhanced .s-block__display-all:focus-visible,\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card a:focus-visible,\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card button:focus-visible {\n outline: 3px solid var(--hm-yellow);\n outline-offset: 3px;\n}\n\nbody.index.theme-raed.hm-home-enhanced #hm-age-finder,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--banners,\nbody.index.theme-raed.hm-home-enhanced main > .s-block.container,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--features,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--bundle-faq-with-images,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--testimonials {\n margin-top: clamp(48px, 7vw, 88px);\n margin-bottom: clamp(48px, 7vw, 88px);\n}\n\nbody.index.theme-raed.hm-home-enhanced #hm-age-finder {\n background: #f3f7fc;\n border-color: rgba(18, 54, 111, 0.1);\n box-shadow: 0 20px 60px rgba(18, 54, 111, 0.06);\n}\n\nbody.index.theme-raed.hm-home-enhanced #hm-age-finder button {\n min-height: 44px;\n}\n\nbody.index.theme-raed.hm-home-enhanced #hm-age-finder button:focus-visible {\n outline: 3px solid rgba(246, 201, 69, 0.72);\n outline-offset: 3px;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-section-hidden {\n display: none !important;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-trust-strip {\n display: grid;\n width: min(1180px, calc(100% - 32px));\n margin: -28px auto clamp(52px, 7vw, 88px);\n overflow: hidden;\n background: var(--hm-surface);\n border: 1px solid var(--hm-border);\n border-radius: var(--hm-radius-card);\n box-shadow: var(--hm-shadow-card);\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-trust-item {\n display: grid;\n grid-template-columns: 44px 1fr;\n column-gap: 14px;\n align-items: center;\n min-height: 112px;\n padding: 22px 26px;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-trust-item + .hm-trust-item {\n border-inline-start: 1px solid var(--hm-border);\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-trust-item > span {\n display: grid;\n grid-row: 1 / span 2;\n place-items: center;\n width: 44px;\n height: 44px;\n color: var(--hm-blue-strong);\n background: var(--hm-yellow-soft);\n border-radius: 15px;\n font-size: 20px;\n font-weight: 900;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-trust-item strong {\n color: var(--hm-blue-strong);\n font-size: 16px;\n font-weight: 850;\n}\n\nbody.index.theme-raed.hm-home-enhanced .hm-trust-item small {\n color: var(--hm-muted);\n font-size: 13px;\n line-height: 1.5;\n}\n\nbody.index.theme-raed.hm-home-enhanced .s-block__title {\n align-items: end;\n margin-bottom: 26px;\n}\n\nbody.index.theme-raed.hm-home-enhanced .s-block__title h2 {\n color: var(--hm-blue-strong);\n font-size: clamp(26px, 3vw, 40px);\n font-weight: 850;\n line-height: 1.22;\n letter-spacing: -0.02em;\n}\n\nbody.index.theme-raed.hm-home-enhanced .s-block__display-all {\n min-height: 44px;\n padding: 10px 16px;\n color: var(--hm-blue);\n border-radius: 12px;\n font-weight: 800;\n transition: color 180ms ease, background 180ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced .s-block__display-all:hover {\n color: var(--hm-blue-strong);\n background: var(--hm-yellow-soft);\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--banners article {\n position: relative;\n overflow: hidden;\n min-height: 250px;\n border-radius: var(--hm-radius-card);\n box-shadow: var(--hm-shadow-card);\n transition: transform 220ms ease, box-shadow 220ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--banners a:hover article {\n transform: translateY(-4px);\n box-shadow: var(--hm-shadow-hover);\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--banners article::after {\n position: absolute;\n inset: 0;\n content: \"\";\n pointer-events: none;\n background: linear-gradient(0deg, rgba(7, 32, 73, 0.82), rgba(7, 32, 73, 0.04) 68%);\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--banners article h3,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--banners article p {\n position: relative;\n z-index: 1;\n color: #fff;\n text-shadow: 0 2px 16px rgba(4, 23, 54, 0.5);\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card.s-product-card-entry {\n overflow: hidden;\n height: 100%;\n background: var(--hm-surface);\n border: 1px solid var(--hm-border);\n border-radius: var(--hm-radius-card);\n box-shadow: 0 10px 32px rgba(18, 54, 111, 0.06);\n transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card.s-product-card-entry:hover {\n transform: translateY(-5px);\n border-color: rgba(18, 54, 111, 0.22);\n box-shadow: var(--hm-shadow-hover);\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-image {\n aspect-ratio: 1 / 1;\n overflow: hidden;\n background: #f2f5f8;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-image img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n transition: transform 360ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card:hover .s-product-card-image img {\n transform: scale(1.035);\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-content {\n display: flex;\n flex: 1;\n flex-direction: column;\n padding: 18px;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-content-title {\n display: -webkit-box;\n min-height: 3em;\n overflow: hidden;\n color: var(--hm-text);\n font-size: 16px;\n font-weight: 800;\n line-height: 1.5;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-content-subtitle {\n margin-top: 5px;\n color: var(--hm-muted);\n font-size: 12px;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-price {\n color: var(--hm-blue-strong);\n font-size: 19px;\n font-weight: 900;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-content-footer {\n margin-top: auto;\n padding-top: 14px;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card salla-add-product-button button {\n min-height: 44px;\n color: #fff;\n background: var(--hm-blue);\n border-color: var(--hm-blue);\n border-radius: var(--hm-radius-control);\n font-weight: 850;\n transition: transform 180ms ease, color 180ms ease, background 180ms ease, border-color 180ms ease;\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card salla-add-product-button button:hover:not(:disabled) {\n color: var(--hm-blue-strong);\n background: var(--hm-yellow);\n border-color: var(--hm-yellow);\n transform: translateY(-1px);\n}\n\nbody.index.theme-raed.hm-home-enhanced custom-salla-product-card salla-add-product-button button:disabled {\n color: #7c8797;\n background: #edf0f4;\n border-color: #d9dee6;\n cursor: not-allowed;\n opacity: 1;\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--features {\n padding-top: 30px;\n padding-bottom: 30px;\n background: var(--hm-surface);\n border: 1px solid var(--hm-border);\n border-radius: var(--hm-radius-card);\n box-shadow: var(--hm-shadow-card);\n}\n\nbody.index.theme-raed.hm-home-enhanced main > .s-block--bundle-faq-with-images,\nbody.index.theme-raed.hm-home-enhanced main > .s-block--testimonials {\n overflow: hidden;\n border-radius: var(--hm-radius-card);\n}\n\n@media (min-width: 768px) {\n body.index.theme-raed.hm-home-enhanced .hm-trust-strip {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n\n body.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider .hm-hero-actions {\n justify-content: flex-start;\n }\n}\n\n@media (max-width: 767px) {\n body.index.theme-raed.hm-home-enhanced .top-navbar {\n display: none;\n }\n\n body.index.theme-raed.hm-home-enhanced .store-header {\n min-height: 72px;\n }\n\n body.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider {\n height: 420px;\n }\n\n body.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider::after {\n background: linear-gradient(0deg, rgba(4, 28, 70, 0.68), rgba(4, 28, 70, 0.08) 78%);\n }\n\n body.index.theme-raed.hm-home-enhanced main > .s-block--hero-slider h2 {\n font-size: clamp(30px, 9vw, 42px);\n }\n\n body.index.theme-raed.hm-home-enhanced .hm-hero-actions {\n flex-direction: column;\n width: 100%;\n }\n\n body.index.theme-raed.hm-home-enhanced .hm-button {\n width: 100%;\n min-height: 48px;\n }\n\n body.index.theme-raed.hm-home-enhanced #hm-age-finder,\n body.index.theme-raed.hm-home-enhanced main > .s-block--banners,\n body.index.theme-raed.hm-home-enhanced main > .s-block.container,\n body.index.theme-raed.hm-home-enhanced main > .s-block--features,\n body.index.theme-raed.hm-home-enhanced main > .s-block--bundle-faq-with-images,\n body.index.theme-raed.hm-home-enhanced main > .s-block--testimonials {\n margin-top: 44px;\n margin-bottom: 44px;\n }\n\n body.index.theme-raed.hm-home-enhanced .hm-trust-strip {\n grid-template-columns: 1fr;\n margin-top: -16px;\n }\n\n body.index.theme-raed.hm-home-enhanced .hm-trust-item {\n min-height: 96px;\n padding: 18px 20px;\n }\n\n body.index.theme-raed.hm-home-enhanced .hm-trust-item + .hm-trust-item {\n border-top: 1px solid var(--hm-border);\n border-inline-start: 0;\n }\n\n body.index.theme-raed.hm-home-enhanced .s-block__title {\n align-items: center;\n gap: 12px;\n margin-bottom: 20px;\n }\n\n body.index.theme-raed.hm-home-enhanced .s-block__title h2 {\n font-size: 26px;\n }\n\n body.index.theme-raed.hm-home-enhanced main > .s-block--banners article {\n min-height: 210px;\n border-radius: 20px;\n }\n\n body.index.theme-raed.hm-home-enhanced custom-salla-product-card.s-product-card-entry {\n border-radius: 20px;\n }\n\n body.index.theme-raed.hm-home-enhanced custom-salla-product-card .s-product-card-content {\n padding: 14px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n body.index.theme-raed.hm-home-enhanced *,\n body.index.theme-raed.hm-home-enhanced *::before,\n body.index.theme-raed.hm-home-enhanced *::after {\n scroll-behavior: auto !important;\n transition-duration: 0.01ms !important;\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n }\n}\n"; document.head.appendChild(style); } function renderHeroActions() { return ``; } function renderTrustStrip() { return `
منتجات أصليةاختيارات موثوقة لطفلك
دفع آمنخيارات دفع موثوقة
توصيل سريعإلى جميع مناطق المملكة
`; } function organizeHomepage(document) { const fixedBanner = document.querySelector('main > .s-block--fixed-banner'); const showcase = document.querySelector('main > .s-block--bundle-categories-showcase'); const faq = document.querySelector('main > .s-block--bundle-faq-with-images'); const testimonials = document.querySelector('main > .s-block--testimonials'); const productSections = [...document.querySelectorAll('main > .s-block.container')] .filter(section => section.querySelector('salla-products-list')); const secondary = productSections.find(section => section.querySelector('h2')?.textContent.trim() === 'كرسي سيارة الأطفال' ); let hiddenSecondary = false; let movedBanner = false; let movedTestimonials = false; if (secondary) { secondary.classList.add('hm-section-hidden'); secondary.setAttribute('aria-hidden', 'true'); hiddenSecondary = true; } if (fixedBanner && showcase && showcase.nextElementSibling !== fixedBanner) { showcase.insertAdjacentElement('afterend', fixedBanner); movedBanner = true; } if (faq && testimonials && testimonials.nextElementSibling !== faq) { faq.insertAdjacentElement('beforebegin', testimonials); movedTestimonials = true; } return {hiddenSecondary, movedBanner, movedTestimonials}; } function enhanceHomepage(document) { const body = document.body; if (!body?.classList.contains('index')) return {enhanced: false, reason: 'not-homepage'}; if (body.classList.contains('hm-home-enhanced')) return {enhanced: false, reason: 'already-enhanced'}; const hero = document.querySelector('main > .s-block--hero-slider'); const finder = document.querySelector('#hm-age-finder'); if (!hero || !finder) return {enhanced: false, reason: 'missing-anchor'}; if (!hero.querySelector('.hm-hero-actions')) { const copy = hero.querySelector('p'); (copy ?? hero).insertAdjacentHTML('afterend', renderHeroActions()); } if (!document.querySelector('.hm-trust-strip')) { finder.insertAdjacentHTML('afterend', renderTrustStrip()); } organizeHomepage(document); body.classList.add('hm-home-enhanced'); return {enhanced: true, reason: 'enhanced'}; } enhanceHomepage(document); }; if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mount, {once: true}); } else { mount(); } })();