//section document.addEventListener('DOMContentLoaded', function () { const path = window.location.pathname.replace(/\/+$/, ''); if (path !== '' && path !== '/index.html') return; // سكشن (OUR PRODUCTS) const photosSlider = document.querySelector('.s-block.s-block--photos-slider'); if (photosSlider) addAnimatedHeading(photosSlider, 'afterend', 'تسوق حسب الأقسام', 'ef-our-products-heading', 'blink'); }); function addAnimatedHeading(target, position, text, className, animName) { const heading = document.createElement('h2'); heading.className = className; document.head.insertAdjacentHTML('beforeend', ` `); target.insertAdjacentElement(position, heading); let i = 0; let isDeleting = false; let widthLocked = false; function typeLoop() { const current = text.substring(0, i); heading.textContent = current; if (!widthLocked && i === text.length) { heading.style.width = heading.offsetWidth + 'px'; widthLocked = true; } if (!isDeleting && i < text.length) { i++; setTimeout(typeLoop, 150); } else if (isDeleting && i > 1) { i--; setTimeout(typeLoop, 100); } else { if (!isDeleting) { isDeleting = true; setTimeout(typeLoop, 1500); } else { isDeleting = false; setTimeout(typeLoop, 800); } } } typeLoop(); } // سكشن مختصر عن قهوة بيشة العربية (قهوة + بهارات + طرق الدفع) document.addEventListener("DOMContentLoaded", function () { if (window.location.pathname !== "/" && window.location.pathname !== "/index.html") { return; } const section = document.createElement("section"); section.className = "bisha-mini-section"; section.innerHTML = `
قهوة بيشة

نكهات الأصالة... من بيشة إلى فنجانك

في قهوة بيشة العربية نحرص على تقديم مزيج فريد يجمع بين القهوة الأصيلة، والبهارات الغنية، وخيارات دفع مريحة تضمن تجربة تسوق لا تُنسى.

قهوة بيشة

حبوب مختارة بعناية، تعبّر عن الذوق السعودي الأصيل وتُحمّص لتناسب جميع الأذواق.

بهاراتنا المميزة

نقدم مجموعة متنوعة من البهارات الفاخرة والهيل والزعفران الأصلي.

طرق دفع آمنة

مدى – Apple Pay – STC Pay – الدفع عند الاستلام بكل سهولة وأمان.

`; // تحديد مكان الإدراج const testimonialsSection = document.querySelector(".s-block--testimonials"); if (testimonialsSection) { testimonialsSection.parentNode.insertBefore(section, testimonialsSection); } else { document.body.appendChild(section); } // توليد الدواير الخلفية const circlesContainer = section.querySelector(".floating-circles"); for (let i = 0; i < 12; i++) { const span = document.createElement("span"); const size = 4 + Math.random() * 10; span.style.width = `${size}px`; span.style.height = `${size}px`; span.style.top = `${Math.random() * 100}%`; span.style.left = `${Math.random() * 100}%`; span.style.animationDelay = `${Math.random() * 4}s`; span.style.animationDuration = `${3 + Math.random() * 3}s`; span.style.opacity = `${0.1 + Math.random() * 0.4}`; circlesContainer.appendChild(span); } // إضافة CSS const style = document.createElement("style"); style.textContent = ` @import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css'); :root { --main-color: #053E77; --second-color: #4387E8; --third-color: #f5f5f5; --fourth-color: #fff; --orange-color: #4A3350; } .bisha-mini-section { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; color: var(--fourth-color); background-color: var(--main-color); direction: rtl; overflow: hidden; border-radius: 12px; margin-top: 50px; padding: 40px 20px; } .floating-circles { position: absolute; inset: 0; overflow: hidden; z-index: 0; } .floating-circles span { position: absolute; border-radius: 50%; background: var(--second-color); animation: floatMove 5s infinite ease-in-out alternate; } @keyframes floatMove { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(10px, -10px) scale(1.1); } 100% { transform: translate(-10px, 10px) scale(1); } } .bisha-mini-image { flex: 1; max-width: 350px; position: relative; z-index: 1; } .bisha-mini-image img { width: 100%; height: auto; object-fit: cover; border-radius: 15px; display: block; margin: auto; } .bisha-mini-content { flex: 1; min-width: 50%; z-index: 2; padding: 20px 30px; text-align: right; } .bisha-mini-title { font-size: 26px; font-weight: 700; color: #EFD7B5; margin-bottom: 15px; } .bisha-mini-desc { font-size: 16px; color: var(--third-color); margin-bottom: 30px; line-height: 1.8; } .bisha-mini-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; } .bisha-mini-box { display: flex; align-items: flex-start; gap: 15px; } .bisha-mini-box i { font-size: 24px; color: #EFD7B5; flex-shrink: 0; margin-top: 5px; } .bisha-mini-box h3 { margin: 0; font-size: 17px; color: #fff; } .bisha-mini-box p { margin: 5px 0 0; font-size: 14px; color: var(--third-color); line-height: 1.6; } @media (max-width: 768px) { .bisha-mini-section { flex-direction: column; padding: 30px 15px; } .bisha-mini-image { margin-bottom: 25px; max-width: 280px; } .bisha-mini-title { font-size: 22px; } .bisha-mini-desc { font-size: 15px; } } `; document.head.appendChild(style); }); /* Add custom Js styles below */ // إ Font Awesome const fa = document.createElement("link"); fa.rel = "stylesheet"; fa.href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"; fa.crossOrigin = "anonymous"; fa.referrerPolicy = "no-referrer"; document.head.appendChild(fa); //end icons document.addEventListener("DOMContentLoaded", function () { const priceElement = document.querySelector('.s-product-card-price'); const iconElement = document.querySelector('.s-button-btn'); if (priceElement && iconElement) { priceElement.parentNode.insertBefore(iconElement, priceElement.nextSibling); } const styleTag = document.createElement("style"); styleTag.innerHTML = ` .enhanced-card { opacity: 0; transform: translateY(50px); transition: all 0.6s ease; } .enhanced-card.visible { opacity: 1 !important; transform: translateY(0) !important; } `; document.head.appendChild(styleTag); function checkVisibility() { document.querySelectorAll(".s-product-card-entry").forEach(product => { const rect = product.getBoundingClientRect(); if (rect.top < window.innerHeight * 0.9 && rect.bottom >= 0) { product.classList.add("visible"); } else { product.classList.remove("visible"); } }); } function enhanceCards() { document.querySelectorAll('.s-product-card-entry').forEach(card => { // منع الازدواجية if (card.querySelector('.stars')) return; // نجوم التقييم const stars = document.createElement('div'); stars.className = 'stars'; const rating = Math.floor(Math.random() * 2) + 4; stars.style.setProperty('--rating', `${(rating / 5) * 100}%`); card.querySelector('.s-product-card-content-main')?.appendChild(stars); const badge = document.createElement('div'); badge.className = 'product-badge'; const badges = [ { text: 'جديد ', bg: '#053E77' }, { text: 'حصري ', bg: '#053E77' }, { text: 'اشترِ الآن ', bg: '#053E77' }, { text: 'حديثًا ', bg: '#053E77' } ]; const selected = badges[Math.floor(Math.random() * badges.length)]; badge.textContent = selected.text; badge.style.cssText = ` position: absolute; top: 10px; right: 10px; background-color: ${selected.bg}; color: white; padding: 4px 8px; border-radius: 0.3rem; font-size: 0.7rem; font-weight: bold; z-index: 10; `; card.style.position = 'relative'; card.classList.add('enhanced-card'); card.appendChild(badge); }); } let tries = 0; const interval = setInterval(() => { enhanceCards(); checkVisibility(); if (++tries > 10) clearInterval(interval); }, 500); window.addEventListener("scroll", checkVisibility); }); // =========== 👆 BACK TO TOP BUTTON ========= const backToTopButton = document.createElement("div"); backToTopButton.id = "backToTop"; backToTopButton.innerHTML = `
`; document.body.appendChild(backToTopButton); const style = ` #backToTop { position: fixed; bottom: 20px; right: 20px; width: 60px; height: 60px; display: none; z-index: 1000; } #backToTop .icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; color: var(--second-color); } .circular-chart { width: 100%; height: 100%; transform: rotate(-90deg); } .circle-bg { fill: none; stroke: transparent; stroke-width: 3.8; } .circle { fill: none; stroke: var(--second-color); stroke-width: 3.8; stroke-dasharray: 100, 100; stroke-linecap: round; transition: stroke-dasharray 0.1s linear; } #backToTop:hover .icon { color: var(--main-color); } `; const styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheet.textContent = style; document.head.appendChild(styleSheet); window.addEventListener("scroll", () => { const scrollTop = window.scrollY; const docHeight = document.documentElement.scrollHeight - window.innerHeight; const scrollPercent = (scrollTop / docHeight) * 100; if (scrollPercent > 1) { backToTopButton.style.display = "block"; } else { backToTopButton.style.display = "none"; } const circle = document.querySelector(".circle"); const offset = 100 - scrollPercent; circle.style.strokeDasharray = `${scrollPercent}, 100`; }); backToTopButton.addEventListener("click", () => { window.scrollTo({ top: 0, behavior: "smooth", }); }); // Additional code block // ======== ⚠️ EMPTY LINKS PREVENT DEFAULT========== document.querySelectorAll('a[href=""], a[href="#"]').forEach(link => { link.addEventListener('click', event => { event.preventDefault(); }); }); // Select the salla-product-options element // ============= 📢 PRODUCT OPTION ALERT =========== const sallaProductOptions = document.querySelector('salla-product-options'); // Ensure the element exists before proceeding if (sallaProductOptions) { // Create the alert message const alertMessage = document.createElement('p'); alertMessage.textContent = "الرجاء اختيار أحد هذا الاختيارات للتمكن من اتمام الشراء"; // Apply styles directly to the element alertMessage.style.backgroundColor = '#ffdddd'; alertMessage.style.color = '#a94442'; alertMessage.style.padding = '15px'; alertMessage.style.border = '1px solid #a94442'; alertMessage.style.borderRadius = '5px'; alertMessage.style.marginBottom = '10px'; alertMessage.style.fontWeight = 'bold'; alertMessage.style.textAlign = 'center'; // Insert the alert message at the beginning of the salla-product-options element sallaProductOptions.insertBefore(alertMessage, sallaProductOptions.firstChild); } else { console.error("The 'salla-product-options' element was not found on the page."); } // Apply styles directly to the element // Insert the banner swap (now called banSwiper) const banSwiperHTML = ` `; // Insert the banSwiper as the first element in the body document.body.insertAdjacentHTML('afterbegin', banSwiperHTML); // Create the loader div element // ==================== 🖼️ SCROLL EFFECT FOR BANNERS ==================== 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'); } } }); } window.addEventListener('scroll', handleScroll); handleScroll(); // ==================== 🖼️ SCROLL EFFECT FOR PHOTOS SLIDER ==================== 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'); } } }); } window.addEventListener('scroll', handleScroll2); handleScroll2(); // ======== 🖼️ SCROLL EFFECT FOR BACKGROUND ========= function handleScroll3() { const elements = document.querySelectorAll('.lazy__bg'); elements.forEach(element => { const rect = element.getBoundingClientRect(); if (rect.top <= window.innerHeight && rect.bottom >= 0) { // هنضيف الكلاس visible لتشغيل تأثير الـ Bounce و Zoom if (!element.classList.contains('visible')) { element.classList.add('visible'); } } else { if (element.classList.contains('visible')) { element.classList.remove('visible'); } } }); } window.addEventListener('scroll', handleScroll3); handleScroll3(); // ======== 🛍️ BLUR EFFECT ON PRODUCT CARDS ========== 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', handleScrollBlur); handleScrollBlur(); // Create scrolling text dynamically //hero //start loading const loader = document.createElement('div'); loader.className = 'custom-loader'; loader.innerHTML = ` Loading `; document.body.appendChild(loader); window.addEventListener("load", () => { setTimeout(() => { loader.classList.add('gray-phase'); }, 500); setTimeout(() => { loader.classList.add('hide-loader'); }, 2500); }); //end loading