document.addEventListener('DOMContentLoaded', function () { const socialHTML = `
متاح الآن - نرد خلال دقيقة
مرحباً! 👋
كيف يمكننا مساعدتك اليوم؟ فريقنا جاهز للرد على جميع استفساراتك.
⚡ فريق الدعم
${previewText}
`; // إنشاء محتوى الصندوق const content = document.createElement('div'); content.className = 'product-features-content'; // نقل المحتوى الأصلي if (article) { content.appendChild(article); } // مسح المحتوى القديم وإضافة الجديد descriptionContainer.innerHTML = ''; descriptionContainer.appendChild(header); descriptionContainer.appendChild(preview); descriptionContainer.appendChild(content); // إضافة وظيفة الفتح والإغلاق header.addEventListener('click', function () { header.classList.toggle('collapsed'); content.classList.toggle('expanded'); preview.classList.toggle('hidden'); }); // إزالة ستايل الإخفاء المؤقت const tempHide = document.getElementById('temp-hide-description'); if (tempHide) { tempHide.remove(); } } }, 100); // تقليل التأخير إلى 100ms فقط }); document.addEventListener('DOMContentLoaded', function () { var CART_URL = '/cart'; var REMOVE_ALERT_DURATION = 5000; var _removing = false; // ════════════════════════════════════════ // 1 — Toast إضافة المنتج (SweetAlert2) // ════════════════════════════════════════ var swalObserver = new MutationObserver(function (mutations) { mutations.forEach(function (m) { m.addedNodes.forEach(function (node) { if (node.nodeType !== 1) return; var toast = node.classList && node.classList.contains('swal2-toast') ? node : node.querySelector && node.querySelector('.swal2-toast'); if (!toast || toast.dataset.ci) return; toast.dataset.ci = '1'; if (_removing) { setTimeout(function () { var c = toast.closest('.swal2-container'); if (c) c.remove(); else toast.remove(); }, 20); return; } setTimeout(function () { buildAddToast(toast); }, 60); }); }); }); swalObserver.observe(document.body, { childList: true, subtree: true }); function buildAddToast(toast) { var name = getProductName(); var header = document.createElement('div'); header.className = 'cart-toast-header'; header.innerHTML = '' + '