/* Add custom Js styles below */
/* Add custom Js styles below */
/* Add custom Js styles below */
/* Add custom Js code below */
/* Add custom Js code below */
/* Add custom Js code below */
document.addEventListener("DOMContentLoaded", () => {
// ✅ إنشاء قسم مميزات متجر Aura Me بدون بوكس خارجي وبألوان واضحة
const featuresSection = document.createElement("section");
featuresSection.id = "aurame-features";
featuresSection.innerHTML = `
الأسئلة الشائعة لمتجر Aura Me
ما أنواع المنتجات التي يقدمها متجر Aura Me؟
▼
يقدم متجر Aura Me مجموعة واسعة من منتجات الميكب، العطور، واقيات الشمس، والعناية بالبشرة والشعر والجسم من أفضل الماركات الأصلية.
هل المنتجات أصلية ومضمونة؟
▼
نعم، جميع منتجات Aura Me أصلية 100٪ ويتم توريدها من الوكلاء والموزعين المعتمدين فقط لضمان الجودة والثقة.
هل تتوفر خدمة التوصيل لجميع المحافظات؟
▼
نعم، نوفر خدمة التوصيل لجميع المناطق داخل المملكه مع تغليف آمن وسريع للحفاظ على المنتجات أثناء الشحن.
هل يمكن استبدال أو إرجاع المنتج؟
▼
بالتأكيد، يمكنك استبدال أو إرجاع المنتج خلال 14 يومًا من الاستلام بشرط أن يكون غير مستخدم وفي عبوته الأصلية.
هل يقدم المتجر نصائح للعناية بالبشرة والشعر؟
▼
نعم، نقدم بشكل دوري نصائح ومقالات عن العناية بالبشرة والشعر واختيار المنتجات المناسبة لكِ عبر موقعنا وصفحاتنا على السوشيال ميديا.
`;
// ✅ تفعيل الحركة عند النقر
faqSection.addEventListener("click", (e) => {
const item = e.target.closest(".faq-item");
if (!item) return;
item.classList.toggle("active");
});
// ✅ إدراج القسم قبل الفوتر
const footer = document.querySelector("footer") || document.body;
footer.parentNode.insertBefore(faqSection, footer);
});
window.addEventListener("load", function () {
// إنشاء زر التقييم
const rateStoreBtn = document.createElement("button");
rateStoreBtn.innerText = "⭐ قيّم المتجر";
Object.assign(rateStoreBtn.style, {
position: "fixed",
bottom: "100px",
left: "20px",
background: "#4CAF50",
color: "#fff",
border: "none",
borderRadius: "8px",
padding: "10px 14px",
cursor: "pointer",
zIndex: "999999",
fontSize: "14px",
boxShadow: "0 4px 10px rgba(0,0,0,0.2)"
});
document.body.appendChild(rateStoreBtn);
// نافذة التقييم
function showStoreRatingPopup() {
if (document.getElementById("store-rating-popup")) return;
const popup = document.createElement("div");
popup.id = "store-rating-popup";
Object.assign(popup.style, {
position: "fixed",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
background: "rgba(255,255,255,0.95)",
padding: "20px",
borderRadius: "12px",
boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
zIndex: "1000000",
width: "300px",
textAlign: "center"
});
const title = document.createElement("h3");
title.innerText = "⭐ قيّم تجربتك مع المتجر";
title.style.marginBottom = "10px";
popup.appendChild(title);
const textarea = document.createElement("textarea");
textarea.placeholder = "اكتب رأيك هنا...";
Object.assign(textarea.style, {
width: "100%",
height: "80px",
borderRadius: "8px",
padding: "6px",
margin: "10px 0",
border: "1px solid #ddd"
});
popup.appendChild(textarea);
const saveBtn = document.createElement("button");
saveBtn.innerText = "إرسال التقييم";
Object.assign(saveBtn.style, {
display: "block",
width: "100%",
padding: "8px",
borderRadius: "8px",
border: "none",
background: "#4CAF50",
color: "#fff",
cursor: "pointer",
marginTop: "10px"
});
saveBtn.addEventListener("click", () => {
if (textarea.value.trim() === "") {
alert("من فضلك اكتب تعليقك ✍️");
return;
}
alert("✅ شكراً لتقييمك للمتجر!");
popup.remove();
});
popup.appendChild(saveBtn);
const closeBtn = document.createElement("span");
closeBtn.innerText = "✖";
Object.assign(closeBtn.style, {
position: "absolute",
top: "8px",
right: "12px",
cursor: "pointer",
fontSize: "18px"
});
closeBtn.addEventListener("click", () => popup.remove());
popup.appendChild(closeBtn);
document.body.appendChild(popup);
}
// ربط الزر بالنافذة
rateStoreBtn.addEventListener("click", showStoreRatingPopup);
});
function enhanceCards() {
const cards = document.querySelectorAll('.s-product-card-entry');
if (cards.length === 0) return;
cards.forEach((card, index) => {
if (card.querySelector('.product-rating')) return;
// نجوم التقييم
const stars = document.createElement('div');
stars.className = 'product-rating';
const rating = Math.floor(Math.random() * 2) + 4;
for (let i = 0; i < 5; i++) {
const star = document.createElement('span');
star.innerHTML = i < rating ? '★' : '☆';
stars.appendChild(star);
}
stars.style.color = '#ffd700';
stars.style.fontSize = '18px';
stars.style.margin = '6px 0';
card.querySelector('.s-product-card-content-main')?.appendChild(stars);
// بادج (جديد أو خصم)
const badge = document.createElement('div');
badge.className = 'product-badge';
badge.textContent = index % 2 === 0 ? 'جديد' : 'اشترى الان';
badge.style.cssText = `
position: absolute;
top: 8px;
right: 8px;
background-color: #33005d;
color: white;
padding: 4px 10px;
border-radius: 6px;
font-size: 13px;
font-weight: bold;
z-index: 10;
`;
card.style.position = 'relative';
card.appendChild(badge);
});
}
let tryCount = 0;
const interval = setInterval(() => {
enhanceCards();
tryCount++;
if (tryCount > 10) clearInterval(interval);
}, 1000)
function checkVisibility() {
const products = document.querySelectorAll(".s-product-card-vertical");
products.forEach((product) => {
const position = product.getBoundingClientRect();
if (position.top < window.innerHeight * 0.9 && position.bottom >= 0) {
product.classList.add("visible");
} else {
product.classList.remove("visible"); // 👈 لإعادة التأثير عند التمرير للأعلى
}
});
}
function observeElements() {
const observer = new MutationObserver(() => {
checkVisibility(); // 👈 تحقق من الرؤية عند تحديث الـ DOM
});
observer.observe(document.body, { childList: true, subtree: true });
window.addEventListener("scroll", checkVisibility);
}
window.addEventListener("load", observeElements);
document.addEventListener("DOMContentLoaded", function () {
// البحث عن عنصر الفوتر
var footerSection = document.querySelector(".store-footer");
if (!footerSection) return; // إذا لم يتم العثور على الفوتر، يتوقف الكود
// إنشاء حاوية قسم آراء العملاء
var reviewsContainer = document.createElement("div");
reviewsContainer.id = "reviews-container";
reviewsContainer.style.cssText = `
width: 90%;
max-width: 1200px;
margin: 50px auto 20px;
padding: 20px;
background: transparent; /* جعل الخلفية شفافة */
font-family: Arial, sans-serif;
text-align: center;
direction: rtl; /* لتتماشى مع اللغة العربية */
`;
footerSection.parentNode.insertBefore(reviewsContainer, footerSection); // إدراج القسم قبل الفوتر
// بيانات الآراء الوهمية بتنسيق سعودي
var reviews = [
{ name: "عبدالله القحطاني", text: "منتجات عالية الجودة وسرعة في التوصيل، أنصح الجميع بهذا المتجر!", stars: 5, img: "https://i.pinimg.com/736x/5c/7e/94/5c7e94dd55c06c2e2f395b3c826deb3c.jpg" },
{ name: "نورة العتيبي", text: "خدمة العملاء ممتازة جدًا والأسعار منافسة، تجربة رائعة.", stars: 4, img: "https://i.pinimg.com/736x/ae/a6/2b/aea62bb75e293d52e411fcc7bd5124fc.jpg" },
{ name: "سعود الدوسري", text: "أكثر من رائع! تغليف احترافي وشحن سريع، سأكرر الشراء بالتأكيد.", stars: 5, img: "https://i.pinimg.com/736x/25/b9/c9/25b9c99d1a7f5bcc86d09ee85d82ee02.jpg" },
{ name: "فاطمة الزهراني", text: "تجربة مميزة، المنتجات فاقت توقعاتي!", stars: 5, img: "https://i.pinimg.com/736x/fd/20/26/fd2026354863f45e76a2e07b1ed869d4.jpg" }
];
// عرض جميع المراجعات معًا
reviews.forEach((reviewData) => {
var review = document.createElement("div");
review.className = "review";
// إضافة القسم الذي يحتوي على النص والنجوم
var content = document.createElement("div");
content.className = "content";
// إضافة النجوم
var stars = document.createElement("div");
stars.className = "stars";
stars.innerHTML = "★".repeat(reviewData.stars) + "☆".repeat(5 - reviewData.stars);
// إضافة النص
var text = document.createElement("p");
text.className = "quote";
text.innerHTML = reviewData.text;
content.appendChild(stars);
content.appendChild(text);
// إضافة الاسم والصورة
var nameImg = document.createElement("div");
nameImg.className = "user-info";
var img = document.createElement("img");
img.src = reviewData.img;
img.alt = reviewData.name;
var name = document.createElement("p");
name.innerHTML = `