// كودين التمرير والفقاعات والعناوين const internalLinks = document.querySelectorAll('a[href^="#"]'); internalLinks.forEach((link) => { link.addEventListener("click", function (e) { const targetSelector = this.getAttribute("href"); const target = document.querySelector(targetSelector); if (target) { e.preventDefault(); target.scrollIntoView({ behavior: "smooth" }); } }); }); const titles = document.querySelectorAll(".s-block__title h2, .s-slider-block__title h2"); titles.forEach((title) => { title.addEventListener("mouseenter", () => { title.style.transform = "scale(1.05)"; }); title.addEventListener("mouseleave", () => { title.style.transform = "scale(1)"; }); }); //-------------------------------------------------- //window.addEventListener("load", function () { // setTimeout(() => { // alert("🎉 مرحبًا بك في متجرنا! لا تفوّت العروض الخاصة اليوم //🌟"); // }, 1500); //}); //-------------------------------------------------- window.addEventListener("load", () => { // ⏳ عدد الساعات بين كل ظهور const HOURS_INTERVAL = 5; // تحويل الساعات إلى ثواني const SECONDS_INTERVAL = HOURS_INTERVAL * 60 * 60; // 🔹 وقت آخر ظهور محفوظ const lastShownTime = localStorage.getItem("fishTipLastShown"); if (lastShownTime) { const secondsPassed = (Date.now() - parseInt(lastShownTime)) / 1000; // تحويل إلى ثواني if (secondsPassed < SECONDS_INTERVAL) { return; // ⛔ لم يمر الوقت المحدد بعد } } // 🐟 قائمة معلومات الأسماك const fishTips = [ { title: "💡 معلومة بحرية", text: "سمك الهامور غني بالبروتين ويساعد على صحة القلب. جربه الآن طازجًا من فيشكا!", link: "https://fishka-sa.com/fish/c1382205726?filters[category_id]=1382205726" }, { title: "💡 معلومة بحرية", text: "سمك السلمون يحتوي على أوميغا 3 المفيد للمخ وصحة العيون.", link: "https://fishka-sa.com/fish/c1382205730?filters[category_id]=1382205730" }, { title: "💡 معلومة بحرية", text: "سمك الشعري لذيذ ومثالي للشوي ويتميز بنكهة طبيعية رائعة.", link: "https://fishka-sa.com/fish/c1382205735?filters[category_id]=1382205735" }, { title: "💡 معلومة بحرية", text: "سمك التونة مصدر ممتاز للبروتين والطاقة، ويعزز نشاطك اليومي.", link: "https://fishka-sa.com/fish/c1382205740?filters[category_id]=1382205740" }, { title: "💡 معلومة بحرية", text: "الروبيان غني بالمعادن ويعزز صحة البشرة والشعر.", link: "https://fishka-sa.com/fish/c1382205745?filters[category_id]=1382205745" }, { title: "💡 معلومة بحرية", text: "سمك الكنعد يحتوي على دهون صحية مفيدة للقلب والمناعة.", link: "https://fishka-sa.com/fish/c1382205750?filters[category_id]=1382205750" } ]; setTimeout(() => { // 🎯 اختيار معلومة عشوائية const randomTip = fishTips[Math.floor(Math.random() * fishTips.length)]; // ✅ إنشاء نافذة البوب أب const tipPopup = document.createElement("div"); tipPopup.id = "fishTip"; tipPopup.innerHTML = `

${randomTip.title}

${randomTip.text}

تسوق الآن × `; document.body.appendChild(tipPopup); // 📝 حفظ وقت الظهور الجديد localStorage.setItem("fishTipLastShown", Date.now().toString()); // ✅ إغلاق عند الضغط على X tipPopup.querySelector(".close-tip").addEventListener("click", () => { tipPopup.remove(); }); // ⏳ اختفاء تلقائي بعد 30 ثانية setTimeout(() => { tipPopup.remove(); }, 30000); }, 30000); // يظهر بعد 30 ثانية من تحميل الصفحة }); //------------------------------------------------ //----------------- // إشعار ترحيبي window.addEventListener("load", () => { // تحقق إن المستخدم في الصفحة الرئيسية فقط if (location.pathname === "/" || location.pathname === "/index.html") { // تحقق إذا تم عرض البوب أب من قبل if (!localStorage.getItem("welcomeShown")) { // إنشاء البوب أب let popup = document.createElement("div"); popup.id = "welcomePopup"; popup.innerHTML = "

مرحباً بك في فيشكا!

اكتشف أفضل الأسماك الطازجة لدينا.

"; document.body.appendChild(popup); // إزالة البوب أب بعد 4 ثواني setTimeout(() => popup.remove(), 4000); // حفظ الحالة في LocalStorage حتى لا يظهر مرة أخرى localStorage.setItem("welcomeShown", "true"); } } }); //------------------------------------------- //----حركة الفقاعات ماوس موف---------- //------------------------------------------- document.addEventListener("mousemove", (e) => { let bubble = document.createElement("span"); bubble.className = "mouseBubble"; bubble.style.left = e.pageX + "px"; bubble.style.top = e.pageY + "px"; document.body.appendChild(bubble); setTimeout(() => bubble.remove(), 800); }); //------------------------------------------- //----حركة الضغط ماوس موف---------- //------------------------------------------- document.addEventListener("click", (e) => { let drop = document.createElement("span"); drop.className = "waterDrop"; drop.style.left = e.pageX + "px"; drop.style.top = e.pageY + "px"; document.body.appendChild(drop); setTimeout(() => drop.remove(), 600); }); //------------------------------------------------ //--------كود زر تأثيرات الواتساب-------- //------------------------------------------------ document.addEventListener("DOMContentLoaded", () => { const waBtn = document.getElementById("wa-angel"); if (waBtn) { waBtn.style.display = "none"; // إخفاء مؤقت setTimeout(() => { waBtn.style.display = "block"; }, 5000); // يظهر بعد 5 ثواني } }); document.addEventListener("DOMContentLoaded", () => { const waBtn = document.getElementById("wa-angel"); if (waBtn) { setInterval(() => { waBtn.classList.add("pulse"); setTimeout(() => waBtn.classList.remove("pulse"), 1000); }, 6000); // كل 6 ثواني يعمل نبضة } }); document.addEventListener("DOMContentLoaded", () => { const waBtn = document.getElementById("wa-angel"); setInterval(() => { waBtn.style.boxShadow = "0 0 20px rgba(37, 211, 102, 0.8)"; setTimeout(() => { waBtn.style.boxShadow = "none"; }, 500); }, 6000); // كل 8 ثواني }); //---------------------بطاقة المنتج القلب--------------------------- //--------------------------السلة في اضافة // ==================== CSS ==================== // ==================== CSS ==================== // ==================== CSS ==================== // ==================== CSS ==================== // ==================== CSS ==================== // ========== CSS ========== // ========== CSS داخلي ========== const style = document.createElement("style"); style.innerHTML = ` #welcomePopup { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.25); display: none; justify-content: center; align-items: center; z-index: 9999; backdrop-filter: blur(2px); } #welcomePopup .popup-box { background: linear-gradient(135deg, #0F9D58, #18A857); color:#fff; padding:25px 25px; border-radius:20px; max-width:400px; width:85%; text-align:center; font-family:"Tajawal",sans-serif; box-shadow:0 5px 20px rgba(0,0,0,0.1); animation: popupFade 0.6s ease; } #welcomePopup h2 { color:#FFD700; margin-bottom:12px; font-size:20px; line-height:1.3; } #welcomePopup p { font-size:15px; margin-bottom:15px; line-height:1.5; transition: all 0.3s ease; } #pressArea, #countdownBox, #couponBox { width:240px; height:60px; border-radius:12px; display:flex; justify-content:center; align-items:center; font-size:18px; margin:10px auto; cursor:pointer; user-select:none; position: relative; } #pressArea { background:#FFD700; color:#0F9D58; font-weight:600; } #countdownBox { background:#FFD700; color:#0F9D58; font-size:24px; font-weight:bold; display:none; } #couponBox { background:#fff; color:#0F9D58; font-weight:bold; display:none; text-align:center; animation: fadeIn 0.6s ease forwards; opacity:0; box-shadow:0 4px 12px rgba(0,0,0,0.08); } .star { width:12px; height:12px; position:absolute; font-size:12px; opacity:0.5; animation: starMove 1.2s linear forwards; } @keyframes starMove { to { transform: translateY(-70px) translateX(40px) scale(0); opacity:0; } } #welcomePopup .close-btn { background:transparent; color:#FFD700; border:2px solid #FFD700; padding:8px 18px; border-radius:10px; cursor:pointer; font-weight:600; transition:all 0.3s ease; } #welcomePopup .close-btn:hover { background:#FFD700; color:#0F9D58; } .toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background:#1B48E1; color:#fff; padding:12px 22px; border-radius:8px; font-size:14px; opacity:0; pointer-events: none; transition: opacity 0.5s ease, transform 0.5s ease; z-index:10000; } .toast.show { opacity:1; transform: translateX(-50%) translateY(-10px); } @keyframes popupFade { from{transform:translateY(-20px);opacity:0;} to{transform:translateY(0);opacity:1;} } @keyframes fadeIn { from{opacity:0;} to{opacity:1;} } `; document.head.appendChild(style); // ========== HTML البوب أب ========== const popup = document.createElement("div"); popup.id = "welcomePopup"; popup.innerHTML = ` `; document.body.appendChild(popup); // ========== Toast ========== const toast = document.createElement("div"); toast.className = "toast"; toast.innerText = "✅ تم نسخ الكوبون"; document.body.appendChild(toast); // ========== Confetti ========== const confettiScript = document.createElement("script"); confettiScript.src = "https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js"; document.head.appendChild(confettiScript); // ========== JS ========== window.closePopup = function() { document.getElementById("welcomePopup").style.display = "none"; }; function playFireworksSound() { const audio = new Audio("https://www.soundjay.com/fireworks/fireworks-01.mp3"); audio.play(); } function createStar(container) { const star = document.createElement("div"); star.className = "star"; star.innerText = "🇸🇦"; star.style.left = Math.random()*container.offsetWidth + "px"; star.style.top = Math.random()*container.offsetHeight + "px"; container.appendChild(star); setTimeout(()=>star.remove(),1200); } // إظهار البوب أب على الصفحة الرئيسية window.onload = function() { const path = window.location.pathname; if (path === "/" || path === "/ar" || path === "/en") { setTimeout(() => { document.getElementById("welcomePopup").style.display = "flex"; initDiscover(); }, 1500); } }; // اضغط لاكتشاف الكوبون function initDiscover() { const pressArea = document.getElementById("pressArea"); const countdownBox = document.getElementById("countdownBox"); const couponBox = document.getElementById("couponBox"); const text = document.getElementById("discoverText"); const couponCode = document.getElementById("couponCode"); function revealCountdown() { pressArea.style.display = "none"; countdownBox.style.display = "flex"; let count = 3; const starInterval = setInterval(()=>createStar(countdownBox),200); const interval = setInterval(() => { count--; if(count > 0){ countdownBox.innerText = count; } else { clearInterval(interval); clearInterval(starInterval); countdownBox.style.display = "none"; couponBox.style.display = "flex"; text.innerText = "🎊 مبروك! كوبون خصم 10% للاحتفال باليوم الوطني وافتتاح المتجر!"; couponBox.style.opacity = "1"; launchConfetti(); playFireworksSound(); couponBox.addEventListener("click", () => { navigator.clipboard.writeText(couponCode.innerText).then(()=>{ toast.classList.add("show"); setTimeout(()=>toast.classList.remove("show"),2000); }).catch(err=>{ alert("حدث خطأ أثناء نسخ الكوبون!"); }); }); } }, 1000); } pressArea.addEventListener("click", revealCountdown); pressArea.addEventListener("touchstart", revealCountdown); } // إطلاق Confetti function launchConfetti() { if(window.confetti){ confetti({ particleCount: 80, spread: 70, origin: { y: 0.6 } }); } } // ==================== Confetti كثيف 🎉🎉 ==================== function launchConfetti() { const duration = 2 * 1000; const end = Date.now() + duration; (function frame() { confetti({ particleCount: 25, spread: 140, origin: { y: 0.6 } }); confetti({ particleCount: 20, spread: 120, origin: { y: 0.4 } }); if(Date.now() < end) requestAnimationFrame(frame); })(); } //--------------------- // إظهار البوب أب بالصفحة الرئيسية مرة واحدة لكل مستخدم window.onload = function() { const path = window.location.pathname; const popupShown = localStorage.getItem("welcomePopupShown"); if ((path === "/" || path === "/ar" || path === "/en") && !popupShown) { setTimeout(() => { document.getElementById("welcomePopup").style.display = "flex"; initDiscover(); localStorage.setItem("welcomePopupShown", "true"); // حفظ أن البوب أب ظهر }, 2000); } }; //--------------------------------------------------- // انسخه كاملًا في نافذة JavaScript (سلة) (function(){ if(window.__SaBubblesInjected) return; window.__SaBubblesInjected = true; // حقن CSS const css = ` .__sa_bubbles_root{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:9999;} .__sa_bubble_wrap{position:absolute;bottom:-20vh;pointer-events:none;animation:__sa_sway ease-in-out infinite alternate;} .__sa_bubble{ border-radius:50%; display:flex;align-items:center;justify-content:center; color:#fff;font-weight:bold;text-shadow:0 0 4px rgba(0,0,0,0.4); opacity:0.88; animation:__sa_floatUp linear forwards; box-shadow:0 8px 22px rgba(0,0,0,0.06); overflow:hidden; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.25) 0 25%, transparent 26%), #0b8a45; } @keyframes __sa_sway{0%{transform:translateX(-10px);}50%{transform:translateX(10px);}100%{transform:translateX(-10px);}} @keyframes __sa_floatUp{0%{transform:translateY(0) scale(1);opacity:.88;}80%{opacity:.88;}100%{transform:translateY(-120vh) scale(1.03);opacity:0;}} @media(prefers-reduced-motion:reduce){.__sa_bubble,.__sa_bubble_wrap{animation:none!important;opacity:.6;}} `; const style=document.createElement('style'); style.textContent=css; document.head.appendChild(style); // إنشاء الحاوية const root=document.createElement('div'); root.className='__sa_bubbles_root'; document.body.appendChild(root); const reduced=matchMedia('(prefers-reduced-motion:reduce)').matches; const isMobile=matchMedia('(max-width:640px)').matches; const spawnInterval=isMobile?6000:5000; // فقاعات خفيفة const sizeRange=isMobile?[36,60]:[40,70]; // الرموز داخل الفقاعات const texts=['KSA','٩٥','🇸🇦','⚔️🌴']; const specialTexts=['اليوم الوطني','95']; // فقاعات مميزة نادرة function spawnBubble(){ if(reduced)return; const wrap=document.createElement('div'); wrap.className='__sa_bubble_wrap'; wrap.style.left=Math.random()*90+'vw'; wrap.style.animationDuration=(Math.random()*6+8)+'s'; const bubble=document.createElement('div'); bubble.className='__sa_bubble'; const size=Math.floor(Math.random()*(sizeRange[1]-sizeRange[0]))+sizeRange[0]; bubble.style.width=size+'px'; bubble.style.height=size+'px'; const greens=['#006c35','#0b8a45','#18a857']; bubble.style.background=`radial-gradient(circle at 30% 30%, rgba(255,255,255,0.25) 0 25%, transparent 26%), ${greens[Math.floor(Math.random()*greens.length)]}`; bubble.style.animationDuration=(Math.random()*8+12)+'s'; // 20% احتمال فقاعات مميزة if(Math.random()<0.2){ bubble.textContent=specialTexts[Math.floor(Math.random()*specialTexts.length)]; bubble.style.fontSize=(size/3)+'px'; bubble.style.fontWeight='900'; bubble.style.textShadow='0 0 6px rgba(0,0,0,0.6)'; } else if(Math.random()<0.5){ // فقاعات عادية bubble.textContent=texts[Math.floor(Math.random()*texts.length)]; bubble.style.fontSize=(size/3)+'px'; } wrap.appendChild(bubble); root.appendChild(wrap); // إزالة الفقاعة بعد انتهاء الحركة setTimeout(()=>wrap.remove(),22000); } // أول فقاعة فور التحميل spawnBubble(); // فقاعات تظهر بشكل متباعد وخفيف setInterval(spawnBubble,spawnInterval); })(); //---------------------------------------------------- (function() { // أنشئ عنصر التنبيه var alertBox = document.createElement('div'); alertBox.id = 'shop-alert'; alertBox.textContent = 'أوقات الطلب من الساعة 9 صباح الى الساعة 8 مساء'; document.body.appendChild(alertBox); function showAlert() { // احصل على الوقت الحالي var now = new Date(); var hour = now.getHours(); // إذا خارج الوقت المسموح if(hour < 9 || hour >= 20){ alertBox.style.opacity = '1'; // اخفاء بعد 5 ثواني setTimeout(function(){ alertBox.style.opacity = '0'; }, 5000); } } // عرض التنبيه عند تحميل الصفحة showAlert(); // اعادة عرض التنبيه كل 30 دقيقة (1800000 ms) setInterval(showAlert, 1800000); })();