`;
// إضافة العنصر في نهاية الفوتر
const footer = document.querySelector('.store-footer');
if (footer) {
footer.appendChild(devCredit);
}
});
document.addEventListener("DOMContentLoaded", function() {
// 1. فحص الأمان للتأكد من عدم تكرار العنصر
if (document.getElementById('alzaiem-stats-wrapper')) return;
// 2. إنشاء الحاوية الرئيسية للسيكشن
const statsSection = document.createElement('section');
statsSection.id = 'alzaiem-stats-wrapper';
statsSection.className = 'seraj-stats-section';
// 3. بناء محتوى الإحصائيات (HTML) داخل الجافا سكريبت
statsSection.innerHTML = `
👥
0+
عميل يثق بنا
📦
0+
طلب مكتمل
⭐
0%
تقييمات ممتازة
🏆
0+
سنوات خبرة
`;
// 4. تحديد مكان الحقن (قبل الفوتر مباشرة)
const footer = document.querySelector('.store-footer') || document.querySelector('footer');
if (footer) {
footer.parentNode.insertBefore(statsSection, footer);
} else {
document.body.appendChild(statsSection);
}
// 5. محرك العداد (Counter Engine)
const startCounter = () => {
const counters = document.querySelectorAll('.stat-number');
counters.forEach(counter => {
const target = +counter.getAttribute('data-target');
let current = 0;
const increment = target / 40;
const timer = setInterval(() => {
current += increment;
if (current >= target) {
counter.innerText = target;
clearInterval(timer);
} else {
counter.innerText = Math.ceil(current);
}
}, 40);
});
};
// تشغيل العداد عند الوصول للسيكشن بالتمرير
const observer = new IntersectionObserver((entries) => {
if(entries[0].isIntersecting) {
startCounter();
observer.disconnect();
}
}, { threshold: 0.2 });
observer.observe(statsSection);
});
document.addEventListener("DOMContentLoaded", function() {
// 1. فحص الأمان لمنع التكرار
if (document.getElementById('whatsapp-floating-btn')) return;
// 2. إنشاء عنصر الأيقونة
const whatsappBtn = document.createElement('a');
whatsappBtn.id = 'whatsapp-floating-btn';
// 3. ضعي رقم واتساب المتجر هنا (بدل الرقم الحالي)
const whatsappNumber = "+966563369935";
whatsappBtn.href = `https://wa.me/${whatsappNumber}`;
whatsappBtn.target = "_blank";
// 4. إضافة شكل الأيقونة (SVG) والتنسيق
whatsappBtn.innerHTML = `
`;
// 5. إضافة الأيقونة للجسم الرئيسي للصفحة
document.body.appendChild(whatsappBtn);
});
document.addEventListener("DOMContentLoaded", function() {
// 1. فحص الأمان: هل شاهد الزائر اللودر في هذه الجلسة؟
if (sessionStorage.getItem('seraj_loader_shown')) {
// إذا شاهده، لا تفعل شيئاً واخرج
return;
}
// 2. إعداد بيانات اللودر (اللوجو والجملة الترحيبية)
const logoURL = "https://cdn.files.salla.network/theme/1896577086/39caddaa-f803-4309-9f24-811d148fcb48.webp";
const welcomeMessage = "مرحباً بكم في عالم سراج.. حيث يضيء التميز";
// 3. إنشاء هيكل اللودر (HTML)
const loaderHTML = `
${welcomeMessage}
`;
// 4. إضافة اللودر للصفحة
document.body.insertAdjacentHTML('beforeend', loaderHTML);
// 5. وظيفة إخفاء اللودر وتسجيل المشاهدة
const hideLoader = () => {
const loader = document.getElementById('seraj-premium-loader');
if (loader) {
loader.classList.add('fade-out');
// تسجيل المشاهدة في الـ Session Storage لمنع التكرار في هذه الجلسة
sessionStorage.setItem('seraj_loader_shown', 'true');
// حذف العنصر نهائياً من الـ DOM بعد انتهاء الحركة لتسريع الصفحة
setTimeout(() => { loader.remove(); }, 800);
}
};
// إخفاء اللودر تلقائياً بعد انتهاء وقت التحميل المقدر (3 ثوانٍ)
// أو يمكن ربطه بحدثwindow.onload لتشغيله بدقة أكبر
setTimeout(hideLoader, 3000);
});