/* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ /* Add custom Js styles below */ // ===================== اضافة فيديو للصفحة ===================== const SECTION_POSITION = 12; // const VIDEO_SRC = "https://files.catbox.moe/a4p05y.mp4"; // const VIDEO_LINK = "#"; // رابط عند الضغط // ==================================================== (function() { if (!document.body.classList.contains("index")) return; const style = document.createElement("style"); style.textContent = ` .custom-video-banner { font-size: 16px; margin: 30px 0; } .custom-video-banner .container { font-size: 16px; max-width: 1200px; margin: 0 auto; } .custom-video-banner .banner { display: block; overflow: hidden; border-radius: 12px; box-shadow: none; } .custom-video-banner video { width: auto; height: auto; display: block; border-radius: 12px; object-fit: cover; margin: 0 auto; } @media (max-width: 768px) { .custom-video-banner { font-size: 14px; margin: 20px 0; } .custom-video-banner .container { padding: 0 10px; } .custom-video-banner video { width: 100%; height: auto; } } `; document.head.appendChild(style); const section = document.createElement("section"); section.className = "custom-video-banner s-block s-block--fixed-banner wide-placeholder appear"; section.innerHTML = `
`; const sections = document.querySelectorAll("section"); if (sections.length >= SECTION_POSITION) { sections[SECTION_POSITION - 1].insertAdjacentElement("afterend", section); } else { // fallback -> لو مفيش سكشن كفاية نحطه آخر الصفحة document.body.appendChild(section); } const video = section.querySelector("video"); if (video) { video.muted = true; video.setAttribute("playsinline", ""); video.setAttribute("webkit-playsinline", ""); video.play().catch(err => { console.log("Autoplay blocked:", err); }); } })(); //////////////////////* stars*///////////////////// function addStarsOnly() { const cards = document.querySelectorAll('.s-product-card-entry'); if (cards.length === 0) return; cards.forEach((card) => { if (card.querySelector('.product-rating')) return; // ⭐ تقييم النجوم const stars = document.createElement('div'); stars.className = 'product-rating'; const rating = Math.floor(Math.random() * 2) + 4; for (let i = 0; i < 5; i++) { const star = document.createElement('span'); star.innerHTML = i < rating ? '★' : '☆'; stars.appendChild(star); } stars.style.color = '#FFD700'; stars.style.fontSize = '18px'; stars.style.margin = '6px 0'; card.querySelector('.s-product-card-content-main')?.appendChild(stars); }); } // تنفيذ الكود بعد تحميل الصفحة أو ظهور العناصر let starTryCount = 0; const starInterval = setInterval(() => { addStarsOnly(); starTryCount++; if (starTryCount > 10) clearInterval(starInterval); }, 1000); //////////////////////* stars*///////////////////// ////////////////////////faq*/////////////////// document.addEventListener("DOMContentLoaded", () => { // ====== جلب الألوان من :root ====== const rootStyles = getComputedStyle(document.documentElement); const mainColor = rootStyles.getPropertyValue("--main-color").trim(); const secondColor = rootStyles.getPropertyValue("--second-color").trim(); // ====== زر "اسأل" العائم ====== const askBtn = document.createElement("div"); askBtn.innerText =" الأسئلة الشائعة 💬"; Object.assign(askBtn.style, { position: "fixed", bottom: "100px", left: "20px", background: mainColor, color: "#fff", padding: "12px 18px", borderRadius: "30px", cursor: "pointer", fontWeight: "bold", fontSize: "16px", boxShadow: "0 4px 12px rgba(0,0,0,0.3)", backdropFilter: "blur(4px)", transition: "background 0.3s", zIndex: "1001", }); askBtn.addEventListener("mouseenter", () => { askBtn.style.background = mainColor; });secondColor askBtn.addEventListener("mouseleave", () => { askBtn.style.background = mainColor; }); // ====== Overlay ====== const overlay = document.createElement("div"); Object.assign(overlay.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", background: "rgba(0,0,0,0.4)", backdropFilter: "blur(3px)", display: "none", zIndex: "1000", }); // ====== صندوق الأسئلة ====== const faqBox = document.createElement("div"); Object.assign(faqBox.style, { position: "fixed", bottom: "160px", left: "20px", width: "320px", background: "rgba(215, 196, 182, 0.95)", borderRadius: "16px", boxShadow: "0 8px 25px rgba(0,0,0,0.35)", display: "none", flexDirection: "column", fontFamily: "Tahoma, sans-serif", zIndex: "1002", overflow: "hidden", backdropFilter: "blur(8px)", }); // ====== الهيدر ====== const header = document.createElement("div"); header.innerText = "💬 الأسئلة الشائعة"; Object.assign(header.style, { background: mainColor, color: "#fff", padding: "12px", fontSize: "18px", fontWeight: "bold", display: "flex", justifyContent: "space-between", alignItems: "center", boxShadow: "0 2px 6px rgba(0,0,0,0.2)", }); const closeBtn = document.createElement("span"); closeBtn.innerText = "❌"; Object.assign(closeBtn.style, { cursor: "pointer", fontSize: "16px", }); header.appendChild(closeBtn); faqBox.appendChild(header); // ====== محتوى الأسئلة ====== const faqContent = document.createElement("div"); Object.assign(faqContent.style, { padding: "10px", maxHeight: "300px", overflowY: "auto", }); const faqData = [ { question: "ما هي خيارات الدفع المتوفرة؟", answer: "يمكنك الدفع باستخدام مدى، البطاقات الائتمانية، Apple Pay، Stc Pay.", }, { question: "كم يستغرق توصيل الطلب؟", answer: "عادةً ما يتم توصيل الطلبات خلال 7 - 14 يوم عمل.", }, { question: "هل يمكنني استرجاع المنتجات؟", answer: "نعم، يمكنك استرجاع المنتجات خلال 7 أيام من استلامها وفقًا لسياسة الإرجاع.", }, ]; faqData.forEach(({ question, answer }) => { const qBtn = document.createElement("div"); qBtn.innerText = question; Object.assign(qBtn.style, { padding: "10px", margin: "5px 0", background: mainColor, color: "#fff", borderRadius: "8px", cursor: "pointer", fontWeight: "bold", boxShadow: "0 2px 6px rgba(0,0,0,0.2)", transition: "background 0.3s", }); qBtn.addEventListener("mouseenter", () => { qBtn.style.background = mainColor; }); qBtn.addEventListener("mouseleave", () => { qBtn.style.background = mainColor; }); const ans = document.createElement("div"); ans.innerText = answer; Object.assign(ans.style, { display: "none", padding: "8px", fontSize: "14px", color: mainColor, background: "#fff", borderRadius: "6px", marginTop: "5px", boxShadow: "inset 0 1px 4px rgba(0,0,0,0.1)", }); qBtn.addEventListener("click", () => { ans.style.display = ans.style.display === "none" ? "block" : "none"; }); faqContent.appendChild(qBtn); faqContent.appendChild(ans); }); faqBox.appendChild(faqContent); // ====== ربط العناصر ====== document.body.appendChild(overlay); document.body.appendChild(askBtn); document.body.appendChild(faqBox); // ====== إظهار/إخفاء ====== askBtn.addEventListener("click", () => { overlay.style.display = "block"; faqBox.style.display = "flex"; }); closeBtn.addEventListener("click", () => { overlay.style.display = "none"; faqBox.style.display = "none"; }); overlay.addEventListener("click", () => { overlay.style.display = "none"; faqBox.style.display = "none"; }); }); ////////////////////////faq*/////////////////// document.addEventListener("DOMContentLoaded", () => { // إنشاء سكشن const section = document.createElement("section"); section.style.textAlign = "center"; section.style.padding = "3rem 1rem"; section.style.fontFamily = "Cairo, sans-serif"; section.style.backgroundColor = "#f9f9f9"; // العنوان const title = document.createElement("h2"); title.innerText = "لماذا تختارنا؟"; Object.assign(title.style, { color: "#213655", fontSize: "1.8rem", marginBottom: "2rem", }); section.appendChild(title); // الحاوية الرئيسية const container = document.createElement("div"); Object.assign(container.style, { display: "flex", justifyContent: "center", alignItems: "center", flexWrap: "wrap", gap: "1rem", }); section.appendChild(container); // البيانات const data = [ { icon: "💬", text: "دعم فني 24/7" }, { icon: "🚚", text: "350 طلب مكتمل" }, { icon: "👍", text: "300 عميل سعيد" }, ]; // دالة لتحديد حجم البطاقة حسب حجم الشاشة function getCardSize() { if (window.innerWidth <= 480) { // موبايل return { width: "110px", height: "100px", fontSize: "0.8rem", iconSize: "1.6rem" }; } else if (window.innerWidth <= 768) { // تابلت return { width: "130px", height: "110px", fontSize: "0.9rem", iconSize: "1.8rem" }; } else { // كمبيوتر return { width: "140px", height: "120px", fontSize: "0.9rem", iconSize: "1.8rem" }; } } // إنشاء البطاقات data.forEach((item) => { const size = getCardSize(); const card = document.createElement("div"); Object.assign(card.style, { width: size.width, height: size.height, background: "#fff", borderRadius: "12px", display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", boxShadow: "0 6px 15px rgba(0,0,0,0.1)", transition: "transform 0.3s ease, box-shadow 0.3s ease", }); // تأثير عند المرور بالماوس card.addEventListener("mouseenter", () => { card.style.transform = "translateY(-6px)"; card.style.boxShadow = "0 10px 20px rgba(0,0,0,0.15)"; }); card.addEventListener("mouseleave", () => { card.style.transform = "translateY(0)"; card.style.boxShadow = "0 6px 15px rgba(0,0,0,0.1)"; }); // الأيقونة const icon = document.createElement("div"); icon.innerText = item.icon; icon.style.fontSize = size.iconSize; icon.style.marginBottom = "0.4rem"; // النص const text = document.createElement("p"); text.innerText = item.text; text.style.fontSize = size.fontSize; text.style.color = "#213655"; text.style.margin = "0"; card.appendChild(icon); card.appendChild(text); container.appendChild(card); }); // تحديث الحجم عند تغيير عرض الشاشة window.addEventListener("resize", () => { const cards = container.querySelectorAll("div"); cards.forEach((card, index) => { const size = getCardSize(); card.style.width = size.width; card.style.height = size.height; card.querySelector("div").style.fontSize = size.iconSize; card.querySelector("p").style.fontSize = size.fontSize; }); }); // إدراج قبل الفوتر const footer = document.querySelector("footer"); if (footer) { footer.parentNode.insertBefore(section, footer); } else { document.body.appendChild(section); } }); const whatsappNumber = "+966531635114"; // Throttle function لتقليل تكرار تنفيذ الأحداث function throttle(func, limit) { let inThrottle; return function (...args) { if (!inThrottle) { func.apply(this, args); inThrottle = true; setTimeout(() => (inThrottle = false), limit); } }; } document.addEventListener("DOMContentLoaded", function () { // إزالة النص البديل (alt) من صورة الشعار const imgElement = document.querySelector(".navbar-brand img"); if (imgElement) imgElement.removeAttribute("alt"); // تغيير نصوص جهات الاتصال setTimeout(() => { const whats = document.querySelector( ".s-contacts-list-vertical > div:nth-of-type(1) a > span:nth-of-type(2)" ); if (mobile) mobile.textContent = "جوال"; const email = document.querySelector( ".s-contacts-list-vertical > div:nth-of-type(3) a > span:nth-of-type(2)" ); if (whats) whats.textContent = "واتساب"; const mobile = document.querySelector( ".s-contacts-list-vertical > div:nth-of-type(2) a > span:nth-of-type(2)" ); if (email) email.textContent = "ايميل"; // تحسين أنماط جهات الاتصال const contactsList = document.querySelector(".s-contacts-list-vertical"); if (contactsList) { Object.assign(contactsList.style, { flexDirection: "row", justifyContent: "center", gap: "20px", alignItems: "center", }); } const contactSlot = document.querySelector("#contact-slot"); if (contactSlot) { Object.assign(contactSlot.style, { backgroundColor: "transparent", padding: "20px", borderRadius: ".375rem", display: "flex", justifyContent: "center", alignItems: "center", }); } const contactItems = document.querySelectorAll(".s-contacts-item"); contactItems.forEach((item) => { Object.assign(item.style, { display: "flex", flexDirection: "column", alignItems: "center", gap: "10px", }); }); const contactIcons = document.querySelectorAll(".s-contacts-icon"); contactIcons.forEach((icon) => { Object.assign(icon.style, { marginRight: "auto", marginLeft: "auto", border: "none", boxShadow: "0 4px 8px rgba(0, 0, 0, 0.2)", transform: "perspective(500px) rotateY(10deg)", transition: "transform 0.3s, box-shadow 0.3s", width: "50px", height: "50px", borderRadius: "50%", backgroundColor: "#EEEEEE", }); icon.addEventListener("mouseover", () => { Object.assign(icon.style, { transform: "perspective(500px) rotateY(20deg)", boxShadow: "0 8px 16px rgba(0, 0, 0, 0.3)", }); }); icon.addEventListener("mouseout", () => { Object.assign(icon.style, { transform: "perspective(500px) rotateY(10deg)", boxShadow: "0 4px 8px rgba(0, 0, 0, 0.2)", }); }); }); }, 1000); // إصلاح صور طرق الدفع const paymentImages = document.querySelectorAll(".s-payments-list img.lazy"); const fallbackImages = [ "https://i.postimg.cc/m2n1HWj3/Mada-Logo-svg.png", "https://i.postimg.cc/Dy4yRJQs/Visa-Logo-2006.png", "https://i.postimg.cc/52q1MwXH/apple-pay-og-twitter.jpg", "https://saudipedia.com/saudipedia/uploads/images/2023/12/14/84660.jpg", "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/Google_Pay_Logo.svg/640px-Google_Pay_Logo.svg.png", "https://example.com/path/to/cod-image.png", ]; paymentImages.forEach((img, index) => { if (img.src === "undefined" || img.classList.contains("error")) { img.src = fallbackImages[index] || fallbackImages[0]; img.setAttribute("loading", "lazy"); img.classList.remove("error"); img.setAttribute("data-ll-status", "loaded"); } }); const invalidImages = document.querySelectorAll( '.s-payments-list img[src="undefined"]' ); invalidImages.forEach((img) => img.remove()); }); // إضافة أيقونة التمرير للأعلى const scrollIcon = document.createElement("div"); scrollIcon.id = "scroll-icon"; Object.assign(scrollIcon.style, { position: "fixed", bottom: "100px", right: "23px", width: "50px", height: "50px", display: "none", alignItems: "center", justifyContent: "center", cursor: "pointer", zIndex: "1000", }); const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("viewBox", "0 0 36 36"); Object.assign(svg.style, { width: "100%", height: "100%", transform: "rotate(-90deg)", }); const circleBg = document.createElementNS("http://www.w3.org/2000/svg", "path"); circleBg.setAttribute( "d", "M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" ); Object.assign(circleBg.style, { fill: "none", stroke: "#000", strokeWidth: "3.8", }); const circle = document.createElementNS("http://www.w3.org/2000/svg", "path"); circle.setAttribute( "d", "M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" ); Object.assign(circle.style, { fill: "none", stroke: "#c8aa88", strokeWidth: "3.8", strokeLinecap: "round", transition: "stroke-dasharray 0.3s ease", }); svg.appendChild(circleBg); svg.appendChild(circle); const arrow = document.createElement("div"); arrow.textContent = "↑"; Object.assign(arrow.style, { position: "absolute", fontSize: "22px", fontWeight: "bold", color: "#000", pointerEvents: "none", }); scrollIcon.appendChild(svg); scrollIcon.appendChild(arrow); document.body.appendChild(scrollIcon); window.addEventListener( "scroll", throttle(() => { const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; const scrollHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight; const scrollPercentage = (scrollTop / scrollHeight) * 100; circle.style.strokeDasharray = `${scrollPercentage}, 100`; scrollIcon.style.display = scrollTop > 300 ? "flex" : "none"; }, 100) ); scrollIcon.addEventListener("click", () => { window.scrollTo({ top: 0, behavior: "smooth" }); }); // حفظ واستعادة موضع التمرير window.addEventListener("beforeunload", () => { const currentPage = window.location.pathname; localStorage.setItem(`scrollPosition-${currentPage}`, window.scrollY); }); window.addEventListener("load", () => { const currentPage = window.location.pathname; const scrollPosition = localStorage.getItem(`scrollPosition-${currentPage}`); if (scrollPosition) window.scrollTo(0, scrollPosition); }); // إضافة واتساب عائم const whatsappFloat = document.createElement("div"); whatsappFloat.className = "whatsapp-float"; const whatsappPopup = document.createElement("div"); whatsappPopup.className = "whatsapp-popup"; whatsappPopup.style.display = "none"; whatsappPopup.innerHTML = `المصداقية
رضا العميل
دعم فني 24/7