(function() {
// 1. التحقق الصارم: هل نحن في الصفحة الرئيسية؟
// سلة تضع كلاس page-home في جسم الصفحة الرئيسية فقط
const isHome = document.body.classList.contains('page-home') ||
window.location.pathname === '/' ||
window.location.pathname === '/index';
// إذا لم تكن الرئيسية، لا تنفذ أي شيء
if (!isHome) return;
// 2. بيانات الأقسام
const myCategories = [
{
name: "زينة السيارات",
image: "https://f.top4top.io/p_3649qq22k1.png",
link: "https://ahmwahid.com/ar/%D8%A7%D9%83%D8%B3%D8%B3%D9%88%D8%A7%D8%B1%D8%A7%D8%AA/c555301229"
},
{
name: "باقات التلميع",
image: "https://images.unsplash.com/photo-1607860108855-64acf2078ed9?q=80&w=1000",
link: "https://ahmwahid.com/ar/%D8%A7%D9%84%D8%A8%D9%83%D8%AC%D8%A7%D8%AA/c807397289"
},
{
name: "إضاءة LED",
image: "https://images.unsplash.com/photo-1514316454349-750a7fd3da3a?q=80&w=1000",
link: "https://ahmwahid.com/ar/%D8%B4%D9%85%D8%B9%D8%A7%D8%AA-%D8%A7%D9%85%D8%A7%D9%85%D9%8A/c895662718"
},
{
name: "عناية داخلية",
image: "https://repair2care.com/wp-content/uploads/Interior_detailing-scaled.webp",
link: "https://ahmwahid.com/ar/%D9%85%D9%86%D8%B8%D9%81%D8%A7%D8%AA-%D9%88%D9%85%D9%84%D9%85%D8%B9%D8%A7%D8%AA-%D8%AF%D8%A7%D8%AE%D9%84%D9%8A%D8%A9/c1076728261"
}
];
// 3. إنشاء الهيكل
const section = document.createElement('section');
section.className = 'luxury-categories-section';
section.innerHTML = `
تصفح أقسامنا الفخمة
`;
// 4. وضع القسم في أول المحتوى (تحت الهيدر)
const mainWrapper = document.querySelector('main') || document.querySelector('#main-content') || document.body;
if (mainWrapper) {
mainWrapper.prepend(section);
const grid = document.getElementById('mainCatGrid');
myCategories.forEach(cat => {
const card = `
${cat.name}
استكشف الآن ←
`;
grid.insertAdjacentHTML('beforeend', card);
});
}
})();
(function() {
// ننتظر تحميل السلايدر بالكامل
window.addEventListener('load', function() {
const productCards = document.querySelectorAll('.product-entry');
productCards.forEach(card => {
// إضافة تأثير "لمعان" (Glass Flash) عند التحويم
card.addEventListener('mouseenter', function() {
const flash = document.createElement('div');
flash.style.cssText = `
position: absolute;
top: 0; left: -100%;
width: 50%; height: 100%;
background: linear-gradient(to right, transparent, rgba(255,212,0,0.2), transparent);
transform: skewX(-25deg);
transition: 0.5s;
z-index: 1;
`;
this.appendChild(flash);
setTimeout(() => flash.style.left = '150%', 50);
setTimeout(() => flash.remove(), 600);
});
});
});
})();
(function() {
// التأكد من العمل في الصفحة الرئيسية فقط
const isHome = document.body.classList.contains('page-home') || window.location.pathname === '/' || window.location.href.includes('index.php');
if (!isHome) return;
// 1. إعدادات البنر (تم وضع رابط صورتك هنا)
const bannerData = {
title: "سهلنا عليك!",
subtitle: "اطلب من متجر اهم واحد وانت في بيتك فخامة سيارتك تبدا من هنا",
image: "https://k.top4top.io/p_3649cnzes1.jpg",
btnText: "تسوق الآن",
btnLink: "https://www.ahmwahid.com"
};
// 2. إنشاء هيكل البنر
const hero = document.createElement('div');
hero.className = 'luxury-hero-banner';
hero.innerHTML = `
${bannerData.title}
${bannerData.subtitle}
${bannerData.btnText}
`;
// 3. حقن البنر في المكان الصحيح
const mainContainer = document.querySelector('.main-content') || document.querySelector('main') || document.body.firstChild;
if (mainContainer && mainContainer.parentNode) {
mainContainer.parentNode.insertBefore(hero, mainContainer);
} else {
document.body.prepend(hero);
}
// 4. تأثير Parallax مع حركة الماوس
document.addEventListener('mousemove', (e) => {
const img = document.getElementById('heroImg');
if (img) {
const x = (window.innerWidth - e.pageX * 2) / 100;
const y = (window.innerHeight - e.pageY * 2) / 100;
img.style.transform = `scale(1.1) translate(${x}px, ${y}px)`;
}
});
})();
(function() {
// التأكد أن كل نصوص الفوتر يمين 100%
const footerElements = document.querySelectorAll('.store-footer__inner *');
footerElements.forEach(el => {
el.style.textAlign = 'right';
});
// ترتيب أعمدة الفوتر في الجوال لتكون تحت بعض بانتظام
if (window.innerWidth < 768) {
const inner = document.querySelector('.store-footer__inner');
if (inner) {
inner.style.display = 'block';
const divs = inner.querySelectorAll(':scope > div');
divs.forEach(d => {
d.style.marginBottom = '30px';
d.style.borderRight = 'none';
});
}
}
})();
(function() {
const cards = document.querySelectorAll('.cat-card-item');
cards.forEach(card => {
card.addEventListener('mousemove', (e) => {
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left; // موقع الماوس داخل الكارت
const y = e.clientY - rect.top;
// تحديث الظل برمجياً ليكون في اتجاه الماوس
card.style.boxShadow = `
${(x - rect.width / 2) / 10}px
${(y - rect.height / 2) / 10}px
30px rgba(255, 212, 0, 0.25)
`;
});
// إعادة الظل لوضعه الطبيعي عند خروج الماوس
card.addEventListener('mouseleave', () => {
card.style.boxShadow = '0 15px 45px rgba(255, 212, 0, 0.2)';
card.style.transform = 'translateY(0) scale(1)';
});
});
})();
(function() {
const sectionTitles = document.querySelectorAll('.s-slider-block__title h2');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.transition = 'all 0.8s ease';
entry.target.style.opacity = '1';
entry.target.style.filter = 'drop-shadow(0 0 5px rgba(255,255,255,0.2))';
}
});
}, { threshold: 0.5 });
sectionTitles.forEach(title => {
title.style.opacity = '0.5'; // يبدأ خافت قليلاً
observer.observe(title);
});
})();
(function() {
// مراقبة تغيير الشرائح في السلايدر
const reviewsContainer = document.querySelector('.s-reviews-container');
if (reviewsContainer) {
reviewsContainer.addEventListener('mouseover', function() {
// إضافة لمسة برمجية لزيادة سطوع النجوم عند مرور الماوس
const stars = this.querySelectorAll('.s-rating-stars');
stars.forEach(s => s.style.filter = 'brightness(1.2)');
});
reviewsContainer.addEventListener('mouseleave', function() {
const stars = this.querySelectorAll('.s-rating-stars');
stars.forEach(s => s.style.filter = 'brightness(1)');
});
}
})();
(function() {
const wrapper = document.querySelector('.s-reviews-header-wrapper');
if (wrapper) {
wrapper.style.textAlign = 'right';
wrapper.style.direction = 'rtl';
// التأكد من أن العنوان الداخلي أبيض تماماً
const title = wrapper.querySelector('h2');
if (title) {
title.style.color = '#ffffff';
}
}
})();
(function() {
// جلب كل حاويات الأسماء
const nameWrappers = document.querySelectorAll('.s-reviews-testimonial__name_wrapper');
nameWrappers.forEach(wrapper => {
// التأكد من عدم تكرار الإضافة
if (!wrapper.querySelector('.verified-badge')) {
const badge = document.createElement('span');
badge.className = 'verified-badge';
badge.innerHTML = ' ✓'; // رمز التوثيق
badge.style.color = '#FFD400';
badge.style.fontSize = '12px';
badge.style.marginRight = '5px';
badge.title = 'عميل موثوق';
wrapper.appendChild(badge);
}
});
})();
(function() {
// 1. فحص هل العميل زار الصفحة الرئيسية في هذه الجلسة أم لا
// وأيضاً التأكد أنه في الصفحة الرئيسية فقط
const isHome = document.body.classList.contains('page-home') || window.location.pathname === '/';
const hasSeenLoader = sessionStorage.getItem('luxury_loader_seen');
if (isHome && !hasSeenLoader) {
// 2. بيانات الشاشة
const loaderData = {
logoUrl: "https://k.top4top.io/p_3650m955o1.png",
welcomeMsg: "يسعدنا زيارتكم متجر اهم واحد"
};
// 3. إنشاء شاشة التحميل
const loader = document.createElement('div');
loader.id = 'luxury-loader';
loader.innerHTML = `
${loaderData.welcomeMsg}
`;
document.body.prepend(loader);
// 4. وظيفة الإخفاء
window.addEventListener('load', function() {
setTimeout(() => {
const loaderElement = document.getElementById('luxury-loader');
if (loaderElement) {
loaderElement.classList.add('loader-hidden');
document.body.classList.add('loaded-content');
// تسجيل أن العميل شاف الشاشة عشان ما تظهر ثاني
sessionStorage.setItem('luxury_loader_seen', 'true');
setTimeout(() => {
loaderElement.remove();
}, 1000);
}
}, 3500); // قللت الوقت لـ 3.5 ثانية عشان ما يمل العميل، تقدر ترجعها 5000 لو تبي
});
} else {
// إذا كان العميل قد شاهدها أو ليس في الرئيسية، نجعل المحتوى يظهر فوراً بدون انيميشن
document.body.classList.add('loaded-content');
}
})();
document.addEventListener("DOMContentLoaded", function() {
const paymentImages = [
'https://l.top4top.io/p_3650zpzek1.png',
'https://l.top4top.io/p_3650dhqvc1.png',
'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/MasterCard_Logo.svg/2560px-MasterCard_Logo.svg.png',
'https://b.top4top.io/p_3650mogue1.png',
'https://cdn.salla.sa/BrpXdn/SODDiykqz3BLoqRacMcyyoIxfk7uKrbKqvNCqRKs.png'
];
const section = document.createElement('div');
section.className = 'custom-payments-section';
const title = document.createElement('h2');
title.className = 'payments-title';
title.innerText = 'وفرنا لكم خيارات دفع متميزة وآمنة';
section.appendChild(title);
const container = document.createElement('div');
container.className = 'premium-payments-container';
paymentImages.forEach(url => {
const card = document.createElement('div');
card.className = 'payment-card-premium';
const img = document.createElement('img');
img.src = url;
card.appendChild(img);
container.appendChild(card);
});
section.appendChild(container);
// هذا الجزء هو المسؤول عن وضع الكود تحت البنر مباشرة
// جربنا أشهر كلاسات البنرات في سلة
const targetBanner = document.querySelector('.s-bundle-item, .banner--fixed, .main-slider, .s-slider-block, .s-block-banners');
if (targetBanner) {
targetBanner.insertAdjacentElement('afterend', section);
} else {
// إذا لم يجد بنر، يبحث عن أول قسم في الصفحة ويضع الكود قبله
const firstSection = document.querySelector('section');
if (firstSection) {
firstSection.before(section);
}
}
});
document.addEventListener("DOMContentLoaded", function() {
// شرط التحقق: يظهر الكود فقط إذا كان المستخدم في الصفحة الرئيسية
// "/" تعني الصفحة الرئيسية في معظم المنصات (مثل سلة، زد، أو المواقع الخاصة)
const isHomePage = window.location.pathname === "/" || window.location.pathname === "/index.html" || window.location.pathname.endsWith(".com/");
if (isHomePage) {
// 1. إنشاء العناصر الأساسية
const overlay = document.createElement('div');
overlay.className = 'ronaq-overlay';
const card = document.createElement('div');
card.className = 'ronaq-card';
// 2. زر الإغلاق
const closeBtn = document.createElement('span');
closeBtn.className = 'close-btn';
closeBtn.innerHTML = '×';
closeBtn.onclick = () => overlay.remove();
// 3. المحتوى النصي
const title = document.createElement('div');
title.className = 'ronaq-title';
title.innerText = 'هدية خاصة لك!';
const desc = document.createElement('div');
desc.className = 'ronaq-desc';
desc.innerText = 'نقدم لك من اهم واحد كوبون لجميع مشترياتك، انسخ الكود واستمتع بالتسوق.';
const couponBox = document.createElement('div');
couponBox.className = 'coupon-box';
couponBox.innerText = 'AHM';
const hint = document.createElement('small');
hint.className = 'copy-hint';
hint.innerText = 'انقر على الكود لنسخه تلقائياً';
// 4. وظيفة النسخ الذكي
couponBox.addEventListener('click', function() {
const code = "AHM";
navigator.clipboard.writeText(code).then(() => {
const originalText = couponBox.innerText;
couponBox.innerText = 'تم النسخ بنجاح!';
couponBox.style.color = '#27ae60';
couponBox.style.borderColor = '#27ae60';
setTimeout(() => {
couponBox.innerText = originalText;
couponBox.style.color = '#d4af37';
couponBox.style.borderColor = '#d4af37';
}, 2000);
});
});
// 5. تجميع البطاقة وإضافتها للجسم
card.appendChild(closeBtn);
card.appendChild(title);
card.appendChild(desc);
card.appendChild(couponBox);
card.appendChild(hint);
overlay.appendChild(card);
// إظهارها بعد ثانية واحدة
setTimeout(() => {
document.body.appendChild(overlay);
}, 1000);
}
});