// add class document.addEventListener("DOMContentLoaded", () => { // اجلب جميع الأقسام (sections) في المتجر const sections = document.querySelectorAll("section"); // أضف class ثابت ومختلف لكل قسم sections.forEach((section, index) => { // أنشئ اسم class جديد const uniqueClass = `section-${index + 1}`; // أضف الـ class إلى القسم section.classList.add(uniqueClass); }); }); /*/////////////////////// موشن الحركه يين كل سيشكن والتاين /////////////*/ document.addEventListener("DOMContentLoaded", function () { // إضافة التنسيقات داخل JavaScript const style = document.createElement("style"); style.textContent = ` .s-block { opacity: 0; transform: translateY(30px) scale(0.95); transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1); will-change: opacity, transform; } .s-block.appear { opacity: 1; transform: translateY(0) scale(1); } `; document.head.appendChild(style); function handleVisibility(elements, className) { const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add(className); } else { entry.target.classList.remove(className); resetAnimation(entry.target); } }); }, { threshold: 0.1 }); elements.forEach((element) => observer.observe(element)); } function resetAnimation(element) { element.style.animation = "none"; element.offsetHeight; element.style.animation = ""; } handleVisibility(document.querySelectorAll(".s-block"), "appear"); const blockObserver = new MutationObserver(() => { handleVisibility(document.querySelectorAll(".s-block:not(.appear)"), "appear"); }); blockObserver.observe(document.body, { childList: true, subtree: true }); }); /* Add custom Js code below */ (function () { function injectPreloader() { // 1. إنشاء عنصر preloader وإضافة محتواه const preloader = document.createElement("div"); preloader.className = "preloader"; preloader.innerHTML = `
Loading...
`; document.body.prepend(preloader); // 2. إنشاء عنصر `; e.appendChild(n); e.appendChild(i); document.body.appendChild(e); document.body.appendChild(t); n.onclick=r; t.onclick=r; setTimeout(()=>{ document.querySelectorAll(".s-product-card-entry").forEach((n)=>{ if(n.querySelector(".quick-view-btn")) return; const r=document.createElement("button"); r.className="quick-view-btn"; r.innerHTML="👁️"; r.style.cssText=` padding: 0px; cursor: pointer; background: transparent; color: #fff; border-radius: 30%; font-size: 14px; width: 37px; height: 30px; transition: background 0.3s; display: flex; justify-content: center; align-items: center; border: 2px solid #eee; `; r.addEventListener("mouseenter",()=>{r.style.background="#1a252f"}); r.addEventListener("mouseleave",()=>{r.style.background="#2c3e50"}); r.onclick=async ev=>{ ev.preventDefault(); ev.stopPropagation(); const d=n.querySelector("a")?.href; if(d){ i.innerHTML=""; i.appendChild(o); e.style.display="block"; t.style.display="block"; try{ const e2=await fetch(d); const t2=await e2.text(); const n2=new DOMParser().parseFromString(t2,"text/html"); const o2=n2.querySelector("h1")?.textContent.trim()||"بدون عنوان"; let r2=""; const c=n2.querySelector(".price-wrapper"); if(c){ const e3=c.querySelector(".total-price:not(.hidden)")||c.querySelector(".total-price"); if(e3) r2=e3.textContent.trim(); } const s=n2.querySelector(".product__description")?.innerHTML||"لا يوجد وصف متوفر."; const a=n2.querySelector(".details-slider img")?.src; const l=[...n2.querySelectorAll(".s-slider-thumbs img")].map(e=>e.src); const p=n2.querySelector(".s-product-options-option-container")?.outerHTML||""; const u=n2.querySelector("form.product-form")?.outerHTML||""; i.innerHTML=`
${a?`
${l.map(e=>``).join("")}
`:""}

${o2}

${r2?`
${r2}
`:""}
${s}
${p} ${u} عرض كامل المنتج
`; }catch(err){ console.error(err); i.innerHTML="

حدث خطأ أثناء التحميل

"; } } }; /* ================================================= التعديل الوحيد: مكان زر العين فقط ================================================= */ const footer = n.querySelector(".s-product-card-content-footer"); if(footer){ footer.appendChild(r); } }); },3000); }));