document.addEventListener("DOMContentLoaded", () => { // إنشاء زر الأيقونة const btn = document.createElement("div"); btn.innerText = "🔥 أقوى المنتجات"; btn.style.cssText = ` position: fixed; top: 50%; left: 0; transform: translateY(-50%); background: #ff6f00; color: #fff; font-weight: bold; padding: 12px 18px; border-radius: 0 10px 10px 0; cursor: pointer; z-index: 9999; font-size: 14px; box-shadow: 0 0 10px rgba(0,0,0,0.3); `; // إنشاء البانل الجانبي const panel = document.createElement("div"); panel.style.cssText = ` position: fixed; top: 0; left: -340px; width: 320px; height: 100%; background: #fff; box-shadow: 2px 0 10px rgba(0,0,0,0.2); transition: left 0.4s ease; z-index: 9998; padding: 15px; overflow-y: auto; font-family: Arial, sans-serif; `; panel.innerHTML = `
"${t.text}"
- ${t.name} `; card.style.opacity = "1"; card.style.transform = "translateY(0)"; } function nextTestimonial() { card.style.opacity = "0"; card.style.transform = "translateY(50px)"; setTimeout(() => { index = (index + 1) % testimonials.length; showTestimonial(index); }, 600); } showTestimonial(index); setInterval(nextTestimonial, 4000); }); (function () { const gifSrc = "https://www.animatedimages.org/data/media/67/animated-car-image-0151.gif"; const showOnceKey = "carGifLoaderShown_v1"; const brandName = "عنوان السيارات"; const slogans = [ "كل ما تحتاجه سيارتك في مكان واحد", "رحلة آمنة تبدأ من هنا", "مستلزمات سياراتك… بجودة تثق بها" ]; const colors = { orange: "#f7921e", darkOrange: "#ad6716", black: "#000" }; // تحقق: هل ظهر من قبل؟ let alreadyShown = false; try { alreadyShown = !!localStorage.getItem(showOnceKey); } catch (e) {} // أثناء الاختبار: ?showLoader=1 يجبر العرض try { const params = new URLSearchParams(location.search); if (params.get("showLoader") === "1") alreadyShown = false; } catch (e) {} if (alreadyShown) return; function initLoader() { const overlay = document.createElement("div"); overlay.id = "car-intro-loader"; overlay.style.cssText = ` position:fixed;inset:0; background:${colors.black}; display:flex;align-items:center;justify-content:center; flex-direction:column; z-index:999999; transition:opacity .4s ease; opacity:1; `; // الخلفية GIF const img = document.createElement("img"); img.src = gifSrc; img.alt = ""; img.style.cssText = ` position:absolute;inset:0; width:100%;height:100%; object-fit:cover; filter:brightness(0.6); z-index:1; `; // المحتوى const content = document.createElement("div"); content.style.cssText = ` position:relative;z-index:2;text-align:center;color:#fff; font-family:Arial,sans-serif;padding:20px; `; const nameEl = document.createElement("h1"); nameEl.textContent = brandName; nameEl.style.cssText = ` font-size:clamp(24px,5vw,40px); font-weight:bold; color:${colors.orange}; margin-bottom:12px; text-shadow:0 4px 15px rgba(0,0,0,0.6); opacity:0; transform:translateY(20px); transition:all 1s ease; `; const sloganEl = document.createElement("p"); sloganEl.textContent = slogans[0]; sloganEl.style.cssText = ` font-size:clamp(14px,3vw,20px); margin:0; opacity:0; transform:translateY(20px); transition:all 1s ease .5s; `; // زر التخطي const skipBtn = document.createElement("button"); skipBtn.textContent = "تخطي"; skipBtn.style.cssText = ` position:absolute;top:15px;right:15px; background:transparent; border:2px solid ${colors.orange}; color:${colors.orange}; padding:6px 12px; border-radius:6px; cursor:pointer; z-index:3; font-weight:600; `; skipBtn.onclick = hideLoader; content.appendChild(nameEl); content.appendChild(sloganEl); overlay.appendChild(img); overlay.appendChild(content); overlay.appendChild(skipBtn); document.body.appendChild(overlay); // تفعيل الأنيميشن بعد الإضافة للصفحة requestAnimationFrame(() => { nameEl.style.opacity = "1"; nameEl.style.transform = "translateY(0)"; sloganEl.style.opacity = "1"; sloganEl.style.transform = "translateY(0)"; }); // تدوير الجمل let idx = 0; const sloganInterval = setInterval(() => { idx = (idx + 1) % slogans.length; sloganEl.textContent = slogans[idx]; }, 2000); // إخفاء تلقائي بعد 6 ثواني const autoClose = setTimeout(hideLoader, 6000); function hideLoader() { clearTimeout(autoClose); clearInterval(sloganInterval); overlay.style.opacity = "0"; setTimeout(() => overlay.remove(), 500); try { localStorage.setItem(showOnceKey, "1"); } catch (e) {} } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", initLoader); } else { initLoader(); } })(); (function () { const whatsappNumber = "966538959217"; // رقم الواتساب // الرسائل حسب الاختيار const options = [ { text: "🛒 طلب منتج", message: "مرحباً، أريد المساعدة في طلب منتج." }, { text: "⚙️ مشكلة في الطلب", message: "مرحباً، أواجه مشكلة في طلبي." }, { text: "❓ استفسار عام", message: "مرحباً، لدي استفسار بخصوص المتجر." } ]; function createSupportIcon() { const wrapper = document.createElement("div"); wrapper.style.cssText = ` position: fixed; bottom: 20px; left: 20px; z-index: 99999; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-family: Arial, sans-serif; `; // أيقونة السيارة const btn = document.createElement("div"); btn.id = "support-car-icon"; btn.style.cssText = ` width: 90px; height: 90px; cursor: pointer; transition: transform .3s ease; display: flex; align-items: center; justify-content: center; `; const img = document.createElement("img"); img.src = "https://www.animatedimages.org/data/media/67/animated-car-image-0421.gif"; img.alt = "دعم فني"; img.style.cssText = ` width: 100%; height: 100%; object-fit: contain; display: block; `; btn.appendChild(img); // الفقاعة (القائمة الصغيرة) const bubble = document.createElement("div"); bubble.style.cssText = ` background: #fff; color: #000; border: 2px solid #f7921e; border-radius: 12px; padding: 12px; max-width: 230px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: 0; transform: scale(0.8); transform-origin: bottom left; transition: all 0.3s ease; pointer-events: none; `; bubble.innerHTML = `👋 مرحباً بك
إزاي نقدر نساعدك؟
`; // إضافة الأزرار حسب الخيارات options.forEach(opt => { const optionBtn = document.createElement("button"); optionBtn.textContent = opt.text; optionBtn.style.cssText = ` display:block; width:100%; margin:5px 0; background:#f7921e; color:#fff; border:none; padding:6px 10px; border-radius:6px; cursor:pointer; text-align:center; font-size:14px; transition: background .3s ease; `; optionBtn.onmouseenter = () => optionBtn.style.background = "#ad6716"; optionBtn.onmouseleave = () => optionBtn.style.background = "#f7921e"; optionBtn.onclick = (e) => { e.stopPropagation(); const url = `https://wa.me/${whatsappNumber}?text=${encodeURIComponent(opt.message)}`; window.open(url, "_blank"); }; bubble.appendChild(optionBtn); }); // فتح/إغلاق القائمة let bubbleOpen = false; btn.onclick = () => { bubbleOpen = !bubbleOpen; if (bubbleOpen) { bubble.style.opacity = "1"; bubble.style.transform = "scale(1)"; bubble.style.pointerEvents = "auto"; } else { bubble.style.opacity = "0"; bubble.style.transform = "scale(0.8)"; bubble.style.pointerEvents = "none"; } }; wrapper.appendChild(bubble); wrapper.appendChild(btn); document.body.appendChild(wrapper); } // 🔹 تظهر بعد اللودر window.addEventListener("load", () => { setTimeout(() => { if (!document.getElementById("support-car-icon")) { createSupportIcon(); } }, 6500); }); })(); document.addEventListener("DOMContentLoaded", () => { const faqData = [ { icon: "🛒", q: "كيف أقدر أطلب منتج من المتجر؟", a: "تقدر تضيف المنتج لعربة التسوق وتكمل خطوات الدفع بكل سهولة." }, { icon: "🚚", q: "هل التوصيل متاح لكل المدن؟", a: "نعم، نوصل لجميع مدن المملكة بخدمة شحن سريعة وآمنة." }, { icon: "💳", q: "ما طرق الدفع المتاحة؟", a: "نوفر الدفع عند الاستلام، البطاقة البنكية، والمحافظ الإلكترونية." }, { icon: "⏱️", q: "كم يستغرق وصول الطلب؟", a: "عادة خلال 2-5 أيام عمل حسب موقعك." } ]; // إنشاء القسم const faqSection = document.createElement("section"); faqSection.id = "faq-bubbles"; faqSection.style.cssText = ` width: 100%; background: #fff; padding: 40px 20px; color: #000; text-align: center; font-family: Arial, sans-serif; `; const title = document.createElement("h2"); title.textContent = "الأسئلة الشائعة ❓"; title.style.cssText = ` font-size: 28px; margin-bottom: 25px; color: #ad6716; `; faqSection.appendChild(title); const container = document.createElement("div"); container.style.cssText = ` display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; max-width: 1000px; margin: 0 auto; `; faqData.forEach((item, index) => { const bubble = document.createElement("div"); bubble.style.cssText = ` background: linear-gradient(135deg, #f7921e, #ad6716); color: #fff; border-radius: 20px; padding: 15px 20px; width: 250px; text-align: left; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.15); transition: transform .3s ease, opacity .6s ease, transform .6s ease; position: relative; opacity: 0; transform: translateY(40px); `; const q = document.createElement("div"); q.style.cssText = ` font-weight: bold; display: flex; align-items: center; justify-content: space-between; `; q.innerHTML = `${item.icon} ${item.q} +`; const a = document.createElement("div"); a.textContent = item.a; a.style.cssText = ` max-height: 0; overflow: hidden; line-height: 1.6; color: #fff; margin-top: 10px; transition: max-height .4s ease; `; let open = false; q.onclick = () => { open = !open; if (open) { a.style.maxHeight = "200px"; q.querySelector("span:last-child").textContent = "-"; } else { a.style.maxHeight = "0"; q.querySelector("span:last-child").textContent = "+"; } }; bubble.appendChild(q); bubble.appendChild(a); container.appendChild(bubble); }); faqSection.appendChild(container); // إدراج فوق الفوتر const footer = document.querySelector("footer") || document.body; footer.parentNode.insertBefore(faqSection, footer); // 🔥 الأنيميشن عند ظهور القسم const bubbles = faqSection.querySelectorAll("div[style]"); const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { [...bubbles].forEach((bubble, i) => { setTimeout(() => { bubble.style.opacity = "1"; bubble.style.transform = "translateY(0)"; }, i * 200); // يظهر وحدة ورا التانية }); observer.disconnect(); } }); }, { threshold: 0.2 }); observer.observe(faqSection); }); // === [بداية] لودر متحرك زجاجي === (function futuristicLoader() { const loader = document.createElement("div"); loader.id = "fancy-loader"; const styles = document.createElement("style"); styles.textContent = ` #fancy-loader { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--body); display: flex; align-items: center; justify-content: center; z-index: 99999; overflow: hidden; transition: opacity 0.6s ease; } .glass-sphere { position: relative; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(12px); box-shadow: 0 0 20px rgba(255, 255, 255, 0.2), inset 0 0 60px rgba(255, 255, 255, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.3); display: flex; align-items: center; justify-content: center; animation: floaty 3s ease-in-out infinite; overflow: hidden; } .glass-sphere::before { content: ""; position: absolute; top: -40%; left: -40%; width: 180%; height: 180%; background: linear-gradient( 120deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.05) 60%, rgba(255, 255, 255, 0.25) 100% ); transform: rotate(45deg); animation: shine 4s linear infinite; pointer-events: none; border-radius: 50%; filter: blur(8px); } .loader-logo { position: relative; width: 80px; height: 80px; object-fit: contain; filter: drop-shadow(0 0 8px var(--second-color)); animation: pulse 2s infinite; z-index: 2; } @keyframes floaty { 0% { transform: translateY(0px) rotate(0deg); } 50% { transform: translateY(-20px) rotate(5deg); } 100% { transform: translateY(0px) rotate(0deg); } } @keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.9; } 100% { transform: scale(1); opacity: 1; } } @keyframes shine { 0% { transform: rotate(45deg) translateX(-100%); } 100% { transform: rotate(45deg) translateX(100%); } } `; const sphere = document.createElement("div"); sphere.className = "glass-sphere"; const logo = document.createElement("img"); logo.className = "loader-logo"; logo.src = "https://cdn.salla.sa/cdn-cgi/image/fit=scale-down,width=400,height=400,onerror=redirect,format=auto/dPRRYv/K9lGKpdmLr7cxfHmwt3wavefzLC2UGXgtpSsfYqf.png"; // ضع اللوجو هنا sphere.appendChild(logo); loader.appendChild(sphere); document.head.appendChild(styles); document.body.appendChild(loader); window.addEventListener("load", () => { setTimeout(() => { loader.style.opacity = "0"; setTimeout(() => loader.remove(), 600); }, 1500); }); })(); // === [نهاية] لودر متحرك زجاجي === // === تشغيل صوت عند الضغط على زر "أضف للسلة" === document.addEventListener("DOMContentLoaded", function () { const addSound = new Audio("https://res.cloudinary.com/dgpyctx0v/video/upload/v1753155078/Add_to_Cart_SFX_at9ofh.mp3"); document.body.addEventListener("click", function (e) { const target = e.target.closest("salla-add-product-button"); if (target) { addSound.currentTime = 0; addSound.play().catch(err => console.warn("الصوت لم يعمل:", err)); } }); }); // === [نهاية] صوت زر الإضافة للسلة === // === تحسين مظهر الناف بار عند التمرير للأسفل === document.addEventListener("DOMContentLoaded", function () { let alreadyStyled = false; const isDesktop = () => window.innerWidth >= 768; const styleSheet = document.createElement("style"); styleSheet.innerHTML = ` @keyframes slideDownNav { 0% { opacity: 0; transform: translateY(-50%); box-shadow: none; } 100% { opacity: 1; transform: translateY(0); } } `; document.head.appendChild(styleSheet); window.addEventListener("scroll", function () { const navInner = document.querySelector(".main-nav-container.fixed-header .inner"); if (!navInner) return; if (window.scrollY > 30 && !alreadyStyled && isDesktop()) { navInner.classList.add("js-styled"); navInner.style.animation = "slideDownNav 0.6s ease-out"; navInner.style.background = "rgba(255, 255, 255, 0.15)"; navInner.style.boxShadow = "0 8px 20px rgba(0, 0, 0, 0.15)"; navInner.style.borderRadius = "20px"; navInner.style.backdropFilter = "blur(12px) saturate(180%)"; navInner.style.webkitBackdropFilter = "blur(12px) saturate(180%)"; navInner.style.border = "1px solid rgba(255, 255, 255, 0.2)"; navInner.style.transition = "all 0.4s ease-in-out"; navInner.style.transform = "translateY(0)"; navInner.style.width = "90%"; navInner.style.margin = "30px auto 0 auto"; navInner.style.maxWidth = "1200px"; alreadyStyled = true; } if ((window.scrollY <= 30 || !isDesktop()) && alreadyStyled) { navInner.classList.remove("js-styled"); navInner.removeAttribute("style"); alreadyStyled = false; } }); window.addEventListener("resize", () => { alreadyStyled = false; }); }); // === [نهاية] تحسين الناف بار عند التمرير === // === قسم الأسئلة الشائعة === document.addEventListener("DOMContentLoaded", () => { const style = document.createElement("style"); style.innerHTML = ` #faq-section { padding: 2rem 2rem 4rem; max-width: 1000px; margin: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; } .faq-bubble { position: relative; width: 180px; height: 180px; background: var(--main-color, #4a90e2); border-radius: 50%; box-shadow: 0 8px 20px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; color: white; font-weight: bold; cursor: pointer; transition: transform 0.4s ease; } .faq-bubble:hover { transform: scale(1.05); } .faq-answer { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: white; color: #333; padding: 1rem; border-radius: 1rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-width: 220px; width: max-content; opacity: 0; pointer-events: none; transform-origin: top center; transition: opacity 0.4s ease, transform 0.4s ease; font-weight: normal; font-size: 0.95rem; z-index: 100; } .faq-bubble.open .faq-answer { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(10px) scale(1.05); } @media (max-width: 768px) { .faq-bubble { width: 140px; height: 140px; font-size: 0.85rem; } .faq-answer { font-size: 0.85rem; } } @media (max-width: 395px) { #faq-section { justify-content: center; } .faq-bubble { width: 100% !important; max-width: 180px; height: auto; aspect-ratio: 1 / 1; } } `; document.head.appendChild(style); const faqSection = document.createElement("section"); faqSection.id = "faq-section"; const faqData = [ { question: "خيارات الدفع؟", answer: "الدفع عبر مدى، البطاقات، Apple Pay، STC Pay." }, { question: "مدة التوصيل؟", answer: "يستغرق من ٧ إلى ١٤ يوم عمل عادة." }, { question: "هل يمكن الإرجاع؟", answer: "نعم، خلال ٧ أيام من الاستلام حسب سياسة المتجر." }, { question: "أماكن التوصيل؟", answer: "نقوم بالتوصيل لجميع مناطق المملكة." } ]; const bubbles = []; faqData.forEach(({ question, answer }) => { const bubble = document.createElement("div"); bubble.className = "faq-bubble"; bubble.innerText = question; const answerEl = document.createElement("div"); answerEl.className = "faq-answer"; answerEl.innerText = answer; bubble.appendChild(answerEl); bubble.addEventListener("click", () => { bubbles.forEach(b => { if (b !== bubble) b.classList.remove("open"); }); bubble.classList.toggle("open"); }); bubbles.push(bubble); faqSection.appendChild(bubble); }); const footer = document.querySelector("footer"); footer.parentNode.insertBefore(faqSection, footer); }); // === [نهاية] فقاعات الأسئلة الشائعة === // === تأثيرات الموج في الفوتر === const footer = document.querySelector('.store-footer'); const wavesContainer = document.createElement('div'); wavesContainer.innerHTML = ` `; wavesContainer.classList.add('waves'); footer.insertBefore(wavesContainer, footer.firstChild); // === تأثيرات الظهور بالتمرير === function handleScroll() { const elements = document.querySelectorAll('.banner--fixed img'); elements.forEach(element => { const rect = element.getBoundingClientRect(); if (rect.top <= window.innerHeight && rect.bottom >= 0) { if (!element.classList.contains('visible')) { element.classList.add('visible'); } } else { if (element.classList.contains('visible')) { element.classList.remove('visible'); } } }); } function handleScroll2() { const elements = document.querySelectorAll('salla-slider.photos-slider'); elements.forEach(element => { const rect = element.getBoundingClientRect(); if (rect.top <= window.innerHeight && rect.bottom >= 0) { if (!element.classList.contains('visible')) { element.classList.add('visible'); } } }); } function handleScroll3() { const elements = document.querySelectorAll('.lazy__bg'); elements.forEach(element => { const rect = element.getBoundingClientRect(); if (rect.top <= window.innerHeight && rect.bottom >= 0) { if (!element.classList.contains('visible')) { element.classList.add('visible'); } } else { if (element.classList.contains('visible')) { element.classList.remove('visible'); } } }); } function handleScrollBlur() { const elements = document.querySelectorAll('.s-product-card-vertical'); elements.forEach(element => { const rect = element.getBoundingClientRect(); if (rect.top <= window.innerHeight && rect.bottom >= 0) { element.classList.add('visible'); } else { element.classList.remove('visible'); } }); } window.addEventListener('scroll', handleScroll); window.addEventListener('scroll', handleScroll2); window.addEventListener('scroll', handleScroll3); window.addEventListener('scroll', handleScrollBlur); handleScroll(); handleScroll2(); handleScroll3(); handleScrollBlur(); // === نص ترويجي متحرك === const scrollingDiv = document.createElement('div'); scrollingDiv.className = 'scrolling-text'; const textContent = ` 🔥 خصومات لن تجدها إلا هنا 💥💵 أسعار تبدأ من المستحيل 🔥 عروض حصرية تنتظرك الآن ⏳💰 لا تفوت فرص التوفير اليوم 🛒💥 عروض حصرية تنتظرك الآن `; scrollingDiv.innerHTML = `${d.price}