document.querySelectorAll("custom-salla-product-card").forEach(card=>{ card.addEventListener("mousemove",e=>{ const rect=card.getBoundingClientRect(); const x=e.clientX-rect.left; const y=e.clientY-rect.top; const rotateY=((x/rect.width)-0.5)*10; const rotateX=((0.5-y/rect.height))*10; card.style.transform= `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateY(-6px)`; }); card.addEventListener("mouseleave",()=>{ card.style.transform= "perspective(1000px) rotateX(0) rotateY(0)"; }); }); document.addEventListener("DOMContentLoaded", () => { function toNumber(text) { return Number( text .replace(/[٠-٩]/g, d => "٠١٢٣٤٥٦٧٨٩".indexOf(d)) .replace(/[^\d]/g, "") ); } const unavailableText = document.body.innerText; // إذا المنتج غير متوفر أو نفدت الكمية لا تعرض الشارة if ( unavailableText.includes("نفدت الكمية") || unavailableText.includes("غير متوفر") || unavailableText.includes("غير متاح") ) { return; } document.querySelectorAll(".product-price-sale").forEach(priceBox => { if (priceBox.parentElement.querySelector(".aufuk-save")) return; const current = priceBox.querySelector("p"); const old = priceBox.querySelector("span.line-through"); if (!current || !old) return; const currentPrice = toNumber(current.textContent); const oldPrice = toNumber(old.textContent); if ( !currentPrice || !oldPrice || oldPrice <= currentPrice ) return; const save = oldPrice - currentPrice; const badge = document.createElement("div"); badge.className = "aufuk-save"; badge.innerHTML = `وفر ${save} ريال🔥`; priceBox.parentElement.appendChild(badge); }); }); document.addEventListener("DOMContentLoaded", () => { const phone = "966541593969"; // اكتب رقمك const text = "السلام عليكم"; const style = document.createElement("style"); style.innerHTML = ` #az-wa{ position:fixed; right:18px; bottom:18px; z-index:999999; } #az-wa a{ width:52px; height:52px; background:#25D366; border-radius:50%; display:flex; align-items:center; justify-content:center; box-shadow:0 10px 30px rgba(37,211,102,.35); transition:.25s; } #az-wa a:hover{ transform:scale(1.08); } #az-wa svg{ width:28px; height:28px; fill:#fff; } #az-close{ position:absolute; top:-6px; left:-6px; width:18px; height:18px; border-radius:50%; background:#fff; color:#666; font-size:12px; display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 2px 8px rgba(0,0,0,.15); } `; document.head.appendChild(style); document.body.insertAdjacentHTML("beforeend",`
`); document.getElementById("az-close").onclick=function(){ document.getElementById("az-wa").remove(); }; });