//----- الزر الثابت والنافذة المنبثقة ----------- // إنشاء الزر الثابت let fixedButton = document.createElement("div"); fixedButton.className = "fixed-button"; fixedButton.innerText = "الأكثر مبيعًا لدينا!"; // نص الزر fixedButton.onclick = function() { document.querySelector(".popup-overlay").style.display = "block"; }; document.body.appendChild(fixedButton); // إنشاء النافذة المنبثقة let popupOverlay = document.createElement("div"); popupOverlay.className = "popup-overlay"; popupOverlay.onclick = function(event) { if (event.target === popupOverlay) { popupOverlay.style.display = "none"; } }; popupOverlay.innerHTML = ` `; document.body.appendChild(popupOverlay); /* //----------------الجمعه البيضاء------- // إنشاء الزر الثابت let fixedButton = document.createElement("div"); fixedButton.className = "fixed-button"; fixedButton.innerText = "اكتشف عرض الجمعة البيضاء!"; // نص الزر fixedButton.onclick = function() { document.querySelector(".popup-overlay").style.display = "block"; }; document.body.appendChild(fixedButton); // إنشاء النافذة المنبثقة let popupOverlay = document.createElement("div"); popupOverlay.className = "popup-overlay"; popupOverlay.onclick = function(event) { if (event.target === popupOverlay) { popupOverlay.style.display = "none"; } }; popupOverlay.innerHTML = ` `; document.body.appendChild(popupOverlay); */ /* //------------------الاشعارات-------------- document.addEventListener("DOMContentLoaded", function() { const notifications = [ { text: "طلب جديد", product: "شماغ ملكي خاص - احمر دم غزال", time: "منذ 5 دقائق", location: "من الرياض", image: "https://imgur.com/EBxvxrX.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - احمر فاتح", time: "منذ 15 دقائق", location: "من جدة", image: "https://imgur.com/FTndShH.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - ابيض", time: "منذ 30 دقيقة", location: "من الدمام", image: "https://imgur.com/FODVnpM.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - احمر دم غزال", time: "منذ ساعة", location: "من مكة", image: "https://imgur.com/EBxvxrX.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - احمر فاتح", time: "منذ دقيقة", location: "من الطائف", image: "https://imgur.com/FTndShH.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - ابيض", time: "منذ 3 ساعات", location: "من أبها", image: "https://imgur.com/FODVnpM.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - احمر دم غزال", time: "منذ 7 ساعات", location: "من الباحة", image: "https://imgur.com/EBxvxrX.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - احمر فاتح", time: "منذ ساعة", location: "من القصيم", image: "https://imgur.com/FTndShH.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - ابيض", time: "منذ 6 ساعات", location: "من الجوف", image: "https://imgur.com/FODVnpM.png" }, { text: "طلب جديد", product: "شماغ ملكي خاص - احمر دم غزال", time: "منذ 12 ساعات", location: "من نجران", image: "https://imgur.com/EBxvxrX.png" } ]; // عرض الرسالة عشوائيًا كل فترة معينة setInterval(() => { // اختيار رسالة عشوائية من المصفوفة const randomIndex = Math.floor(Math.random() * notifications.length); const randomNotification = notifications[randomIndex]; // إنشاء عنصر الرسالة const notification = document.createElement("div"); notification.className = "notification"; // إضافة صورة المنتج const img = document.createElement("img"); img.src = randomNotification.image; // تعيين الصورة من الكائن img.alt = "Product Image"; // إنشاء المحتوى النصي const content = document.createElement("div"); content.className = "content"; const title = document.createElement("p"); title.className = "title"; title.textContent = `${randomNotification.text}\n ${randomNotification.product}`; const time = document.createElement("p"); time.className = "time"; time.textContent = randomNotification.time; const footer = document.createElement("p"); footer.className = "footer"; footer.textContent = randomNotification.location; // إضافة زر الإغلاق const closeButton = document.createElement("button"); closeButton.className = "close-btn"; closeButton.innerHTML = "×"; closeButton.addEventListener("click", function() { notification.remove(); }); // إضافة المحتوى إلى الرسالة content.appendChild(title); content.appendChild(time); content.appendChild(footer); notification.appendChild(img); notification.appendChild(content); notification.appendChild(closeButton); // إضافة الرسالة إلى الصفحة document.body.appendChild(notification); // جعل الرسالة تظهر لمدة محددة ثم تختفي تلقائيًا setTimeout(() => { notification.remove(); }, 9000); // تختفي بعد 8 ثوانٍ }, 20000); // يظهر إشعار جديد كل 10 ثوانٍ }); */ //---------------------للنجوم------------------- document.addEventListener('DOMContentLoaded', function() { var containers = document.getElementsByClassName('flex items-center justify-between mb-5'); var container = containers[0]; var productRating = document.createElement('div'); productRating.classList.add('product-rating'); var stars = document.createElement('div'); stars.classList.add('stars'); var rating = 5; // تقييم المنتج من 5 for (var i = 1; i <= 5; i++) { var star = document.createElement('span'); star.classList.add('star'); star.innerHTML = (i <= rating) ? '★' : '☆'; if (i > rating) { star.classList.add('empty'); } stars.appendChild(star); } productRating.appendChild(stars); var ratingCount = document.createElement('div'); ratingCount.classList.add('rating-count'); ratingCount.innerHTML = '(10932 تقييمات)'; // عدد المقييمين productRating.appendChild(ratingCount); container.insertBefore(productRating, container.firstChild); });