document.addEventListener("DOMContentLoaded", function () {
const checkInterval = setInterval(() => {
const grid = document.querySelector(".s-block--features .grid");
if (grid) {
let items = grid.querySelectorAll(".s-block--features__item");
if (items.length < 4) {
const lastItem = items[items.length - 1];
if (lastItem) {
const clone = lastItem.cloneNode(true);
const title = clone.querySelector("h2");
if (title) title.textContent = "خدمة عملاء 24 ساعة";
const desc = clone.querySelector("p");
if (desc) desc.textContent =
"خدمة عملاء متاحة طوال اليوم، جاهزين نساعدك في أي وقت";
grid.appendChild(clone);
}
}
if (grid.querySelectorAll(".s-block--features__item").length >= 4) {
clearInterval(checkInterval);
}
}
}, 300);
});
document.addEventListener('DOMContentLoaded', function () {
const target = document.querySelector('.yasmeen-features');
if (target) {
const images = [
'https://u.craffo.com/uploads/gsn/IMG_7225.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7226.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7227.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7228.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7229.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7230.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7231.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7232.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7233.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7234.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7235.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7236.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7237.jpg',
'https://u.craffo.com/uploads/gsn/IMG_7238.jpg',
];
const col1 = images.filter((_, i) => i % 3 === 0);
const col2 = images.filter((_, i) => i % 3 === 1);
const col3 = images.filter((_, i) => i % 3 === 2);
function buildColumn(imgs, extraClass = '') {
const doubled = [...imgs, ...imgs];
return `
`;
}
target.innerHTML = `
تابعنا على التيك توك
انضموا إلينا في رحلة استكشاف عالمنا، حيث نشارك كل لحظة جميلة ونستمتع بتفاصيل الحياة الصغيرة.
${buildColumn(col1, 'up')}
${buildColumn(col2, 'down')}
${buildColumn(col3, 'up-slow')}
`;
const style = document.createElement('style');
style.innerHTML = `
.col .inner.up {
animation: scroll-up 20s linear infinite;
}
.col .inner.down {
animation: scroll-down 22s linear infinite;
}
.col .inner.up-slow {
animation: scroll-up 30s linear infinite;
}
@keyframes scroll-up {
0% { transform: translateY(0); }
100% { transform: translateY(-50%); }
}
@keyframes scroll-down {
0% { transform: translateY(-50%); }
100% { transform: translateY(0); }
}
`;
document.head.appendChild(style);
}
});
document.addEventListener("DOMContentLoaded", function () {
const sections = document.querySelectorAll(".yasmeen-countdown-with-image");
sections.forEach(section => {
const imgBox = section.querySelector(".rounded-\\[\\.25rem\\]");
const buttonBox = section.querySelector(".w-full.h-14");
if (imgBox) {
const firstBtn = section.querySelector("a"); if (firstBtn) {
firstBtn.classList.add("move-btn");
imgBox.appendChild(firstBtn);
if (buttonBox) {
buttonBox.remove();
}
section.querySelectorAll("a.move-btn").forEach((btn, index) => {
if (index > 0) btn.remove();
});
}
}
});
});
document.addEventListener("DOMContentLoaded", function() {
const h2s = document.querySelectorAll(".yasmeen-countdown-with-image h2");
h2s.forEach(h2 => {
h2.innerHTML = `مع كل طلب
يعود إليك جزء من الجمال
10% كاش باك
تضاف تلقائيًا لمحفظتك`;
});
});
document.addEventListener("DOMContentLoaded", function() {
const links = document.querySelectorAll(".yasmeen-countdown-with-image a.move-btn");
links.forEach(link => {
link.href = "https://gsn.sa/latest-products";
});
});
document.addEventListener("DOMContentLoaded", function() {
const whatsappLink = document.querySelector(".yasmeen-contact a[href*='whatsapp']");
if (whatsappLink) {
whatsappLink.setAttribute("href", "https://linktr.ee/ALF_GSN");
}
});