/* Add custom Js styles below */ //------------شغال----------صفقة اليوم------------------ /* document.addEventListener("DOMContentLoaded", function() { // Get the current time var currentTime = new Date().getTime(); // Get the last time the popup was shown from localStorage var lastPopupTime = localStorage.getItem("lastPopupTime"); // Calculate the time difference in minutes var timeDiff = (currentTime - lastPopupTime) / (1000 * 60); // Check if the popup has been closed before and if 3 minutes have passed since the last time if (!lastPopupTime || timeDiff > 7) { // Create the popup element var popup = document.createElement("div"); popup.classList.add("popup-container"); popup.innerHTML = ` `; // Append the popup to the body document.body.appendChild(popup); // Function to close the popup and set the flag in localStorage function closePopup() { popup.style.display = "none"; localStorage.setItem("popupClosed", "true"); // Store the current time as the last popup time localStorage.setItem("lastPopupTime", currentTime); } // Automatically close the popup after 5 seconds setTimeout(closePopup, 6000); // Close the popup when the close button is clicked popup.querySelector(".close-btn").addEventListener("click", closePopup); // Close the popup and redirect when the offer button is clicked popup.querySelector(".offer-btn").addEventListener("click", function(e) { closePopup(); window.location.href = this.href; e.preventDefault(); // Prevent the default link action to avoid reopening the popup }); } }); */ //---------------------للنجوم------------------- 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 = '(6932 تقييمات)'; // عدد المقييمين productRating.appendChild(ratingCount); container.insertBefore(productRating, container.firstChild); }); //-- الزر الثابت والنافذة المنبثقة ---------- // إنشاء الزر الثابت 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); // توضيح النص للملاحظات function waitForElement(selector, callback) { let element = document.querySelector(selector); if (element) { callback(element); } else { let observer = new MutationObserver(function(mutations, observer) { let element = document.querySelector(selector); if (element) { observer.disconnect(); callback(element); } }); observer.observe(document.body, { childList: true, subtree: true }); } } document.addEventListener("DOMContentLoaded", function() { waitForElement("b.block", function(label) { if (label.textContent.includes("المرفقات")) { label.innerHTML += ' ( اكتب نص الإهداء هنا )'; } }); });