(function() { // CSS البوب أب const style = document.createElement('style'); style.innerHTML = ` #shippingPopup { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); justify-content:center; align-items:center; z-index:9999; } #shippingPopup.show { display:flex; } #shippingPopup > .popup-box { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 20px; padding: 40px 30px; max-width: 450px; width: 90%; text-align:center; position:relative; transform: scale(0.7); transition: transform 0.3s ease; } #shippingPopup.show > .popup-box { transform: scale(1); } #shippingPopup .close-btn { position:absolute; top:15px; left:15px; background: rgba(255,255,255,0.2); border:none; width:35px; height:35px; border-radius:50%; cursor:pointer; color:white; font-size:20px; display:flex; justify-content:center; align-items:center; transition: all 0.3s ease; } #shippingPopup .close-btn:hover { background: rgba(255,255,255,0.3); transform: rotate(90deg); } #shippingPopup .shipping-icon { font-size:60px; margin-bottom:20px; animation:bounce 2s infinite; } @keyframes bounce { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-10px); } } #shippingPopup .popup-title { color:white; font-size:28px; font-weight:bold; margin-bottom:15px; text-shadow:2px 2px 4px rgba(0,0,0,0.2); } #shippingPopup .popup-message { color:white; font-size:18px; line-height:1.6; margin-bottom:25px; } #shippingPopup .popup-message b { font-size:24px; color:#ffd700; text-shadow:1px 1px 2px rgba(0,0,0,0.3); } #shippingPopup .shop-btn { background:white; color:#667eea; border:none; padding:15px 40px; border-radius:50px; font-size:18px; font-weight:bold; cursor:pointer; transition: all 0.3s ease; box-shadow:0 4px 15px rgba(0,0,0,0.2); } #shippingPopup .shop-btn:hover { transform: translateY(-3px); box-shadow:0 6px 20px rgba(0,0,0,0.3); } `; document.head.appendChild(style); // دالة إنشاء البوب أب function insertPopup() { if(document.getElementById('shippingPopup')) return; // لو موجود لا تضيف const popupHTML = `
`; document.body.insertAdjacentHTML('beforeend', popupHTML); const popup = document.getElementById('shippingPopup'); const closeBtn = document.getElementById('closePopupBtn'); const shopBtn = document.getElementById('shopBtn'); function showPopup() { popup.classList.add('show'); } function closePopup() { popup.classList.remove('show'); } closeBtn.addEventListener('click', closePopup); shopBtn.addEventListener('click', closePopup); popup.addEventListener('click', function(e){ if(e.target === this) closePopup(); }); document.addEventListener('keydown', function(e){ if(e.key === 'Escape') closePopup(); }); setTimeout(showPopup, 2000); // يظهر بعد ثانيتين } // مراقبة DOM ديناميكية على عنصر ملخص السلة const observer = new MutationObserver(function(mutations, obs) { if(document.querySelector('.salla-cart-summary .s-cart-summary-total')) { insertPopup(); obs.disconnect(); // نوقف المراقبة بعد الإضافة } }); observer.observe(document.body, {childList:true, subtree:true}); })();