/* ============================================================================= LINE ABAYA COUTURE — Salla custom JS (theme: Raed — Twig 1.382 + new generation) ----------------------------------------------------------------------------- Paste into: تخصيص متقدم ← JS (same screen as line-salla.css) What it does (presentation only — it never touches cart, prices, checkout, login, or any Salla API): 1. marks with .line-js so CSS reveals only apply when JS runs; 2. header state on scroll (.line-scrolled on
); 3. a 1px reading-progress line under the header on the home page; 4. soft reveals on home blocks, product cards and banners; 5. styles the quotes block, which renders inside a shadow root CSS can't reach; 6. OPTIONAL: inserts the "التفاصيل تصنع الفرق" editorial section — only when you fill LINE_CONFIG.details.images with LINE's own photo URLs (upload them to Salla first). Empty list → nothing is inserted. Safe to run twice; respects prefers-reduced-motion; removing it restores stock Raed. ========================================================================== */ (function () { 'use strict'; if (window.__lineSalla) return; window.__lineSalla = true; /* ---------- edit here ---------- */ var LINE_CONFIG = { details: { enabled: true, /* Put this section after the Nth home block (1 = after the first). */ afterBlock: 1, /* Exactly 4 LINE photos (sleeve / fabric / cuff / accent). Leave [] to hide the section. Example item: { src: 'https://cdn.salla.sa/....jpg', alt: 'كم واسع منسدل' , caption: 'الكم' } */ images: [], title: { ar: 'التفاصيل تصنع الفرق', en: 'Details make the difference' }, copy: { ar: 'من انسيابية القماش إلى دقة التفاصيل، كل قطعة تعكس أسلوبًا خاصًا.', en: 'From the flow of the fabric to the precision of each detail, every piece reflects a style of its own.' }, act: { ar: 'التفاصيل', en: 'Details' } }, /* first "quotes" block on the home page = the opening stage */ stage: { lede: { ar: 'عبايات سعودية معاصرة، بقصّات صافية وتفاصيل محسوبة.', en: 'Contemporary Saudi abayas, with clean cuts and considered details.' }, cta: { ar: 'اكتشفي التفاصيل', en: 'Discover the details' }, /* OPTIONAL: 1–3 LINE campaign photos → the opening becomes the prototype's two-column stage with a crossfading slideshow (Ken Burns + progress bars). Leave [] for the text-only stage. Example item: { src: 'https://cdn.salla.sa/....jpg', alt: 'عباءة سوداء بقصّة مستقيمة' } */ images: [] }, /* every later "quotes" block = the dark story chapter */ story: { act: { ar: 'الحكاية', en: 'Story' }, cta: { ar: 'اقرئي الحكاية', en: 'Read the story' }, /* the store's "عن LINE" page, used when no menu on the page links to it (on phones the theme does not render the top links). Path after the store's home URL. */ aboutPath: 'عن-line/page-1800825628', /* OPTIONAL: one LINE photo shown full-bleed behind the story (with a dark shade + parallax). Example: { src: 'https://cdn.salla.sa/....jpg', alt: '' }. null → charcoal satin sheen only. */ image: null }, /* DRAFT images: the prototype's temporary editorial references (Unsplash, other photographers), shown ONLY in Salla's theme preview (*.salla.design) so the layout can be judged, each with a visible "not a LINE product" tag. They never render on the real store (nlineabaya.com / salla.sa). Any real image set above replaces its draft. To drop the drafts entirely: enabled: false. */ draft: { enabled: true, label: { ar: 'صورة مؤقتة للمعاينة — ليست من منتجات LINE', en: 'Temporary preview image — not a LINE product' }, stage: ['1683642765591-2370edc15193', '1762605135321-d025ebbd13d8', '1750190321540-fa2f3aed139a'], story: '1637750586228-179a1a7aef84', details: [ { id: '1791925662735-4e3bdd65a39a', caption: 'الانسياب' }, { id: '1760224254181-adac9e1a1900', caption: 'القماش' }, { id: '1772474578035-bebcd90b355d', caption: 'الأكمام' }, { id: '1704775988111-3aa9c705b57c', caption: 'اللمسة العنابية' } ] } }; /* ------------------------------- */ var T0 = Date.now(); var doc = document; var root = doc.documentElement; var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; var isEn = (root.getAttribute('lang') || '').toLowerCase().indexOf('en') === 0; var isHome = false; /* set in ready(): Raed puts class "index" on of the home page (live-verified) */ function ready(fn) { if (doc.readyState !== 'loading') fn(); else doc.addEventListener('DOMContentLoaded', fn, { once: true }); } function t(pair) { return isEn ? pair.en : pair.ar; } /* drafts: theme preview only (preview.salla.design), never the real storefront */ var PREVIEW = /(^|\.)salla\.design$/i.test(location.hostname); var DRAFT = LINE_CONFIG.draft.enabled && PREVIEW; function draftSrc(id, w) { return 'https://images.unsplash.com/photo-' + id + '?w=' + (w || 1280) + '&q=72&auto=format&fit=crop'; } function draftTag() { return '' + esc(t(LINE_CONFIG.draft.label)) + ''; } /* 1: .line-js is added after hydration (see afterHydration below) */ var INTRO = { dissolveAt: 350, dissolveFor: 1500, holdUntil: 2700, ivoryFor: 700, liftFor: 850 }; INTRO.ivoryEnd = INTRO.holdUntil + INTRO.ivoryFor; /* 3400 */ INTRO.reveal = INTRO.ivoryEnd + 100; /* the page's opening starts here */ INTRO.total = INTRO.ivoryEnd + INTRO.liftFor + 60; /* plate box = prototype geometry (end-frame spec 1920x1080 @46% height / 1080x1920 @62% width) */ var PLATE = '--lh:max(25.875vw, 46vh);--lw:calc(var(--lh) * 878 / 749);'; var PLATE_PORTRAIT = '--lw:max(62vw, 34.875vh);--lh:calc(var(--lw) * 749 / 878);'; var EYE_AT = 'calc(50% - var(--lw) * .2918) calc(50% - var(--lh) * .1246)'; /* eye at 20.82% / 37.54% of the plate */ /* brand intro: decided before first paint (Salla loads this file in ). Home only, never with reduced motion or a #hash. On the real store: once per browser session (as in the prototype). In Salla's theme preview (*.salla.design): every home load. */ var introOn = false; try { var segs = location.pathname.split('/').filter(Boolean).filter(function (s) { return !/^(ar|en)$/.test(s); }); /* ?intro in the address replays it on demand */ introOn = !reduce && !location.hash && (PREVIEW || !sessionStorage.getItem('line-intro') || /[?&]intro\b/.test(location.search)) && (segs.length === 0 || (segs.length === 1 && /^n-/.test(segs[0]))); /* custom domain: /ar ; salla.sa: /n-store/ar */ } catch (e) { introOn = false; } var introStyle = null; if (introOn) { introStyle = doc.createElement('style'); introStyle.id = 'line-intro-style'; introStyle.textContent = introCss(); (doc.head || root).appendChild(introStyle); } ready(function () { var body = doc.body; isHome = body.classList.contains('index'); /* 0: intro curtain (a