(function() {
'use strict';
console.log('🌙 بدء الثيم الرمضاني...');
// ========== شاشة البداية ==========
(function createStartScreen() {
if (!sessionStorage.getItem('ramadan-visited-reda')) {
console.log('✅ إنشاء شاشة البداية...');
const screen = document.createElement('div');
screen.id = 'ramadan-start-loader';
screen.innerHTML = `
`;
document.body.appendChild(screen);
console.log('✅ الشاشة ظهرت!');
setTimeout(() => {
screen.style.transition = 'opacity 0.8s';
screen.style.opacity = '0';
setTimeout(() => {
screen.remove();
sessionStorage.setItem('ramadan-visited-reda', 'true');
console.log('✅ الشاشة اختفت');
}, 800);
}, 2500);
}
})();
// ========== إزالة العناصر غير المرغوبة ==========
function removeUnwanted() {
// زر القلب
document.querySelectorAll('.s-product-card-wishlist-btn, button[class*="wishlist"], button[aria-label*="wishlist"]').forEach(btn => btn.remove());
// المربع الأصفر
document.querySelectorAll('.s-product-card, .s-product-card-vertical, .product-card').forEach(product => {
product.querySelectorAll('div[style*="position: absolute"], span[style*="position: absolute"]').forEach(el => {
if ((el.style.cssText.includes('top')) &&
(el.style.cssText.includes('rgb(255, 193, 7)') || el.style.cssText.includes('#ffc107'))) {
el.remove();
}
});
});
}
// ========== تطبيق الحركات ==========
function startAnimations() {
console.log('🚀 بدء الحركات...');
removeUnwanted();
// ========== المنتجات - تظهر من اليمين لليسار بعد 4 ثوانٍ ==========
const products = document.querySelectorAll('.s-product-card-vertical, .s-product-card, .product-card, .product-item');
console.log('📦 المنتجات:', products.length);
// إخفاء من اليمين
products.forEach(p => {
p.style.opacity = '0';
p.style.transform = 'translateX(100px) scale(0.9)';
});
// إظهار بعد 4 ثوانٍ
setTimeout(() => {
console.log('⏰ بدء إظهار المنتجات...');
products.forEach((p, i) => {
setTimeout(() => {
p.style.opacity = '1';
p.style.transform = 'translateX(0) scale(1)';
console.log(`✅ منتج ${i + 1}`);
}, i * 120);
});
}, 4000);
// ========== جميع الصور والبنرات - تظهر عند التمرير ==========
const allImages = document.querySelectorAll(
'.slider-bg, .lazy__bg, .home-slider__content, .flex-center.container.pb-16, .flex.h-full.items-center.justify-center, .overlay, .banner-section, .s-block-banner, section.home-section.banner-section, img[src*="PCfTc3CXt30VAsb5gFUK6DVzBY5BA4JFPuVOTuXo"], div.w-4\\/6.text-center, div[class*="w-4/6"]'
);
console.log('🖼️ جميع الصور:', allImages.length);
// إخفاء جميع الصور أولاً
allImages.forEach(img => {
img.style.opacity = '0';
img.style.transform = 'translateY(50px) scale(0.95)';
img.style.transition = 'all 0.6s ease';
});
// Intersection Observer لإظهار الصور عند التمرير
const imageObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
// ظهور
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0) scale(1)';
} else {
// اختفاء
entry.target.style.opacity = '0';
entry.target.style.transform = 'translateY(50px) scale(0.95)';
}
});
}, {
threshold: 0.1,
rootMargin: '50px'
});
// مراقبة جميع الصور
allImages.forEach(img => {
imageObserver.observe(img);
});
// ========== حركات hover للصور ==========
allImages.forEach(img => {
img.style.cursor = 'pointer';
// ماوس
img.addEventListener('mouseenter', function() {
if (this.style.opacity === '1') {
this.style.transform = 'translateY(0) scale(1.03) rotate(1deg)';
}
});
img.addEventListener('mouseleave', function() {
if (this.style.opacity === '1') {
this.style.transform = 'translateY(0) scale(1) rotate(0deg)';
}
});
// لمس
let timeout;
img.addEventListener('touchstart', function() {
clearTimeout(timeout);
if (this.style.opacity === '1') {
this.style.transform = 'translateY(0) scale(1.03) rotate(1deg)';
}
}, { passive: true });
img.addEventListener('touchend', function() {
const el = this;
timeout = setTimeout(() => {
if (el.style.opacity === '1') {
el.style.transform = 'translateY(0) scale(1) rotate(0deg)';
}
}, 300);
}, { passive: true });
});
// ========== الصورة الأولى - بدون أي حركة ==========
const banner1 = document.querySelector('img[src*="ecc70f32-ccd1-48e2-9887-f39b30a60b24"]');
if (banner1) {
// إظهار فوراً بدون حركة
banner1.style.opacity = '1';
banner1.style.transform = 'none';
banner1.style.transition = 'none';
banner1.style.cursor = 'default';
banner1.style.pointerEvents = 'none';
// إلغاء المراقبة
imageObserver.unobserve(banner1);
// إزالة جميع الـ event listeners
const newBanner1 = banner1.cloneNode(true);
banner1.parentNode.replaceChild(newBanner1, banner1);
console.log('✅ الصورة الأولى بدون حركة');
}
console.log('✅ كل الحركات جاهزة');
}
// التشغيل
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', startAnimations);
} else {
startAnimations();
}
// فحص دوري
setInterval(removeUnwanted, 2000);
})();