document.addEventListener("DOMContentLoaded", function () { // العثور على العنصر الذي يحتوي على الوزن let weightElement = document.querySelector(".text-sm.text-store-text-secondary"); if (weightElement) { // استبدال "جم" بـ "lg" weightElement.textContent = weightElement.textContent.replace("جم", "مل"); } }); document.addEventListener("DOMContentLoaded", function () { // العثور على العنصر الذي يحتوي على "الوزن" let weightLabel = document.querySelector(".text-store-text-primary span"); if (weightLabel && weightLabel.textContent.trim() === "الوزن") { // استبدال النص بـ "الحجم" weightLabel.textContent = "الحجم"; } }); document.addEventListener("DOMContentLoaded", function () { setTimeout(() => { // Selecting main titles const mainTitle2 = document.querySelector('.fixed-products--1 h2'); const mainTitle3 = document.querySelector('.fixed-products--3 h2'); const mainTitle4 = document.querySelector('.fixed-products--5 h2'); // Creating subtitles const subtitles = [ { element: mainTitle2, text: 'كتطريز النجوم وعذوبة الورد ورقة الندى' }, { element: mainTitle3, text: 'مشاعر تضج وسط زجاجة ليكن سكونها في القلب' }, { element: mainTitle4, text: 'روائح عطرية كأعزوفة ملكيـة' } ]; // Inserting subtitles subtitles.forEach(({ element, text }) => { if (element) { const subtitle = document.createElement('h3'); subtitle.textContent = text; subtitle.style.fontSize = '1rem'; subtitle.style.fontWeight = '400'; subtitle.style.color = 'rgb(82 49 7)'; subtitle.style.textAlign = 'center'; element.parentNode.insertBefore(subtitle, element.nextSibling); } }); }, 500); // إضافة تأخير صغير لضمان تحميل العناصر // تعديل الفوتر const footerRights = document.querySelector('.footer-bottom .footer-rights'); if (footerRights) { const poweredBySpan = document.createElement("span"); poweredBySpan.innerHTML = 'Powered by TARA'; footerRights.insertAdjacentElement("beforebegin", poweredBySpan); } else { console.error("⚠️ لم يتم العثور على عنصر 'footer-rights'"); } // إنشاء مراقب لمتابعة التغييرات في DOM const observer = new MutationObserver(() => { // البحث عن العنصر المستهدف const tabbyPromoWrapper = document.getElementById('tabbyPromoWrapper'); if (tabbyPromoWrapper) { // إنشاء العنصر الجديد const newDiv = document.createElement('div'); newDiv.className = 'customPromoSnippet'; newDiv.innerHTML = `
خصم 5% على عطرك المفضل عند الدفع بـ Apple Pay أو مدى! 🎉
`; // إضافة العنصر الجديد بعد العنصر المستهدف tabbyPromoWrapper.parentNode.insertBefore(newDiv, tabbyPromoWrapper.nextSibling); // تعريف وظيفة النسخ const copyButton = newDiv.querySelector('#copyButton'); copyButton.addEventListener('click', () => { navigator.clipboard.writeText(' GF5').then(() => { // تغيير نص الزر وجعله غير قابل للنقر copyButton.textContent = 'تم النسخ بنجاح'; copyButton.disabled = true; }).catch(err => { console.error('فشل النسخ:', err); }); }); // إيقاف مراقبة DOM observer.disconnect(); } }); // بدء مراقبة DOM observer.observe(document.body, { childList: true, subtree: true }); });