document.querySelector("body > div.app-inner.flex.flex-col.min-h-full > header > div.main-nav-container.shadow-default.bg-white > div > div > div .flex.items-center.justify-end").innerHTML+= ` `; (function() { // رابط صور البنرات var desktopBannerUrl = "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754659679/aGjAO1bPORq95Dh2cNKlcoZh6SJjhx4B5ISJVc8l_t0rnkb.png"; var mobileBannerUrl = "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754693118/633a72c4-93bc-479c-8d09-6f7a55e20c82_gsm9kc.jpg"; // إنشاء عنصر الصورة var newBanner = document.createElement("img"); newBanner.alt = "بنر مخصص"; newBanner.style.display = "block"; newBanner.style.width = "100%"; newBanner.style.height = "auto"; newBanner.style.maxWidth = "100%"; newBanner.style.margin = "0 auto"; // اختيار الصورة حسب حجم الشاشة if (window.innerWidth <= 768) { newBanner.src = mobileBannerUrl; newBanner.width = 500; newBanner.height = 625; } else { newBanner.src = desktopBannerUrl; } // إيجاد حاوية البنر الأصلي var bannerContainer = document.querySelector(".banner.banner--fixed"); // إدخال البنر الجديد قبل الحاوية if (bannerContainer && bannerContainer.parentNode) { bannerContainer.parentNode.insertBefore(newBanner, bannerContainer); } })(); (function () { // اشتغل فقط في صفحات MooChuu if ( !window.location.href.startsWith("https://salla.sa/moochuu") && !window.location.href.startsWith("https://moochuusa.com/en") && !window.location.href.startsWith("https://moochuusa.com/") ) return; // 1) تطهير الروابط: إزالة المسافات حول الشرطة، وتحويل "%20 - " إلى "-" function sanitizeHref(href) { return href.replace(/%20\s*-\s*/gi, "-").replace(/\s*-\s*/g, "-"); } // 2) استخراج رقم البراند من الرابط function extractBrandId(href) { const m = href.match(/brand-(\d+)/); return m ? m[1] : null; } // 3) إزالة العناصر ذات أرقام البراند المكررة (نُبقي أول واحد فقط) function dedupeByBrandId(list) { const seen = new Set(); const out = []; for (const it of list) { const id = extractBrandId(it.href); if (!id) { console.warn("No brand id in href:", it.href); out.push(it); continue; } if (seen.has(id)) { console.warn("Duplicate brand id detected, removing slide:", id, it); continue; // تجاهل المكرر } seen.add(id); out.push(it); } return out; } const itemsRaw = [ // العناصر الجديدة { href: "https://moochuusa.com/ar/SWEETY%20ELEPHANT-سويتي%20ايليفانت/brand-1627792187", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754806498/SWEETYELEPHANT_tcyuct.png", alt: "SWEETY ELEPHANT" }, { href: "https://moochuusa.com/ar/premium%2001%20-%20بريميوم%2001/brand-853754372", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754806499/p01_cwwogz.png", alt: "PREMIUM 01" }, { href: "https://moochuusa.com/ar/premium%2002%20-%20بريميوم%2002/brand-214458629", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754806498/P02_ua2rch.png", alt: "PREMIUM 02" }, { href: "https://moochuusa.com/ar/premium%2007%20-%20بريميوم%2007/brand-1586921478", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754806498/P07_moz1kf.png", alt: "PREMIUM 07" }, { href: "https://moochuusa.com/ar/TWINNY%20-MC03/brand-594460067", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1755129407/twin_fpkpje.png", alt: "TWIN" }, { href: "https://moochuusa.com/ar/SWEETY%20FLOWER%20-%20%D8%B3%D9%88%D9%8A%D8%AA%D9%8A%20%D9%81%D9%84%D8%A7%D9%88%D8%B1/brand-273590552", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1755129410/%D8%B3%D9%88%D9%8A%D8%AA%D9%8A_%D9%81%D9%84%D8%A7%D9%88%D8%B1_kgh3dp.png", alt: "SWEETY FLOWER" }, // العناصر القديمة { href: "https://moochuusa.com/ar/CANDY%20-%20كاندي/brand-122211712", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685380/candy_dvl15o.png", alt: "CANDY" }, { href: "https://moochuusa.com/ar/CROSS%20SLIM%20-%20كروس%20سليم/brand-440022804", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685381/CROSS_SLIM_iddw57.png", alt: "CROSS SLIM" }, { href: "https://moochuusa.com/ar/CROSS%20-%20كروس/brand-895725191", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685382/cross_hc9xbw.png", alt: "CROSS" }, { href: "https://moochuusa.com/ar/CROSSY%20-%20كروسي/brand-1286405010", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685380/CROSSY_osezhd.png", alt: "CROSSY" }, { href: "https://moochuusa.com/ar/FLUFFY%20-%20فلافي/brand-332043287", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685382/FLUFFY_rkcrno.png", alt: "FLUFFY" }, { href: "https://moochuusa.com/ar/HARVEY%20-%20هارڤي/brand-1838658320", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685371/HARVEY_siffvg.png", alt: "HARVEY" }, { href: "https://moochuusa.com/ar/Hermey%20%20-%20إيرمي/brand-976443549", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685371/HERMEY_lgxngh.png", alt: "HERMEY" }, { href: "https://moochuusa.com/ar/Jangy%20-%20جانجي/brand-1925700753", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685377/JANGY_v9pdrk.png", alt: "JANGY" }, { href: "https://moochuusa.com/ar/POP%20THUMB%20-%20بوب%20ثمب/brand-1360391297", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685381/popthumb_cbhghv.png", alt: "POP THUMB" }, { href: "https://moochuusa.com/ar/SAILY%20-%20سايلي/brand-1065144849", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754692788/sailypng_iju8ek.png", alt: "SAILY" }, { href: "https://moochuusa.com/ar/SWEETY%20HEART%20-%20سويتي%20هارت/brand-889405212", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685385/SWEETYHEART_mh9piq.png", alt: "SWEETY HEART" }, { href: "https://moochuusa.com/ar/SWEETY%20STAR%20-%20سويتي%20ستار/brand-580099103", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685384/SWEETYSTAR_vhtdor.png", alt: "SWEETY STAR" }, { href: "https://moochuusa.com/ar/TWIN%20PLUS%20-%20توين%20بلاس/brand-884216529", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685371/twinplus_ac665j.png", alt: "TWIN PLUS" }, { href: "https://moochuusa.com/ar/TWIN%20-%20%D8%AA%D9%88%D9%8A%D9%86/brand-1542533543", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685386/TWIN_SLIM_vtqxat.png", alt: "TWIN SLIM" }, // TWINNY (تم إصلاح المسافة قبل الشرطة) { href: "https://moochuusa.com/ar/TWINNY-MC03/brand-594460067", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685384/TWINNY_sojn13.png", alt: "TWINNY" }, { href: "https://moochuusa.com/ar/CROSS%20PLUS%20-%20كروس%20بلس/brand-1846005415", img: "https://res.cloudinary.com/dcbncmw3y/image/upload/v1754685375/CROSSPLUS_ip8tot.png", alt: "CROSS PLUS" } ]; // طبّق التطهير + إزالة التكرارات const items = dedupeByBrandId( itemsRaw.map(it => ({ ...it, href: sanitizeHref(it.href) })) ); function loadCSS(href) { return new Promise((res, rej) => { const l = document.createElement("link"); l.rel = "stylesheet"; l.href = href; l.onload = res; l.onerror = rej; document.head.appendChild(l); }); } function loadJS(src) { return new Promise((res, rej) => { const s = document.createElement("script"); s.src = src; s.onload = res; s.onerror = rej; document.head.appendChild(s); }); } async function initSlider() { try { const featuresSection = document.querySelector("section.s-block.s-block--full-bg.wide-placeholder"); if (!featuresSection) throw "Features section not found"; await loadCSS("https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css"); await loadJS("https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js"); const heading = document.createElement("h1"); heading.className = "moochuu-heading"; heading.dir = "rtl"; heading.textContent = "صمّم على ذوقك"; heading.style.margin = "24px 17px 0"; heading.style.fontWeight = "700"; heading.style.fontSize = "1.5rem"; heading.style.textAlign = "right"; const style = document.createElement("style"); style.textContent = ` .moochuu-swiper { width: 100%; min-height: 200px; padding: 0 12px; box-sizing: border-box; } .moochuu-swiper .swiper-slide a { display: block; } .moochuu-swiper .swiper-slide img { width: 100%; display: block; transition: transform .3s ease; border-radius: 8px; } .moochuu-swiper .swiper-slide img:hover { transform: scale(1.05); } `; document.head.appendChild(style); const sliderId = "styles-swiper-" + Date.now(); const wrapper = document.createElement("div"); wrapper.innerHTML = `
`; const swWrap = wrapper.querySelector(".swiper-wrapper"); items.forEach((it) => { const slide = document.createElement("div"); slide.className = "swiper-slide"; slide.innerHTML = ` ${it.alt} `; swWrap.appendChild(slide); }); featuresSection.insertAdjacentElement("beforebegin", heading); featuresSection.insertAdjacentElement("beforebegin", wrapper); new Swiper(`#${sliderId}`, { slidesPerView: 5, spaceBetween: 12, grid: { rows: 2, fill: "row" }, loop: true, autoplay: { delay: 3000, disableOnInteraction: false }, breakpoints: { 1024: { slidesPerView: 5 }, 768: { slidesPerView: 4 }, 480: { slidesPerView: 3 }, 0: { slidesPerView: 2 } } }); } catch (e) { console.warn("Slider not inserted:", e); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", initSlider); } else { initSlider(); } })();