/* 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() : document.body.innerText.toLowerCase(); const url = window.location.href.toLowerCase(); let features = isArabic ? [ 'حرارة سيراميك', 'لطيف على الشعر', 'تصفيف سريع', 'ثبات طويل' ] : [ 'Ceramic Heat', 'Hair-Friendly', 'Fast Styling', 'Long Lasting' ]; if (title.includes('5-in-1 ceramic interchangeable set') || title.includes('ceramic interchangeable')) { features = isArabic ? [ '5 ملحقات', 'ستايلات كيرلي مختلفة', 'لطيف على الشعر', 'ثبات طويل' ] : [ '5 Attachments', 'Different Curling Styles', 'Hair Friendly', 'Long Lasting' ]; } if (title.includes('hair dryer brush')) { features = isArabic ? [ 'لمعة ناعمة', 'تجفيف سريع', 'توزيع حرارة متساوي', 'مناسب للاستخدام اليومي' ] : [ 'Shiny Finish', 'Quick Blowout', 'Even Heat Distribution', 'Made for Everyday' ]; } if (title.includes('multifunctional hot air brush')) { features = isArabic ? [ 'تدفق هواء 360°', 'نعومة ولمعان', 'حجم وكثافة للشعر', 'تقليل الهيشان' ] : [ '360° Airflow', 'Smooth Finish', 'Voluminous Hair', 'Frizz Control' ]; } if ( 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' ]; } if (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' ]; } if ( title.includes('wetstyle hot air brush') || title.includes('wet style hot air brush') || title.includes('wetstyle') || url.includes('/p1424109101') ) { 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; font-size:13px; } .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-features{ grid-template-columns:repeat(2,1fr); gap:7px; } .doscher-mini-feature{ font-size:12px; padding:8px 9px; gap:6px; } .doscher-mini-features.doscher-ar .doscher-mini-feature{ font-size:12px; } } `; 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 - 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 doscherProductTagline() { if (document.querySelector('.doscher-product-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 isArabic = doscherIsArabicPage(); const titleEl = document.querySelector('h1'); const title = titleEl ? titleEl.innerText.toLowerCase().trim() : ''; const url = window.location.href.toLowerCase(); let tagline = ''; /* ===================================================== 5-IN-1 CERAMIC INTERCHANGEABLE SET ===================================================== */ if ( title.includes('interchangeable') || title.includes('ceramic curler') || title.includes('ms-c230') || url.includes('/p1680668735') ) { tagline = isArabic ? 'خمس ملحقات لتسريحات لا نهائية. كل ما تحتاجينه لعمل كيرلي بثقة مع الحفاظ على مظهر صحي وناعم لشعرك.' : "Five barrels. Endless styles. Here’s everything you need to curl with confidence — and keep your hair healthy while doing it."; } /* ===================================================== HAIR DRYER BRUSH ===================================================== */ else if ( title.includes('hair dryer brush') || title.includes('fdd-02901') || url.includes('/p2108425307') ) { tagline = isArabic ? 'بدون هيشان، بلمعة ناعمة، وفي وقت أقل. فرشاة تجفيف الشعر مصممة لإطلالة يومية مرتبة ولامعة بدون مجهود زائد.' : "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."; } /* ===================================================== MULTIFUNCTIONAL HOT AIR BRUSH ===================================================== */ else if ( title.includes('multifunctional hot air brush') || url.includes('/p2058064436') ) { tagline = isArabic ? 'من شعر رطب إلى إطلالة جاهزة في خطوة واحدة. فرشاة الهواء متعددة الاستخدام تمنحك نتيجة صالون في البيت بدون وقت طويل أو تكلفة إضافية.' : "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."; } /* ===================================================== 5-IN-1 MULTIFUNCTIONAL HAIR STYLER ===================================================== */ else if ( title.includes('5 in 1 multifunctional hair styler') || title.includes('5-in-1 multifunctional hair styler') || url.includes('/p1638405226') ) { tagline = isArabic ? 'أداة واحدة لكل إطلالة. من الشعر الناعم المفرود إلى الكيرلي الخفيف والبلو أوت الكثيف — روتين التصفيف أصبح أسهل.' : "One tool. Every look. From sleek straight styles to soft curls and voluminous blowouts — this is your entire styling routine simplified."; } /* ===================================================== SMOOTH FLOW CERAMIC FLAT IRON ===================================================== */ else if ( title.includes('smooth flow') || title.includes('flat iron') || url.includes('/p370694303') ) { tagline = isArabic ? 'نعومة، انسيابية، وسهولة في الاستخدام. مصمم لفرد الشعر، وعمل ويفي، وتقليل الهيشان بتمريرة واحدة ناعمة.' : "Smooth, sleek, effortless. Designed to straighten, wave, and tame frizz with one clean glide — without stressing your hair."; } /* ===================================================== WETSTYLE HOT AIR BRUSH ===================================================== */ else if ( title.includes('wetstyle') || title.includes('wet style') || url.includes('/p1424109101') ) { tagline = isArabic ? 'من شعر رطب إلى إطلالة مصففة في خطوة سهلة. تمنحك WetStyle Hot Air Brush شعرًا ناعمًا بكثافة طبيعية مع حرارة أقل ووقت أقل.' : "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."; } if (!tagline) return; const style = document.createElement('style'); style.innerHTML = ` .doscher-product-tagline{ margin-top:14px; margin-bottom:18px; color:#666; font-size:15px; line-height:1.9; max-width:650px; font-weight:400; } .doscher-product-tagline.doscher-ar{ direction:rtl; text-align:right; } @media(max-width:768px){ .doscher-product-tagline{ font-size:14px; line-height:1.8; margin-top:12px; margin-bottom:16px; } } `; document.head.appendChild(style); const text = document.createElement('div'); text.className = 'doscher-product-tagline' + (isArabic ? ' doscher-ar' : ''); text.innerText = tagline; stockBox.insertAdjacentElement('afterend', text); } document.addEventListener('DOMContentLoaded', doscherProductTagline); window.addEventListener('load', doscherProductTagline); setTimeout(doscherProductTagline, 1000); setTimeout(doscherProductTagline, 2000); setTimeout(doscherProductTagline, 3000); })(); /* ===================================================== 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); })();