/* Add custom JS code below */ /* Add custom JS code below */ /* Add custom Js styles below */ /* ===================================================== DOSCHER TOPBAR SOCIALS ===================================================== */ (function () { function doscherTopbarSocials() { const topbar = document.querySelector('.top-navbar .container'); if (!topbar || document.querySelector('.doscher-top-socials')) return; const style = document.createElement('style'); style.innerHTML = ` .doscher-top-socials{ display:flex !important; align-items:center !important; gap:12px !important; margin-inline-start:14px !important; flex-shrink:0 !important; } .doscher-top-socials a{ color:inherit !important; font-size:16px !important; opacity:.9 !important; display:flex !important; align-items:center !important; justify-content:center !important; text-decoration:none !important; } .doscher-top-socials a:hover{ opacity:1 !important; transform:translateY(-1px); } @media(max-width:768px){ .top-navbar .container{ gap:8px !important; } .doscher-top-socials{ gap:9px !important; margin-inline-start:8px !important; } .doscher-top-socials a{ font-size:14px !important; } .doscher-top-socials i{ line-height:1 !important; } } `; document.head.appendChild(style); const socials = document.createElement('div'); socials.className = 'doscher-top-socials'; socials.innerHTML = ` `; topbar.appendChild(socials); } document.addEventListener('DOMContentLoaded', doscherTopbarSocials); window.addEventListener('load', doscherTopbarSocials); setTimeout(doscherTopbarSocials, 1000); })(); /* ===================================================== DOSCHER PRODUCT DESCRIPTION ACCORDION ===================================================== */ (function () { function doscherAccordionDescription() { const details = document.querySelector('#details_table'); if (!details) return; if (details.dataset.doscherFixed === 'true') return; details.dataset.doscherFixed = 'true'; details.classList.remove('doscher-accordion-ready'); const brandColor = '#81432d'; const style = document.createElement('style'); style.innerHTML = ` #details_table.doscher-accordion-desc{ color:#000; line-height:1.8; } #details_table h2, #details_table h3, #details_table .doscher-title, #details_table .doscher-title *, #details_table strong{ color:${brandColor} !important; } #details_table .doscher-title{ font-size:26px; font-weight:800; margin:28px 0 16px; } #details_table .doscher-acc-item{ border:1px solid #ead8cf; border-radius:24px; margin-bottom:14px; background:#fff; overflow:hidden; } #details_table .doscher-acc-question{ width:100%; background:#fff; border:0; padding:18px 22px; font-size:16px; font-weight:800; color:${brandColor} !important; text-align:left; cursor:pointer; display:flex; justify-content:space-between; align-items:center; gap:15px; } #details_table .doscher-acc-question:after{ content:"+"; font-size:24px; font-weight:400; color:${brandColor}; transition:.25s; flex-shrink:0; } #details_table .doscher-acc-item.active .doscher-acc-question:after{ transform:rotate(45deg); } #details_table .doscher-acc-answer{ max-height:0; overflow:hidden; transition:max-height .35s ease; } #details_table .doscher-acc-content{ padding:0 22px 22px; color:#333; font-size:15px; } #details_table .doscher-acc-content p{ margin:0 0 10px; } #details_table .doscher-acc-content ul{ padding-left:22px; margin:10px 0; } #details_table .doscher-img{ margin:22px 0; } #details_table .doscher-img img{ width:100%; display:block; border-radius:28px; } @media(max-width:768px){ #details_table .doscher-title{ font-size:22px; } #details_table .doscher-acc-question{ font-size:15px; padding:16px; } } `; document.head.appendChild(style); details.classList.add('doscher-accordion-desc'); let html = details.innerHTML; const temp = document.createElement('div'); temp.innerHTML = html; temp.querySelectorAll('.doscher-acc-answer').forEach(function (answer) { answer.style.maxHeight = null; }); const children = Array.from(temp.children); let newHTML = ''; let currentQuestion = ''; let currentAnswer = ''; function cleanText(text) { return text.replace(/\s+/g, ' ').trim(); } function closeAccordion() { if (!currentQuestion) return; newHTML += `
${currentAnswer}
`; currentQuestion = ''; currentAnswer = ''; } children.forEach(function (el) { const tag = el.tagName.toLowerCase(); const rawText = cleanText(el.innerText || ''); const hasImage = el.querySelector('img'); if (hasImage) { const img = el.querySelector('img'); const clone = el.cloneNode(true); clone.querySelectorAll('img').forEach(function (image) { image.remove(); }); const textWithoutImg = cleanText(clone.innerText || ''); if (textWithoutImg && currentQuestion) { currentAnswer += `

${textWithoutImg}

`; } else if (textWithoutImg) { newHTML += `

${textWithoutImg}

`; } closeAccordion(); if (img) { newHTML += `
${img.outerHTML}
`; } return; } if (tag === 'h2' || tag === 'h3') { closeAccordion(); newHTML += `<${tag} class="doscher-title">${rawText}`; return; } if (el.classList.contains('doscher-acc-item')) { closeAccordion(); const q = el.querySelector('.doscher-acc-question'); const a = el.querySelector('.doscher-acc-content'); if (q && a) { currentQuestion = cleanText(q.innerText || ''); currentAnswer = a.innerHTML; closeAccordion(); } return; } const isQuestion = /^Q\s*:/i.test(rawText); const isAnswer = /^A\s*:/i.test(rawText); if (isQuestion) { closeAccordion(); currentQuestion = rawText.replace(/^Q\s*:/i, '').trim(); currentAnswer = ''; return; } if (currentQuestion) { if (isAnswer) { el.innerHTML = el.innerHTML.replace(/^A\s*:/i, '').trim(); } currentAnswer += el.outerHTML; return; } newHTML += el.outerHTML; }); closeAccordion(); details.innerHTML = newHTML; document.querySelectorAll('#details_table .doscher-acc-question').forEach(function (btn) { btn.addEventListener('click', function () { const item = this.closest('.doscher-acc-item'); const answer = item.querySelector('.doscher-acc-answer'); item.classList.toggle('active'); if (item.classList.contains('active')) { answer.style.maxHeight = answer.scrollHeight + 'px'; } else { answer.style.maxHeight = null; } }); }); } document.addEventListener('DOMContentLoaded', doscherAccordionDescription); window.addEventListener('load', doscherAccordionDescription); setTimeout(doscherAccordionDescription, 1000); setTimeout(doscherAccordionDescription, 2000); setTimeout(doscherAccordionDescription, 3000); })(); /* ===================================================== DOSCHER PRODUCT MINI FEATURES - AR / EN حل مشكلة العربي بالاعتماد على رابط المنتج + العنوان ===================================================== */ (function () { function doscherIsArabicPage() { const htmlLang = (document.documentElement.lang || '').toLowerCase(); const url = window.location.href.toLowerCase(); return ( htmlLang.includes('ar') || document.documentElement.dir === 'rtl' || url.includes('/ar/') ); } function doscherProductFeatures() { if (document.querySelector('.doscher-mini-features')) return; const installment = document.querySelector('salla-installment'); if (!installment) return; const isArabic = doscherIsArabicPage(); const titleEl = document.querySelector('h1, .product-title, [data-testid="product-title"]'); const title = titleEl ? titleEl.innerText.toLowerCase() : ''; const url = window.location.href.toLowerCase(); let features = isArabic ? [ 'حرارة سيراميك', 'لطيف على الشعر', 'تصفيف سريع', 'ثبات طويل' ] : [ 'Ceramic Heat', 'Hair-Friendly', 'Fast Styling', 'Long Lasting' ]; /* 5-in-1 Ceramic Interchangeable Set */ if ( url.includes('/p1680668735') || title.includes('5-in-1 ceramic interchangeable set') || title.includes('ceramic interchangeable') ) { features = isArabic ? [ '5 ملحقات', 'ستايلات كيرلي مختلفة', 'لطيف على الشعر', 'ثبات طويل' ] : [ '5 Attachments', 'Different Curling Styles', 'Hair Friendly', 'Long Lasting' ]; } /* Hair Dryer Brush */ else if ( url.includes('/p2108425307') || title.includes('hair dryer brush') ) { features = isArabic ? [ 'لمعة ناعمة', 'تجفيف سريع', 'توزيع حرارة متساوي', 'مناسب للاستخدام اليومي' ] : [ 'Shiny Finish', 'Quick Blowout', 'Even Heat Distribution', 'Made for Everyday' ]; } /* Multifunctional Hot Air Brush */ else if ( url.includes('/p2058064436') || title.includes('multifunctional hot air brush') ) { features = isArabic ? [ 'تدفق هواء 360°', 'نعومة ولمعان', 'حجم وكثافة للشعر', 'تقليل الهيشان' ] : [ '360° Airflow', 'Smooth Finish', 'Voluminous Hair', 'Frizz Control' ]; } /* AirStyler Lite */ else if ( url.includes('/p1638405226') || title.includes('5 in 1 multifunctional hair styler') || title.includes('5-in-1 multifunctional hair styler') || title.includes('hair styler & hair dryer') ) { features = isArabic ? [ 'تدفق هواء 360°', '4 تسريحات مختلفة', 'خاصية تبريد بلمسة', 'نعومة ولمعان' ] : [ '360° Airflow', '4 Hairstyles', 'One Touch Cool Setting', 'Smooth Finish' ]; } /* Smooth Flow Ceramic Flat Iron */ else if ( url.includes('/p370694303') || title.includes('smooth flow ceramic flat iron') || title.includes('smooth flow') || title.includes('flat iron') ) { features = isArabic ? [ 'نتيجة مفرودة وناعمة', 'ألواح سيراميك', 'مناسب لعمل ويفي', 'تقليل الهيشان' ] : [ 'Sleek Finish', 'Ceramic Coated Plate', 'Suitable for Wave Styling', 'Frizz Control' ]; } /* WetStyle Hot Air Brush */ else if ( url.includes('/p1424109101') || title.includes('wetstyle hot air brush') || title.includes('wet style hot air brush') || title.includes('wetstyle') ) { features = isArabic ? [ 'تجفيف خلال دقائق', 'تقليل الهيشان', 'حرارة ذكية', 'حجم وكثافة للشعر' ] : [ 'Dry Within Minutes', 'Frizz Control', 'Smart Heat', 'Voluminous Hair' ]; } const style = document.createElement('style'); style.innerHTML = ` .doscher-mini-features{ display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin:12px 0 18px; } .doscher-mini-features.doscher-ar{ direction:rtl; } .doscher-mini-feature{ display:flex; align-items:center; gap:7px; background:#fff; border:1px solid #eee; border-radius:12px; padding:9px 11px; font-size:13px; font-weight:700; color:#111; white-space:nowrap; } .doscher-mini-features.doscher-ar .doscher-mini-feature{ justify-content:flex-start; text-align:right; } .doscher-mini-feature:before{ content:"✓"; width:18px; height:18px; border-radius:50%; background:#000; color:#fff; display:flex; align-items:center; justify-content:center; font-size:11px; flex-shrink:0; } @media(max-width:480px){ .doscher-mini-feature{ font-size:12px; padding:8px 9px; } } `; document.head.appendChild(style); const box = document.createElement('div'); box.className = 'doscher-mini-features' + (isArabic ? ' doscher-ar' : ''); box.innerHTML = features.map(function (item) { return '
' + item + '
'; }).join(''); installment.insertAdjacentElement('afterend', box); } document.addEventListener('DOMContentLoaded', doscherProductFeatures); window.addEventListener('load', doscherProductFeatures); setTimeout(doscherProductFeatures, 1000); })(); /* ===================================================== DOSCHER FOOTER MAIN FIX ===================================================== */ (function () { function doscherFooterFix() { if (document.querySelector('.doscher-footer-fix-style')) return; const style = document.createElement('style'); style.className = 'doscher-footer-fix-style'; style.innerHTML = ` .store-footer .footer-logo img{ width:560px !important; max-width:100% !important; height:auto !important; margin:0 !important; } @media(min-width:1024px){ .store-footer__inner .grid{ display:grid !important; grid-template-columns: 2.2fr 1fr 1fr !important; gap:80px !important; align-items:start !important; } .store-footer__inner .grid > div{ margin-bottom:0 !important; } .store-footer__inner .grid > div:first-child{ grid-column:auto !important; } .store-footer__inner .grid > div:nth-child(2), .store-footer__inner .grid > div:nth-child(3){ padding-top:8px !important; } .store-footer .footer-title{ margin:0 0 24px !important; line-height:1.2 !important; min-height:24px !important; } .store-footer .enhanced_links{ display:grid !important; grid-template-columns:1fr 1fr !important; gap:18px 45px !important; } } @media(max-width:768px){ .store-footer__inner{ padding-top:30px !important; } .store-footer__inner .grid{ display:block !important; } .store-footer .footer-logo img{ width:360px !important; max-width:92% !important; margin:0 auto !important; } .store-footer .footer-description{ text-align:center !important; max-width:340px !important; margin:14px auto 18px !important; } .store-footer .footer-badges{ justify-content:center !important; margin-bottom:22px !important; } .store-footer .footer-title{ font-size:17px !important; margin:0 !important; padding:15px 0 !important; line-height:1.2 !important; display:flex !important; align-items:center !important; justify-content:space-between !important; border-bottom:1px solid rgba(255,255,255,.25) !important; } .store-footer .enhanced_links_wrapper .footer-title:after{ content:"+"; font-size:24px; font-weight:400; } .store-footer .enhanced_links_wrapper.active .footer-title:after{ content:"−"; } .store-footer .enhanced_links{ display:none !important; grid-template-columns:1fr !important; gap:0 !important; padding:10px 0 15px !important; } .store-footer .enhanced_links_wrapper.active .enhanced_links{ display:grid !important; } .store-footer .enhanced_links li{ margin:0 !important; padding:8px 0 !important; } .store-footer selia-contacts .footer-title{ border-bottom:0 !important; margin-top:4px !important; } .store-footer .enhanced_rounded_contacts{ justify-content:flex-start !important; padding-top:12px !important; } } `; document.head.appendChild(style); const linksWrapper = document.querySelector('.store-footer .enhanced_links_wrapper'); if (linksWrapper && !linksWrapper.classList.contains('doscher-dropdown-ready')) { linksWrapper.classList.add('doscher-dropdown-ready'); const title = linksWrapper.querySelector('.footer-title'); if (title) { title.addEventListener('click', function () { if (window.innerWidth <= 768) { linksWrapper.classList.toggle('active'); } }); } } } document.addEventListener('DOMContentLoaded', doscherFooterFix); window.addEventListener('load', doscherFooterFix); setTimeout(doscherFooterFix, 1000); })(); /* ===================================================== DOSCHER FOOTER ALIGN FIX ===================================================== */ (function () { function doscherFooterAlignFix() { if (document.querySelector('.doscher-footer-align-fix-style')) return; const style = document.createElement('style'); style.className = 'doscher-footer-align-fix-style'; style.innerHTML = ` @media(min-width:1024px){ .store-footer .enhanced_links_wrapper{ width:100% !important; } .store-footer .enhanced_links_wrapper .footer-title, .store-footer selia-contacts .footer-title{ padding-left:0 !important; margin-left:0 !important; margin-bottom:26px !important; } .store-footer .enhanced_links{ list-style:none !important; padding-left:0 !important; margin-left:0 !important; display:grid !important; grid-template-columns:1fr 1fr !important; column-gap:46px !important; row-gap:28px !important; } .store-footer .enhanced_links li{ list-style:none !important; padding-left:0 !important; margin-left:0 !important; } .store-footer .enhanced_links li::marker{ display:none !important; content:"" !important; } .store-footer .enhanced_links li a{ display:block !important; padding-left:0 !important; margin-left:0 !important; } .store-footer selia-contacts .enhanced_rounded_contacts{ padding-left:0 !important; margin-left:0 !important; align-items:flex-start !important; justify-content:flex-start !important; } } `; document.head.appendChild(style); } document.addEventListener('DOMContentLoaded', doscherFooterAlignFix); window.addEventListener('load', doscherFooterAlignFix); setTimeout(doscherFooterAlignFix, 1000); })(); /* ===================================================== DOSCHER PRODUCT TAGLINE - PRODUCT PAGE + QUICK VIEW ===================================================== */ (function () { const products = { 'p733781042': { en: "Five barrels. Endless styles. Here’s everything you need to curl with confidence — and keep your hair healthy while doing it.", ar: "خمس ملحقات لتسريحات لا نهائية. كل ما تحتاجينه لعمل كيرلي بثقة مع الحفاظ على مظهر صحي وناعم لشعرك." }, 'p1556927020': { en: "Frizz-free. Shiny. Done fast. The Hair Dryer Brush is built for the woman who wants a clean, polished finish every single day — without the extra effort.", ar: "بدون هيشان، بلمعة ناعمة، وفي وقت أقل. فرشاة تجفيف الشعر مصممة لإطلالة يومية مرتبة ولامعة بدون مجهود زائد." }, 'p1297457502': { en: "One step from damp to done. The multifunctional hot air brush was built to give you a salon-quality blowout without the salon price tag or the extra 45 minutes.", ar: "من شعر رطب إلى إطلالة جاهزة في خطوة واحدة. فرشاة الهواء متعددة الاستخدام تمنحك نتيجة صالون في البيت بدون وقت طويل أو تكلفة إضافية." }, 'p374167701': { en: "One tool. Every look. From sleek straight styles to soft curls and voluminous blowouts — this is your entire styling routine simplified.", ar: "أداة واحدة لكل إطلالة. من الشعر الناعم المفرود إلى الكيرلي الخفيف والتصفيف الاحترافي الكثيف — روتين التصفيف أصبح أسهل." }, 'p1186893114': { en: "Smooth, sleek, effortless. Designed to straighten, wave, and tame frizz with one clean glide — without stressing your hair.", ar: "نعومة، انسيابية، وسهولة في الاستخدام. مصمم لفرد الشعر، وعمل ويفي، وتقليل الهيشان بتمريرة واحدة ناعمة." }, 'p49130596': { en: "From damp to polished in one effortless step. The WetStyle Hot Air Brush gives you smooth, voluminous blowouts with less heat damage and way less time.", ar: "من شعر رطب إلى إطلالة مصففة في خطوة سهلة. تمنحك WetStyle Hot Air Brush شعرًا ناعمًا بكثافة طبيعية مع حرارة أقل ووقت أقل." } }; function isArabicPage() { const lang = (document.documentElement.lang || '').toLowerCase(); const url = location.href.toLowerCase(); return lang.includes('ar') || document.documentElement.dir === 'rtl' || url.includes('/ar/'); } function getTaglineFromUrl(url) { const isAr = isArabicPage() || url.includes('/ar/'); for (const id in products) { if (url.includes(id)) { return products[id][isAr ? 'ar' : 'en']; } } return ''; } function addProductPageTagline() { if (document.querySelector('.doscher-product-tagline')) return; const tagline = getTaglineFromUrl(location.href.toLowerCase()); if (!tagline) return; const stockBox = document.querySelector('#variant-inventory') || document.querySelector('.product-formatted-price') || document.querySelector('.product-entry__info h1') || document.querySelector('h1'); if (!stockBox) return; const el = document.createElement('div'); el.className = 'doscher-product-tagline'; el.textContent = tagline; stockBox.insertAdjacentElement('afterend', el); } function replaceQuickViewDescription() { document.querySelectorAll('.quickview-description').forEach(function (box) { if (box.classList.contains('doscher-qv-ready')) return; const link = box.querySelector('a[href*="/p"]'); if (!link) return; const tagline = getTaglineFromUrl(link.href.toLowerCase()); if (!tagline) return; const desc = box.querySelector('div'); if (desc) desc.textContent = tagline; box.classList.add('doscher-qv-ready', 'doscher-qv-tagline'); }); } function addStyle() { if (document.querySelector('#doscher-tagline-style')) return; const style = document.createElement('style'); style.id = 'doscher-tagline-style'; style.innerHTML = ` .doscher-product-tagline, .doscher-qv-tagline div{ color:#666; font-size:15px; line-height:1.9; font-weight:400; } .doscher-product-tagline{ margin-top:14px; margin-bottom:18px; max-width:650px; } html[lang*="ar"] .doscher-product-tagline, html[lang*="ar"] .doscher-qv-tagline div{ direction:rtl; text-align:right; } .doscher-qv-tagline div{ margin-bottom:8px; } @media(max-width:768px){ .doscher-product-tagline, .doscher-qv-tagline div{ font-size:14px; line-height:1.8; } } `; document.head.appendChild(style); } function runDoscherTaglines() { addStyle(); addProductPageTagline(); replaceQuickViewDescription(); } document.addEventListener('DOMContentLoaded', runDoscherTaglines); window.addEventListener('load', runDoscherTaglines); setInterval(runDoscherTaglines, 700); })(); /* ===================================================== DOSCHER ARABIC PRODUCT DESCRIPTION ACCORDION ===================================================== */ (function () { function doscherArabicAccordionDescription() { const details = document.querySelector('#details_table'); if (!details) return; if (details.dataset.doscherArFixed === 'true') return; const url = window.location.href.toLowerCase(); const lang = (document.documentElement.lang || '').toLowerCase(); const dir = (document.documentElement.dir || '').toLowerCase(); const isArabic = !url.includes('/en/') && (lang.includes('ar') || dir === 'rtl' || details.innerText.match(/[\u0600-\u06FF]/)); if (!isArabic) return; details.dataset.doscherArFixed = 'true'; details.classList.remove('doscher-accordion-ready'); const brandColor = '#81432d'; if (!document.querySelector('#doscher-ar-accordion-style')) { const style = document.createElement('style'); style.id = 'doscher-ar-accordion-style'; style.innerHTML = ` #details_table.doscher-accordion-desc{ color:#000; line-height:1.8; direction:rtl; text-align:right; } #details_table h2, #details_table h3, #details_table .doscher-title, #details_table .doscher-title *, #details_table strong{ color:${brandColor} !important; } #details_table .doscher-title{ font-size:26px; font-weight:800; margin:28px 0 16px; text-align:right; } #details_table .doscher-acc-item{ border:1px solid #ead8cf; border-radius:24px; margin-bottom:14px; background:#fff; overflow:hidden; } #details_table .doscher-acc-question{ width:100%; background:#fff; border:0; padding:18px 22px; font-size:16px; font-weight:800; color:${brandColor} !important; text-align:right; cursor:pointer; display:flex; flex-direction:row-reverse; justify-content:space-between; align-items:center; gap:15px; direction:rtl; font-family:inherit; } #details_table .doscher-acc-question:after{ content:"+"; font-size:24px; font-weight:400; color:${brandColor}; transition:.25s; flex-shrink:0; } #details_table .doscher-acc-item.active .doscher-acc-question:after{ transform:rotate(45deg); } #details_table .doscher-acc-answer{ max-height:0; overflow:hidden; transition:max-height .35s ease; } #details_table .doscher-acc-content{ padding:0 22px 22px; color:#333; font-size:15px; direction:rtl; text-align:right; } #details_table .doscher-acc-content p{ margin:0 0 10px; } #details_table .doscher-img{ margin:22px 0; } #details_table .doscher-img img{ width:100%; display:block; border-radius:28px; } @media(max-width:768px){ #details_table .doscher-title{ font-size:22px; } #details_table .doscher-acc-question{ font-size:15px; padding:16px; } } #details_table.doscher-accordion-desc{ direction:rtl !important; text-align:right !important; } #details_table .doscher-acc-question{ direction:rtl !important; text-align:right !important; flex-direction:row !important; } #details_table .doscher-acc-content{ direction:rtl !important; text-align:right !important; } #details_table p, #details_table li, #details_table h2, #details_table h3{ direction:rtl !important; text-align:right !important; } `; document.head.appendChild(style); } details.classList.add('doscher-accordion-desc'); const temp = document.createElement('div'); temp.innerHTML = details.innerHTML; const children = Array.from(temp.children); let newHTML = ''; let currentQuestion = ''; let currentAnswer = ''; function cleanText(text) { return text.replace(/\s+/g, ' ').trim(); } function closeAccordion() { if (!currentQuestion) return; newHTML += `
${currentAnswer}
`; currentQuestion = ''; currentAnswer = ''; } children.forEach(function (el) { const tag = el.tagName.toLowerCase(); const rawText = cleanText(el.innerText || ''); const hasImage = el.querySelector('img'); if (!rawText && !hasImage) return; if (hasImage) { const img = el.querySelector('img'); const clone = el.cloneNode(true); clone.querySelectorAll('img').forEach(function (image) { image.remove(); }); const textWithoutImg = cleanText(clone.innerText || ''); if (textWithoutImg && currentQuestion) { currentAnswer += `

${textWithoutImg}

`; } else if (textWithoutImg) { newHTML += `

${textWithoutImg}

`; } closeAccordion(); if (img) { newHTML += `
${img.outerHTML}
`; } return; } if (tag === 'h2' || tag === 'h3') { closeAccordion(); newHTML += `<${tag} class="doscher-title">${rawText}`; return; } const isQuestion = /^س\s*:/i.test(rawText); const isAnswer = /^ج\s*:/i.test(rawText); if (isQuestion) { closeAccordion(); currentQuestion = rawText.replace(/^س\s*:/i, '').trim(); currentAnswer = ''; return; } if (currentQuestion) { if (isAnswer) { el.innerHTML = el.innerHTML.replace(/^\s*ج\s*:\s*/i, '').trim(); } currentAnswer += el.outerHTML; return; } newHTML += el.outerHTML; }); closeAccordion(); details.innerHTML = newHTML; document.querySelectorAll('#details_table .doscher-acc-question').forEach(function (btn) { btn.addEventListener('click', function () { const item = this.closest('.doscher-acc-item'); const answer = item.querySelector('.doscher-acc-answer'); item.classList.toggle('active'); if (item.classList.contains('active')) { answer.style.maxHeight = answer.scrollHeight + 'px'; } else { answer.style.maxHeight = null; } }); }); } document.addEventListener('DOMContentLoaded', doscherArabicAccordionDescription); window.addEventListener('load', doscherArabicAccordionDescription); setTimeout(doscherArabicAccordionDescription, 1000); setTimeout(doscherArabicAccordionDescription, 2000); setTimeout(doscherArabicAccordionDescription, 3000); })(); /* ========================= Arabic Cart Breadcrumb Text تغيير نصوص البريدمكرامب بالعربي فقط ========================= */ document.addEventListener('DOMContentLoaded', () => { const isArabic = document.documentElement.lang === 'ar' || document.documentElement.dir === 'rtl' || window.location.pathname.startsWith('/ar'); if (!isArabic) return; const updateTexts = () => { let done = false; document.querySelectorAll('.s-breadcrumb-item a').forEach(link => { if (link.textContent.trim() === 'الرئيسية') { link.textContent = 'الصفحة الرئيسية'; done = true; } }); const homeBtn = document.querySelector('a.btn--outline-primary.btn--rounded-full'); if (homeBtn) { homeBtn.textContent = 'العودة للصفحة الرئيسية'; } return done; }; if (updateTexts()) return; const observer = new MutationObserver(() => { if (updateTexts()) { observer.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true }); }); /* ========================= DOSCHER Mobile Header Hide Menu Text On Mobile Only - Arabic & English ========================= */ (function () { function doscherHideMenuTextMobileOnly() { const isMobile = window.innerWidth <= 767; document.querySelectorAll('.menu-label').forEach(function (label) { if (isMobile) { label.style.setProperty('display', 'none', 'important'); } else { label.style.removeProperty('display'); label.style.removeProperty('visibility'); label.style.removeProperty('width'); label.style.removeProperty('margin'); label.style.removeProperty('overflow'); } }); } document.addEventListener('DOMContentLoaded', doscherHideMenuTextMobileOnly); window.addEventListener('load', doscherHideMenuTextMobileOnly); window.addEventListener('resize', doscherHideMenuTextMobileOnly); setTimeout(doscherHideMenuTextMobileOnly, 500); setTimeout(doscherHideMenuTextMobileOnly, 1500); setTimeout(doscherHideMenuTextMobileOnly, 3000); })(); /* ===================================================== DOSCHER TOP NAV LINKS - REPLACE REFUND POLICY WITH FAQ استبدال رابط سياسة الاسترجاع برابط الأسئلة الشائعة عربي / إنجليزي ===================================================== */ (function () { function doscherReplaceRefundWithFAQ() { const isArabic = document.documentElement.lang.toLowerCase().includes('ar') || document.documentElement.dir === 'rtl' || window.location.href.toLowerCase().includes('/ar/'); const links = document.querySelectorAll('.topnav-link-item.right-side'); links.forEach(function (link) { const text = link.textContent.trim().toLowerCase(); if ( text.includes('return policy') || text.includes('refund policy') || text.includes('سياسة الاسترجاع') || text.includes('سياسة الاسترداد') ) { if (isArabic) { link.href = 'https://doscher.ae/ar/FAQs/page-1394332750'; link.textContent = 'الاسئلة الشائعة'; } else { link.href = 'https://doscher.ae/en/FAQs/page-1394332750'; link.textContent = 'FAQs'; } } }); } document.addEventListener('DOMContentLoaded', doscherReplaceRefundWithFAQ); window.addEventListener('load', doscherReplaceRefundWithFAQ); setTimeout(doscherReplaceRefundWithFAQ, 1000); })(); //Banners (function() { // 1. تحديد لغة المتجر (true لو إنجليزي، false لو عربي) const isEnglish = document.documentElement.lang.toLowerCase().includes('en') || window.location.href.includes('/en'); console.log(`Salla Banner Script: Language detected is ${isEnglish ? 'English' : 'Arabic'}`); // 2. هيكلة الروابط بناءً على اللغة const imageMap = [ { // ===== نسخة الديسكتوب ===== // مفتاح البحث (الجزء الثابت من رابط سلة الأصلي للديسكتوب) searchKey: '85483cf4-3a74-40bb-b01b-069b7eb87179_1440x750', // الرابط الجديد بناءً على اللغة newUrl: isEnglish ? 'https://arenagrow.s3.eu-north-1.amazonaws.com/we/DESKTOP_English.jpg' : 'https://arenagrow.s3.eu-north-1.amazonaws.com/we/DESKTOP_Arabic.jpg' }, { // ===== نسخة الموبايل ===== // مفتاح البحث (الجزء الثابت من رابط سلة الأصلي للموبايل) searchKey: '97a92221-3c83-42eb-8f2f-25db572db452_675x900', // الرابط الجديد بناءً على اللغة newUrl: isEnglish ? 'https://arenagrow.s3.eu-north-1.amazonaws.com/we/Mobile_Size_English.jpg' : 'https://arenagrow.s3.eu-north-1.amazonaws.com/we/Mobile_Size_Arabic.jpg' } ]; // 3. وظيفة البحث والاستبدال الشاملة const forceReplaceImages = () => { const images = document.querySelectorAll('img'); images.forEach(img => { imageMap.forEach(item => { // فحص هل الصورة دي هي البانر المستهدف (ديسكتوب أو موبايل) const imgSource = img.src || img.getAttribute('data-src') || img.getAttribute('srcset') || ''; if (imgSource.includes(item.searchKey)) { // استبدال كل خصائص عرض الصورة بالرابط المخصص بتاعنا img.src = item.newUrl; if (img.hasAttribute('data-src')) { img.setAttribute('data-src', item.newUrl); } if (img.hasAttribute('srcset')) { // منصة سلة بتعمل ريسايز للصور في الـ srcset، بنستبدلها بالرابط بتاعك عشان نلغي القصة دي img.setAttribute('srcset', item.newUrl); } } }); }); }; // 4. تشغيل الكود في كل مراحل تحميل الصفحة لضمان اصطياد الصور forceReplaceImages(); document.addEventListener("DOMContentLoaded", forceReplaceImages); window.addEventListener("load", forceReplaceImages); // 5. مراقبة التغيرات (عشان لو العميل عمل سكرول أو البانر كان جوه سلايدر) const observer = new MutationObserver(() => { forceReplaceImages(); }); const startObserving = () => { if (document.body) { observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['src', 'data-src', 'srcset'] }); } else { setTimeout(startObserving, 100); } }; startObserving(); })(); /* ========================================= DOSCHER Smart Care Bilingual Slider Auto Play + Dots + Swipe + Language Switch ========================================= */ (function () { function isEnglishPage() { var lang = ( document.documentElement.getAttribute("lang") || "" ).toLowerCase(); var path = window.location.pathname.toLowerCase(); return ( lang.indexOf("en") === 0 || path === "/en" || path.indexOf("/en/") === 0 ); } function setDoscherLanguage() { var english = isEnglishPage(); document .querySelectorAll(".ds-care-lang-ar") .forEach(function (element) { element.style.display = english ? "none" : "block"; }); document .querySelectorAll(".ds-care-lang-en") .forEach(function (element) { element.style.display = english ? "block" : "none"; }); } function initDoscherCarousel(languageSection) { if ( !languageSection || languageSection.dataset.sliderReady === "true" ) { return; } languageSection.dataset.sliderReady = "true"; var slides = Array.from( languageSection.querySelectorAll(".ds-care-slide") ); var dots = Array.from( languageSection.querySelectorAll(".ds-care-dot") ); var viewport = languageSection.querySelector( ".ds-care-viewport" ); if (!slides.length || !viewport) { return; } var currentIndex = 0; var timer = null; var delay = 5000; var touchStartX = 0; var touchEndX = 0; var mouseStartX = 0; var isDragging = false; function showSlide(index) { if (index < 0) { index = slides.length - 1; } if (index >= slides.length) { index = 0; } currentIndex = index; slides.forEach(function (slide, slideIndex) { slide.classList.toggle( "is-active", slideIndex === currentIndex ); slide.setAttribute( "aria-hidden", slideIndex === currentIndex ? "false" : "true" ); }); dots.forEach(function (dot, dotIndex) { dot.classList.toggle( "is-active", dotIndex === currentIndex ); }); } function nextSlide() { showSlide(currentIndex + 1); } function previousSlide() { showSlide(currentIndex - 1); } function stopAutoPlay() { if (timer) { window.clearInterval(timer); timer = null; } } function startAutoPlay() { stopAutoPlay(); timer = window.setInterval(function () { nextSlide(); }, delay); } function restartAutoPlay() { stopAutoPlay(); startAutoPlay(); } function handleSwipe(startX, endX) { var difference = endX - startX; if (Math.abs(difference) < 45) { return; } if (difference < 0) { nextSlide(); } else { previousSlide(); } restartAutoPlay(); } dots.forEach(function (dot, index) { dot.addEventListener("click", function () { showSlide(index); restartAutoPlay(); }); }); viewport.addEventListener( "touchstart", function (event) { touchStartX = event.changedTouches[0].clientX; stopAutoPlay(); }, { passive: true } ); viewport.addEventListener( "touchend", function (event) { touchEndX = event.changedTouches[0].clientX; handleSwipe(touchStartX, touchEndX); startAutoPlay(); }, { passive: true } ); viewport.addEventListener("mousedown", function (event) { isDragging = true; mouseStartX = event.clientX; stopAutoPlay(); viewport.style.cursor = "grabbing"; }); window.addEventListener("mouseup", function (event) { if (!isDragging) { return; } isDragging = false; viewport.style.cursor = "grab"; handleSwipe(mouseStartX, event.clientX); startAutoPlay(); }); viewport.addEventListener("mouseenter", stopAutoPlay); viewport.addEventListener("mouseleave", function () { if (!isDragging) { startAutoPlay(); } }); viewport.style.cursor = "grab"; showSlide(0); startAutoPlay(); } function initializeDoscherSlider() { setDoscherLanguage(); document .querySelectorAll(".ds-care-language") .forEach(function (section) { initDoscherCarousel(section); }); } function runDoscherInitialization() { initializeDoscherSlider(); window.setTimeout(initializeDoscherSlider, 700); window.setTimeout(initializeDoscherSlider, 1800); } if (document.readyState === "loading") { document.addEventListener( "DOMContentLoaded", runDoscherInitialization ); } else { runDoscherInitialization(); } document.addEventListener( "salla::page.ready", runDoscherInitialization ); })(); (function () { function moveSearchIcon() { if (window.innerWidth < 1024) return; const left = document.querySelector('.flex.items-center.justify-start.w-1\\/3'); const menu = left?.querySelector('.mburger'); const search = document.querySelector( '.flex.items-center.justify-end.w-1\\/3 button[data-selia="header-search-button"]' ); if (!left || !menu || !search) return; // لو اتنقلت قبل كده if (search.dataset.moved) return; menu.insertAdjacentElement('afterend', search); search.dataset.moved = "true"; // نشيل المارجن القديم search.classList.remove( 'ml-3', 'md:ml-4', 'rtl:ml-[unset]', 'rtl:mr-3', 'rtl:md:mr-4' ); search.style.marginInlineStart = '12px'; } document.addEventListener('DOMContentLoaded', moveSearchIcon); window.addEventListener('load', moveSearchIcon); setTimeout(moveSearchIcon, 1000); })();