/* ===== COTTONIL KSA — custom theme layer ===== */
(function(){if(document.getElementById("cn-font"))return;var l=document.createElement("link");l.id="cn-font";l.rel="stylesheet";l.href="https://fonts.googleapis.com/css2?family=Alexandria:wght@300;400;500;600&display=swap";document.head.appendChild(l);})();
/* ===== header ===== */
(function () {
/* ---- editable settings ---- */
var CFG = {
whatsapp: "966597826007",
shippingNote: "شحن سريع لجميع مناطق المملكة",
messages: [
{ text: "عروض حصرية على منتجات قطونيل", strong: "تسوّق العروض", href: "/offers" },
{ text: "قطن مصري أصلي 100%", strong: "اكتشف التشكيلة", href: "/" },
{ text: "توصيل خلال 2 – 7 أيام", strong: "لكل مناطق المملكة", href: "/offers" }
],
// center links (pages). "hot" = small red dot
pages: [
{ t: "الرئيسية", h: "/" },
{ t: "العروض", h: "/offers", hot: true },
{ t: "المتجر", h: "/redirect/pages/2045044345" },
{ t: "من نحن", match: "من نحن" },
{ t: "فروعنا", match: "فروعنا" },
{ t: "تواصل معنا", match: "تواصل معنا", fb: "/redirect/pages/400881110" }
],
// menu items that are NOT collections
notCollections: ["تخفيضات", "وصل حديثا", "الأكثر مبيعا"],
// stock images for mega menus (swap later for brand media)
images: [
{ k: "رجال", src: "https://cdn.salla.sa/NoOnD/products/CKy5B6rlHUNNBf2M8ETIUxT5XrVizcDOfgcrzot8.jpg", sub: "MEN'S ESSENTIALS" },
{ k: "نسا", src: "https://cdn.salla.sa/NoOnD/products/Fn9jVwTiQLyLnexRZ2qNFL4UQa5R1AqWXwjOo2jz.jpg", sub: "WOMEN'S COLLECTION" },
{ k: "اطفال", src: "https://cdn.salla.sa/NoOnD/products/VbsoXDHYxxI1jcLFgYlkoC46XE3yBUclG4SRxIF3.jpg", sub: "KIDS" },
{ k: "مناشف", src: "https://cdn.salla.sa/NoOnD/products/fUm8UzJRahsrSwQ4SB2reYrlRgh7obS6JeJ2gIgq.jpg", sub: "BATH & HOME" },
{ k: "", src: "https://cdn.salla.sa/NoOnD/products/CJFcDMlMdnYSUfda3HyVTc3FXqN5dxrJ4O4tPYrA.jpg", sub: "COTTONIL" }
]
};
function el(tag, cls, html) { var e = document.createElement(tag); if (cls) e.className = cls; if (html != null) e.innerHTML = html; return e; }
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function path(u) { try { return decodeURIComponent(new URL(u, location.href).pathname).replace(/\/$/, ""); } catch (e) { return u; } }
var here = path(location.href);
function build() {
var header = document.querySelector(".store-header");
var menu = document.querySelector("#mobile-menu");
if (!header || !menu || document.getElementById("cnx")) return !!document.getElementById("cnx");
/* read menu */
var items = [];
menu.querySelectorAll(".main-menu > li").forEach(function (li) {
var a = li.querySelector(":scope > a.sidemenu-link");
if (!a) return;
var title = (a.textContent || "").trim();
var kids = [];
li.querySelectorAll(":scope > ul > li > a.sidemenu-link").forEach(function (c) {
kids.push({ t: (c.textContent || "").trim(), h: c.href, all: c.classList.contains("display-all-category") });
});
items.push({ t: title, h: a.href, kids: kids });
});
var pageLinks = {};
menu.querySelectorAll(".links-menu a, .footer-list a").forEach(function (a) { pageLinks[(a.textContent || "").trim()] = a.href; });
function find(name) {
for (var i = 0; i < items.length; i++) if (items[i].t === name) return items[i].h;
return pageLinks[name];
}
/* root */
var root = el("div"); root.id = "cnx"; root.setAttribute("dir", "rtl");
/* top bar */
var msgs = CFG.messages.map(function (m) {
return '' + esc(m.text) + ' · ' + esc(m.strong) + ' ← ';
}).join("");
root.appendChild(el("div", "cnx-bar",
'
' +
'
' + esc(CFG.shippingNote) + '
' +
'
' + msgs + '
' +
'
' +
'
'));
/* main row */
var main = el("div", "cnx-main"); var wrap = el("div", "cnx-wrap"); main.appendChild(wrap);
var brand = el("div", "cnx-brand"); var logo = header.querySelector(".navbar-brand"); if (logo) brand.appendChild(logo);
var pages = el("nav", "cnx-pages"); pages.setAttribute("aria-label", "الصفحات");
CFG.pages.forEach(function (p) {
var h = p.h || find(p.match) || p.fb; if (!h) return;
var a = el("a", p.hot ? "cnx-hot" : "", esc(p.t)); a.href = h;
var pid = /\/redirect\/pages\/(\d+)/.exec(h);
if (path(h) === here || (pid && here.indexOf("page-" + pid[1]) > -1)) a.classList.add("is-active");
if (/^https?:\/\/wa\.me/.test(h)) { a.target = "_blank"; a.rel = "noopener"; }
pages.appendChild(a);
});
var actions = el("div", "cnx-actions");
var search = header.querySelector(".search-btn");
var user = header.querySelector('[onclick*="login"], salla-user-menu, .header-btn[href*="profile"]');
var cart = header.querySelector("salla-cart-summary");
var burger = header.querySelector(".mburger");
[search, user, cart, burger].forEach(function (n) { if (n) actions.appendChild(n); });
wrap.appendChild(brand); wrap.appendChild(pages); wrap.appendChild(actions);
root.appendChild(main);
/* collections row */
var cols = el("nav", "cnx-cols"); cols.setAttribute("aria-label", "التصنيفات");
var cwrap = el("div", "cnx-wrap"); cols.appendChild(cwrap);
items.filter(function (it) { return CFG.notCollections.indexOf(it.t) < 0; }).forEach(function (it) {
var col = el("div", "cnx-col");
var a = el("a", "", esc(it.t)); a.href = it.h;
if (path(it.h) === here) a.classList.add("is-active");
col.appendChild(a);
var kids = it.kids.filter(function (k) { return !k.all; });
if (kids.length) {
a.appendChild(el("span", "cnx-caret"));
var img = CFG.images.filter(function (x) { return !x.k || it.t.indexOf(x.k) > -1; })[0];
var list = kids.map(function (k) { return '' + esc(k.t) + ' '; }).join("") +
'عرض كل ' + esc(it.t) + ' ';
col.appendChild(el("div", "cnx-mega",
''));
}
cwrap.appendChild(col);
});
root.appendChild(cols);
header.insertBefore(root, header.firstChild);
window.__cnx = { cfg: CFG, items: items, pageLinks: pageLinks, search: search, user: user, logo: logo, actions: actions };
document.dispatchEvent(new CustomEvent("cnx:ready"));
/* compact on scroll (rAF-throttled, passive) */
var ticking = false;
function onScroll() {
if (ticking) return; ticking = true;
requestAnimationFrame(function () { root.classList.toggle("is-scrolled", window.scrollY > 60); ticking = false; });
}
window.addEventListener("scroll", onScroll, { passive: true }); onScroll();
/* expose the full header height (top bar + main + collections) for full-screen sections */
function setH() { if (!root.classList.contains("is-scrolled")) document.documentElement.style.setProperty("--cnx-h", root.offsetHeight + "px"); }
setH(); window.addEventListener("resize", setH, { passive: true });
return true;
}
function start() {
if (build()) return;
var tries = 0, t = setInterval(function () { if (build() || ++tries > 40) clearInterval(t); }, 150);
}
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start); else start();
})();
/* ===== side menu ===== */
(function () {
var PROMO = {
img: "https://cdn.salla.sa/NoOnD/products/8DuJyDaxLwtjSjWvwAi6HWfn2Tb2CB8usrgHo6HS.jpg",
kicker: "EXCLUSIVE OFFERS", title: "عروض حصرية على قطونيل", cta: "تسوّق الآن", href: "/offers"
};
var EXTRA_PAGES = ["من نحن", "تواصل معنا", "فروعنا", "سياسة الخصوصية", "اتفاقية استخدام الموقع"];
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function build() {
var d = window.__cnx; if (!d || document.getElementById("cnd")) return;
if (!d.pageLinks["تواصل معنا"]) d.pageLinks["تواصل معنا"] = "/redirect/pages/400881110";
var cfg = d.cfg, items = d.items, i = 0;
function st() { return ' class="cnd-stagger" style="--i:' + (i++) + '"'; }
var cols = items.filter(function (it) { return cfg.notCollections.indexOf(it.t) < 0; });
var quick = items.filter(function (it) { return cfg.notCollections.indexOf(it.t) > -1; });
var logoSrc = d.logo && d.logo.querySelector("img") ? d.logo.querySelector("img").src : "";
var html =
'
' +
'';
var root = document.createElement("div"); root.id = "cnd"; root.setAttribute("aria-hidden", "true"); root.innerHTML = html;
document.body.appendChild(root);
var burger = document.createElement("button");
burger.className = "cnd-burger"; burger.setAttribute("aria-label", "القائمة"); burger.innerHTML = " ";
d.actions.appendChild(burger);
function open() { root.classList.add("is-open"); root.setAttribute("aria-hidden", "false"); document.documentElement.classList.add("cnd-lock"); }
function close() { root.classList.remove("is-open"); root.setAttribute("aria-hidden", "true"); document.documentElement.classList.remove("cnd-lock"); }
burger.addEventListener("click", open);
root.addEventListener("click", function (e) {
var t = e.target.closest("[data-close],[data-toggle],[data-search],[data-account]"); if (!t) return;
if (t.hasAttribute("data-close")) close();
else if (t.hasAttribute("data-toggle")) {
var li = t.closest(".cnd-item"), on = !li.classList.contains("is-open");
root.querySelectorAll(".cnd-item.is-open").forEach(function (x) { x.classList.remove("is-open"); x.querySelector("[data-toggle]").setAttribute("aria-expanded", "false"); });
if (on) { li.classList.add("is-open"); t.setAttribute("aria-expanded", "true"); }
}
else if (t.hasAttribute("data-search")) { close(); setTimeout(function () { d.search && d.search.click(); }, 250); }
else if (t.hasAttribute("data-account")) { close(); setTimeout(function () { d.user && d.user.click(); }, 250); }
});
document.addEventListener("keydown", function (e) { if (e.key === "Escape") close(); });
}
if (window.__cnx) build(); else document.addEventListener("cnx:ready", build);
})();
/* ===== mobile nav ===== */
(function () {
var I = {
home: ' ',
cols: ' ',
search: ' ',
cart: ' ',
user: ' '
};
function build() {
if (document.querySelector(".cntb")) return;
var d = window.__cnx || {};
var nav = document.createElement("nav");
nav.className = "cntb"; nav.setAttribute("aria-label", "التنقل السريع");
nav.innerHTML =
'' + I.home + "الرئيسية " +
'' + I.cols + "التشكيلات " +
'' + I.search + "بحث " +
'' + I.cart + "السلة " +
'' + I.user + "حسابي ";
document.body.appendChild(nav);
var b = document.body.classList, path = location.pathname.replace(/\/$/, "");
var on = b.contains("index") || path === "" ? "home" : b.contains("cart") ? "cart" : b.contains("product-index") ? "cols" : /customer|profile|orders|wishlist/.test(path) ? "user" : "";
if (on) nav.querySelector('[data-k="' + on + '"]').classList.add("on");
nav.addEventListener("click", function (e) {
var t = e.target.closest("button"); if (!t) return;
var k = t.getAttribute("data-k");
if (k === "cols") { var m = document.querySelector(".cnd-burger"); if (m) m.click(); }
else if (k === "search" && d.search) d.search.click();
else if (k === "user" && d.user) d.user.click();
});
var badge = nav.querySelector("b"), last = null;
function count() {
var src = document.querySelector(".cnx-actions .s-cart-summary-count, .s-cart-summary-count");
var n = parseInt(src && src.textContent, 10) || 0;
if (n === last) return;
badge.textContent = n > 99 ? "99+" : n;
badge.classList.toggle("has", n > 0);
if (last !== null && n > last) { badge.classList.remove("pop"); void badge.offsetWidth; badge.classList.add("pop"); }
last = n;
}
count();
var src = document.querySelector(".cnx-actions salla-cart-summary, salla-cart-summary");
if (src) new MutationObserver(count).observe(src, { subtree: true, childList: true, characterData: true });
try { salla.cart.event.onUpdated(function () { setTimeout(count, 60); }); } catch (e) {}
}
if (window.__cnx) build(); else document.addEventListener("cnx:ready", build);
setTimeout(function () { if (document.body) build(); }, 4000);
})();
/* ===== footer ===== */
(function () {
var C = {
wa: "966597826007", waShow: "+966 59 782 6007",
tel: "+966597826007", email: "cotonnile@gmail.com",
about: "مؤسسة قطن النيل — وجهتكم لمنتجات قطونيل الأصلية المصنوعة من القطن المصري، للرجال والنساء والأطفال، في 3 فروع بالرياض ومتجر يصل لكل مدن المملكة.",
year: new Date().getFullYear()
};
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function build() {
var d = window.__cnx, foot = document.querySelector(".store-footer");
if (!d || !foot || document.getElementById("cnf")) return !!document.getElementById("cnf");
var inner = foot.querySelector(".store-footer__inner");
var cfg = d.cfg, items = d.items, P = d.pageLinks;
var cols = items.filter(function (it) { return cfg.notCollections.indexOf(it.t) < 0; });
var quick = items.filter(function (it) { return cfg.notCollections.indexOf(it.t) > -1 && it.t !== "تخفيضات"; });
var logo = d.logo && d.logo.querySelector("img") ? d.logo.querySelector("img").src : "";
var aboutHref = P["من نحن"] || "#";
if (!P["تواصل معنا"]) P["تواصل معنا"] = "/redirect/pages/400881110";
function li(t, h, ext) { return '' + esc(t) + ' '; }
var social = [].slice.call((inner || foot).querySelectorAll(".s-social-link a")).map(function (a) {
var svg = a.querySelector("svg"); return '' + (svg ? svg.outerHTML : "") + ' ';
}).join("");
var html =
'' +
'' +
'
' + esc(C.about) + '
' + (social ? '
' + social + '
' : "") + '
' +
'
التشكيلات ' + cols.map(function (c) { return li(c.t, c.h); }).join("") + ' ' +
'
تسوّق ' + li("العروض", "/offers") + li("المتجر", "/redirect/pages/2045044345") + ' ' +
'
روابط تهمك ' +
["من نحن", "تواصل معنا", "فروعنا", "سياسة الخصوصية", "اتفاقية استخدام الموقع"].filter(function (p) { return P[p]; }).map(function (p) { return li(p, P[p]); }).join("") +
' ' +
'
' +
'
' +
'© ' + C.year + ' مؤسسة قطن النيل — جميع الحقوق محفوظة
';
var root = document.createElement("div"); root.id = "cnf"; root.innerHTML = html;
foot.insertBefore(root, foot.firstChild);
/* move Salla's working pieces into the new layout */
var form = foot.querySelector('.store-footer__inner form[name="submit-form"]');
if (form) root.querySelector(".cnf-news-slot").appendChild(form);
var legal = root.querySelector(".cnf-legal");
var badge = foot.querySelector(".store-footer__inner salla-trust-badges"); if (badge) legal.appendChild(badge);
var sbc = foot.querySelector(".store-footer__inner .sbc-certificate"); if (sbc) legal.appendChild(sbc);
var pay = foot.querySelector(".store-footer__inner salla-payments"); if (pay) root.querySelector(".cnf-pay").appendChild(pay);
return true;
}
function start() { if (build()) return; var n = 0, t = setInterval(function () { if (build() || ++n > 60) clearInterval(t); }, 150); }
if (window.__cnx) start(); else document.addEventListener("cnx:ready", start);
})();
/* ===== product cards ===== */
/* cards are pure CSS */
/* ===== cart ===== */
(function () {
var WA = "966597826007";
function mount() {
if (!document.body) return false;
if (!document.body.classList.contains("cart")) return document.readyState !== "loading";
var wrap = document.querySelector(".app-inner > .container.mt-5");
var side = document.querySelector(".app-inner > .container.mt-5 .sticky");
if (!wrap || !side) return false;
if (!document.querySelector(".cnc2-steps")) {
var steps = document.createElement("div"); steps.className = "cnc2-steps";
steps.innerHTML = '1 السلة2 بيانات الشحن3 الدفع ';
wrap.insertBefore(steps, wrap.firstChild);
}
if (!side.querySelector(".cnc2-trust")) {
var box = document.createElement("div"); box.className = "cnc2-trust";
box.innerHTML =
'شحن لجميع مدن المملكة يصلك خلال 2 – 7 أيام
' +
'منتجات قطونيل أصلية قطن مصري بجودة موثوقة
' +
'' +
'تحتاج مساعدة في طلبك؟ تواصل معنا على واتساب
';
side.appendChild(box);
}
return true;
}
/* empty cart: subtitle, shop button, collection chips */
function dressEmpty() {
var ph = document.querySelector("body.cart .no-content-placeholder");
if (!ph || ph.querySelector(".cnc2-empty-sub")) return !!ph;
var title = ph.querySelector("p");
if (title) {
title.textContent = "سلتك فارغة حاليًا";
var sub = document.createElement("p"); sub.className = "cnc2-empty-sub";
sub.textContent = "اكتشف تشكيلة قطونيل الأصلية من القطن المصري، وأضف ما يناسبك لتبدأ طلبك.";
title.parentNode.insertBefore(sub, title.nextSibling);
}
var row = ph.querySelector(".flex.gap-2:not(.flex-col)");
if (row) {
var shop = document.createElement("a"); shop.className = "cnc2-empty-btn"; shop.href = "/offers"; shop.textContent = "تسوّق العروض ←";
row.insertBefore(shop, row.firstChild);
}
var d = window.__cnx;
if (d && d.items) {
var cols = d.items.filter(function (it) { return d.cfg.notCollections.indexOf(it.t) < 0; });
if (cols.length) {
var lab = document.createElement("div"); lab.className = "cnc2-empty-label"; lab.textContent = "أو تصفّح التشكيلات";
var wrap = document.createElement("div"); wrap.className = "cnc2-empty-cols";
cols.forEach(function (c) { var a = document.createElement("a"); a.href = c.h; a.textContent = c.t; wrap.appendChild(a); });
ph.appendChild(lab); ph.appendChild(wrap);
}
}
return true;
}
var en = 0, et = setInterval(function () {
if (document.body && !document.body.classList.contains("cart") && document.readyState !== "loading") return clearInterval(et);
if ((dressEmpty() && window.__cnx) || ++en > 40) clearInterval(et);
}, 150);
if (!mount()) { var n = 0, t = setInterval(function () { if (mount() || ++n > 40) clearInterval(t); }, 150); }
})();
/* ===== modals ===== */
(function () {
var IMG = "https://cdn.salla.sa/NoOnD/products/rnWlaPhjwWuFyXnHCaMgkwILoV5CXePoE4CD58gu.jpg";
function dressLogin(modal) {
var body = modal.querySelector(".s-modal-body"); if (!body || body.querySelector(".cnm-login-side")) return;
var logo = document.querySelector(".cnx-brand img, .navbar-brand img");
var side = document.createElement("div"); side.className = "cnm-login-side";
side.innerHTML = ' ' + (logo ? ' ' : "") +
'أهلاً بك في قطونيل ' +
' تابع طلباتك بسهولة احفظ منتجاتك المفضلة✓ إتمام أسرع لطلباتك القادمة ';
body.insertBefore(side, body.firstChild);
}
function scan() { document.querySelectorAll("salla-modal.s-login-modal").forEach(dressLogin); }
var queued = false;
new MutationObserver(function () {
if (queued) return; queued = true;
requestAnimationFrame(function () { queued = false; scan(); });
}).observe(document.documentElement, { childList: true, subtree: true });
if (document.readyState !== "loading") scan(); else document.addEventListener("DOMContentLoaded", scan);
})();
/* ===== collection ===== */
(function () {
var IMG = [
{ k: "رجال", src: "https://cdn.salla.sa/NoOnD/products/3cgbSJEHSIs43wMeIl2sGuweKUWXQbAdXgOLH5T5.jpg" },
{ k: "نسا", src: "https://cdn.salla.sa/NoOnD/products/mCwG6rA8wTNsV6tOCJs6CmRYZngXA3uUQKrQ2MlN.jpg" },
{ k: "اطفال", src: "https://cdn.salla.sa/NoOnD/products/8HA4KStHphk9Lrm7yG2AcrnkKqCvW7zXFbJSEU8g.jpg" },
{ k: "مناشف", src: "https://cdn.salla.sa/NoOnD/products/5i3ofDHLToPIG8R3dTN4ouVw6bNy4RvmorJ8rIKV.jpg" },
{ k: "", src: "https://cdn.salla.sa/NoOnD/products/CJFcDMlMdnYSUfda3HyVTc3FXqN5dxrJ4O4tPYrA.jpg" }
];
var KEY = "cnl-density";
function path(u) { try { return decodeURIComponent(new URL(u, location.href).pathname).replace(/\/$/, ""); } catch (e) { return u; } }
/* ---------- filters ---------- */
function esc(t) { return String(t == null ? "" : t).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function filters(bar) {
var pl = document.querySelector("salla-products-list");
var id = pl && (pl.getAttribute("source-value") || "");
if (!pl || !/^\d+$/.test(id) || !window.salla || !salla.api) return;
var btn = document.createElement("button");
btn.type = "button"; btn.className = "cnlf-btn"; btn.setAttribute("aria-haspopup", "dialog");
btn.innerHTML = ' تصفية ';
btn.style.display = "none";
bar.insertBefore(btn, bar.firstChild);
var pills = document.createElement("div"); pills.className = "cnlf-active";
bar.parentNode.insertBefore(pills, bar.nextSibling);
var base = "products?source=categories&filterable=1&source_value[]=" + id;
var side = null, panel = null, facets = null, price = null, sel = { price: null, v: {} }, applied = { price: null, v: {} }, wrap, body, go, sub, tmr, seq = 0;
function clone(o) { return JSON.parse(JSON.stringify(o)); }
function qs(st) {
var q = "";
if (st.price) q += "&filters[price][min]=" + st.price[0] + "&filters[price][max]=" + st.price[1];
Object.keys(st.v).forEach(function (key) { st.v[key].forEach(function (val) { q += "&filters[" + encodeURIComponent(key) + "][]=" + encodeURIComponent(val); }); });
return q;
}
function payload(st) {
var p = {};
if (st.price) p.price = { min: st.price[0], max: st.price[1] };
Object.keys(st.v).forEach(function (key) { if (st.v[key].length) p[key] = st.v[key].slice(); });
return p;
}
function total(r) {
var c = (r.filters || []).filter(function (x) { return x.key === "category_id"; })[0];
return c && c.values && c.values.length ? c.values.reduce(function (a, v) { return a + (+v.count || 0); }, 0) : null;
}
function count(st) { var n = st.price ? 1 : 0; Object.keys(st.v).forEach(function (key) { n += st.v[key].length; }); return n; }
function useful(x) { return x.type === "values" && x.values && (x.key !== "category_id" ? x.values.length > 0 : x.values.length > 1); }
salla.api.request(base).then(function (r) {
facets = r.filters || [];
var p = facets.filter(function (x) { return x.key === "price"; })[0];
if (p && +p.max > +p.min) price = [Math.floor(+p.min), Math.ceil(+p.max)];
if (!price && !facets.some(useful)) return;
btn.style.display = "";
build(total(r));
}).catch(function () {});
function build(n) {
wrap = document.createElement("div"); wrap.id = "cnlf"; wrap.setAttribute("aria-hidden", "true");
wrap.innerHTML = '
';
document.body.appendChild(wrap);
panel = wrap.querySelector(".cnlf-panel"); var row = (document.querySelector("salla-filters") || {}).parentElement, mq = matchMedia("(min-width:1024px)");
if (row) { side = document.createElement("div"); side.className = "cnlf-side"; row.insertBefore(side, row.firstChild); }
var place = function () {
var d = !!(side && mq.matches);
document.documentElement.classList.toggle("cnlf-desk", d);
if (d) { if (wrap.classList.contains("open")) close(); sel = clone(applied); side.appendChild(panel); }
else wrap.appendChild(panel);
};
if (mq.addEventListener) mq.addEventListener("change", place); else mq.addListener(place);
place();
body = panel.querySelector(".cnlf-body"); go = panel.querySelector(".cnlf-go"); sub = panel.querySelector(".cnlf-head small");
var h = "";
if (price) {
h += '';
}
facets.filter(useful).forEach(function (x) {
h += '' + esc(x.key === "category_id" ? "الأقسام" : x.label) + ' ';
x.values.forEach(function (v) {
var val = v.key != null ? v.key : v.value;
var sw = v.color ? ' ' : "";
h += '' + sw + esc(v.value) + (v.count != null ? "" + v.count + " " : "") + " ";
});
h += "
";
});
if (!facets.some(function (x) { return useful(x) && x.key !== "category_id"; }))
h += 'المقاسات والألوان ستظهر هنا خيارات المقاس واللون تلقائيًا عند إضافتها للمنتجات.
';
body.innerHTML = h;
label(n);
if (price) {
var lo = body.querySelector(".cnlf-lo"), hi = body.querySelector(".cnlf-hi"), nlo = body.querySelector(".cnlf-nlo"), nhi = body.querySelector(".cnlf-nhi"), fill = body.querySelector(".cnlf-fill");
var paint = function () {
var a = +lo.value, b = +hi.value, span = price[1] - price[0] || 1;
fill.style.right = ((a - price[0]) / span * 100) + "%"; fill.style.left = ((price[1] - b) / span * 100) + "%";
nlo.value = a; nhi.value = b;
sel.price = (a > price[0] || b < price[1]) ? [a, b] : null;
};
body.__paint = function () { lo.value = sel.price ? sel.price[0] : price[0]; hi.value = sel.price ? sel.price[1] : price[1]; paint(); };
lo.addEventListener("input", function () { if (+lo.value > +hi.value) lo.value = hi.value; paint(); preview(); });
hi.addEventListener("input", function () { if (+hi.value < +lo.value) hi.value = lo.value; paint(); preview(); });
var typed = function () {
var a = Math.max(price[0], Math.min(+nlo.value || price[0], price[1])), b = Math.max(price[0], Math.min(+nhi.value || price[1], price[1]));
if (a > b) { var t = a; a = b; b = t; }
lo.value = a; hi.value = b; paint(); preview();
};
nlo.addEventListener("change", typed); nhi.addEventListener("change", typed);
paint();
}
body.addEventListener("click", function (e) {
var c = e.target.closest(".cnlf-chip"); if (!c || c.disabled) return;
var key = c.closest(".cnlf-sec").getAttribute("data-k"), val = c.getAttribute("data-v");
var arr = sel.v[key] || (sel.v[key] = []), at = arr.indexOf(val);
if (at > -1) arr.splice(at, 1); else arr.push(val);
if (!arr.length) delete sel.v[key];
c.setAttribute("aria-pressed", at > -1 ? "false" : "true");
preview();
});
wrap.querySelector(".cnlf-scrim").addEventListener("click", close);
panel.querySelector(".cnlf-x").addEventListener("click", close);
panel.querySelector(".cnlf-reset").addEventListener("click", function () { sel = { price: null, v: {} }; sync(); preview(); });
go.addEventListener("click", function () { apply(sel); close(); });
document.addEventListener("keydown", function (e) { if (e.key === "Escape" && wrap.classList.contains("open")) close(); });
btn.addEventListener("click", open);
pills.addEventListener("click", function (e) {
var p = e.target.closest("[data-rm]"); if (!p) return;
var st = clone(applied), rm = p.getAttribute("data-rm");
if (rm === "*") st = { price: null, v: {} };
else if (rm === "price") st.price = null;
else { var key = rm, val = p.getAttribute("data-v"); st.v[key] = (st.v[key] || []).filter(function (x) { return x !== val; }); if (!st.v[key].length) delete st.v[key]; }
apply(st);
});
}
function label(n) {
go.textContent = n == null ? "عرض النتائج" : n ? "عرض " + n + " منتج" : "لا توجد نتائج";
go.disabled = n === 0;
sub.textContent = n == null ? "" : n + " منتج مطابق";
}
function sync() {
body.querySelectorAll(".cnlf-chip").forEach(function (c) {
var key = c.closest(".cnlf-sec").getAttribute("data-k");
c.setAttribute("aria-pressed", (sel.v[key] || []).indexOf(c.getAttribute("data-v")) > -1 ? "true" : "false");
});
if (body.__paint) body.__paint();
}
function preview(quiet) {
clearTimeout(tmr); go.classList.add("busy");
tmr = setTimeout(function () {
var my = ++seq;
salla.api.request(base + qs(sel)).then(function (r) {
if (my !== seq) return;
go.classList.remove("busy"); label(total(r) != null ? total(r) : (r.data || []).length);
if (desk() && !quiet && JSON.stringify(sel) !== JSON.stringify(applied)) apply(sel, true);
}).catch(function () { go.classList.remove("busy"); label(null); });
}, desk() ? 380 : 260);
}
function desk() { return document.documentElement.classList.contains("cnlf-desk"); }
function open() {
sel = clone(applied); sync(); preview();
wrap.classList.add("open"); wrap.setAttribute("aria-hidden", "false");
document.documentElement.classList.add("cnlf-lock");
setTimeout(function () { panel.querySelector(".cnlf-x").focus(); }, 60);
}
function close() {
wrap.classList.remove("open"); wrap.setAttribute("aria-hidden", "true");
document.documentElement.classList.remove("cnlf-lock");
btn.focus({ preventScroll: true });
}
function name(key, val) {
var f = facets.filter(function (x) { return x.key === key; })[0];
var v = f && f.values.filter(function (y) { return String(y.key != null ? y.key : y.value) === val; })[0];
return v ? v.value : val;
}
function apply(st, live) {
applied = clone(st);
if (desk() && !live) { sel = clone(applied); sync(); preview(true); }
if (side) side.classList.toggle("has", count(applied) > 0);
var p = document.querySelector("salla-products-list");
if (p) { p.filtersResults = true; salla.event.emit("salla-filters::changed", payload(applied)); }
var n = count(applied), h = "";
btn.classList.toggle("has", n > 0); btn.querySelector("b").textContent = n || "";
if (applied.price) h += 'السعر: ' + applied.price[0] + " – " + applied.price[1] + " ر.س× ";
Object.keys(applied.v).forEach(function (key) {
applied.v[key].forEach(function (val) { h += '' + esc(name(key, val)) + "× "; });
});
if (n > 1) h += 'مسح الكل ';
pills.innerHTML = h;
var top = bar.getBoundingClientRect().top + scrollY - (parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--cnx-h")) || 0) - 16;
if (scrollY > top) scrollTo({ top: top, behavior: "smooth" });
}
}
function mount() {
if (!document.body) return false;
if (!document.body.classList.contains("product-index")) return document.readyState !== "loading";
var hero = document.querySelector(".app-inner > .nav-header");
var title = document.querySelector(".category_title");
if (!hero || !title) return false;
if (!hero.__cnl) {
hero.__cnl = true;
var t = (title.textContent || "").trim();
var img = IMG.filter(function (x) { return !x.k || t.indexOf(x.k) > -1; })[0];
hero.style.setProperty("--cnl-img", 'url("' + img.src + '")');
var here = path(location.href);
document.querySelectorAll(".sub-categories").forEach(function (a) { if (a.href && path(a.href) === here) a.classList.add("is-active"); });
}
var bar = document.querySelector(".prdoucts-list-filters");
var list = document.querySelector(".s-products-list-wrapper");
if (bar && list && !bar.querySelector(".cnl-density")) {
var d = document.createElement("div"); d.className = "cnl-density"; d.setAttribute("role", "group"); d.setAttribute("aria-label", "عدد الأعمدة");
var g4 = ' ';
var g3 = ' ';
d.innerHTML = '' + g4 + ' ' + g3 + ' ';
bar.appendChild(d);
var saved = "4"; try { saved = localStorage.getItem(KEY) || "4"; } catch (e) {}
function set(c) {
list.classList.toggle("cnl-3", c === "3");
d.querySelectorAll("button").forEach(function (b) { b.classList.toggle("on", b.getAttribute("data-c") === c); });
try { localStorage.setItem(KEY, c); } catch (e) {}
}
set(saved);
d.addEventListener("click", function (e) { var b = e.target.closest("button"); if (b) set(b.getAttribute("data-c")); });
}
if (bar && list && !bar.querySelector(".cnlf-btn")) filters(bar);
return !!(bar && list);
}
if (!mount()) { var n = 0, iv = setInterval(function () { if (mount() || ++n > 40) clearInterval(iv); }, 150); }
})();
/* ===== home ===== */
(function () {
var HERO = "https://cdn.salla.sa/NoOnD/products/by1SoHY9rNAl7ztbon6uTbwbSpvfiywQAU1M0h0y.jpg";
var STORY = "https://cdn.salla.sa/NoOnD/products/XSedVYG8vKQhwz8H9Xmpe7UMLfmkMTwhOT6nRNYN.jpg";
var IMG = [
{ k: "رجال", src: "https://cdn.salla.sa/NoOnD/products/QKfCf9rKg9YKVJyX89raEqmurd9W70K506fmzebW.jpg", s: "ملابس داخلية وبيجامات" },
{ k: "نسا", src: "https://cdn.salla.sa/NoOnD/products/huN1CSv75HVMejfj7xDoWAgYWcVL4eEjMC22FYsv.jpg", s: "راحة تناسب يومك" },
{ k: "اطفال", src: "https://cdn.salla.sa/NoOnD/products/4VkPLEvpx9ialm8WSNmeeKJTXWrRLjWbcz9yO8Sy.jpg", s: "قطن ناعم لبشرتهم" },
{ k: "مناشف", src: "https://cdn.salla.sa/NoOnD/products/GWz0VJo1Uuep3cyeL7l1NSS6uYQP80nzOzcb5LiT.jpg", s: "مناشف وأرواب فندقية" },
{ k: "", src: HERO, s: "تسوّق التشكيلة" }
];
var ICON = {
truck: ' ',
shield: ' ',
leaf: ' ',
swap: ' '
};
function esc(t) { return String(t == null ? "" : t).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function link(name, fb) {
var a = [].slice.call(document.querySelectorAll("a")).filter(function (x) { return (x.textContent || "").trim() === name && x.href; })[0];
return a ? a.href : fb;
}
function hero() {
var host = document.querySelector(".app-inner > .home-slider");
if (!host) return false;
if (host.classList.contains("cnh-host")) return true;
var d = window.__cnx; if (!d) return false;
host.classList.add("cnh-host");
var offers = link("العروض", "/offers");
function col(k) { var it = (d.items || []).filter(function (x) { return x.t.indexOf(k) > -1; })[0]; return it ? it.h : "#cnh-cols"; }
var U = "https://images.unsplash.com/photo-", P = "https://images.pexels.com/photos/";
var SLIDES = [
{ img: HERO, eye: "منتجات قطونيل الأصلية في المملكة", h: "نعومة القطن المصري في كل يوم",
p: "ملابس داخلية وبيجامات ومناشف مصنوعة من قطن مصري خالص، تدوم معك بعد كل غسلة، وتصلك بسرعة لأي مكان في المملكة.",
a: [["تسوّق العروض", offers], ["اكتشف التشكيلات", "#cnh-cols"]] },
{ img: "https://cdn.salla.sa/NoOnD/products/gddujPQ5BNra5BafeT59ul4nUFYhCRv1EVhnp7NU.jpg", eye: "تشكيلة النساء", h: "راحة تلازمكطوال اليوم ",
p: "قطع ناعمة بخامات قطنية تتنفس مع الجسم، بمقاسات تناسب كل يوم وكل مناسبة.", a: [["تسوّق النسائي", col("نسا")], ["عروض اليوم", offers]] },
{ img: "https://cdn.salla.sa/NoOnD/products/MINQe3TFIGuF1YwR2sWUVAOAhBD6Ak7q8LIVHUuP.jpg", eye: "تشكيلة الرجال", h: "أساسيات يومكبجودة تدوم ",
p: "فانلات وسراويل وبيجامات قطونيل الأصلية، تحافظ على شكلها ونعومتها بعد كل غسلة.", a: [["تسوّق الرجالي", col("رجال")], ["عروض اليوم", offers]] },
{ img: "https://cdn.salla.sa/NoOnD/products/EQJtakOAGVnO9QhZOkuMIKUjhYFwBEq93ipLfvn4.jpg", eye: "تشكيلة الأطفال", h: "قطن ناعملبشرتهم الرقيقة ",
p: "ملابس أطفال مريحة وآمنة على البشرة، لكل الأعمار والمقاسات.", a: [["تسوّق الأطفال", col("اطفال")], ["عروض اليوم", offers]] },
{ img: "https://cdn.salla.sa/NoOnD/products/J169H6QqdRbI7G2Rc0d5AIwj77B8h9kfWVUKeBo2.jpg", eye: "المناشف والأرواب", h: "لمسة فندقيةفي بيتك ",
p: "مناشف وأرواب قطنية عالية الامتصاص، بملمس ناعم يدوم مع الاستخدام.", a: [["تسوّق المناشف", col("مناشف")], ["عروض اليوم", offers]] }
];
var N = SLIDES.length, h = "";
SLIDES.forEach(function (sl, i) {
var tag = i ? "h2" : "h1";
h += '" +
'
' +
'
' +
'
' + sl.eye + "
" +
"<" + tag + ' class="cnh-h cnh-anim" style="animation-delay:.28s">' + sl.h + "" + tag + ">" +
'
' + sl.p + "
" +
'
";
});
function arrow(prev) { return ' '; }
h += '' +
SLIDES.map(function (sl, i) { return ' '; }).join("") +
'
' + arrow(true) + ' ' + arrow(false) + "
";
h += '' +
"" + ICON.leaf + "قطن مصري 100% " + ICON.truck + "شحن سريع لكل المناطق " + ICON.shield + "دفع آمن ومتعدد " + ICON.swap + "استبدال سهل " +
" ";
var el = document.createElement("div"); el.className = "cnh-hero";
el.setAttribute("role", "region"); el.setAttribute("aria-roledescription", "carousel"); el.setAttribute("aria-label", "عروض قطونيل");
el.innerHTML = h;
host.appendChild(el);
var slides = el.querySelectorAll(".cnh-slide"), dots = el.querySelectorAll(".cnh-dot"), cur = 0, outT;
function load(i) { var im = slides[i].querySelector(".cnh-hero__img"); if (!im.style.getPropertyValue("--cnh-img")) im.style.setProperty("--cnh-img", 'url("' + im.getAttribute("data-src") + '")'); }
function go(i) {
i = (i + N) % N; if (i === cur) return;
load(i); load((i + 1) % N);
var old = slides[cur];
old.classList.add("out"); old.classList.remove("on"); old.setAttribute("aria-hidden", "true");
clearTimeout(outT); outT = setTimeout(function () { old.classList.remove("out"); }, 1200);
dots[cur].classList.remove("on");
cur = i;
void slides[i].offsetWidth;
slides[i].classList.remove("out"); slides[i].classList.add("on"); slides[i].removeAttribute("aria-hidden");
dots[i].classList.add("on");
}
load(0);
if (document.readyState === "complete") setTimeout(function () { load(1); }, 400);
else window.addEventListener("load", function () { setTimeout(function () { load(1); }, 400); });
dots.forEach(function (dt, i) {
dt.addEventListener("click", function () { go(i); });
dt.querySelector("i").addEventListener("animationend", function () { if (i === cur) go(cur + 1); });
});
el.querySelectorAll(".cnh-arrow").forEach(function (b) { b.addEventListener("click", function () { go(cur + (+b.getAttribute("data-d"))); }); });
var hover = false, seen = true;
function pause() { el.classList.toggle("paused", hover || !seen); }
el.addEventListener("mouseenter", function () { hover = true; pause(); });
el.addEventListener("mouseleave", function () { hover = false; pause(); });
/* drag (mouse) / swipe (touch) between slides */
el.querySelectorAll("a").forEach(function (a) { a.setAttribute("draggable", "false"); });
var x0 = null, y0 = 0, dx = 0, drag = false, moved = false;
el.addEventListener("pointerdown", function (e) {
if (e.button !== 0 || e.target.closest(".cnh-ctrl")) return;
x0 = e.clientX; y0 = e.clientY; dx = 0; drag = false; moved = false;
});
addEventListener("pointermove", function (e) {
if (x0 === null) return;
var mx = e.clientX - x0, my = e.clientY - y0;
if (!drag) {
if (Math.abs(mx) < 8) return;
if (Math.abs(my) > Math.abs(mx)) { x0 = null; return; }
drag = true; moved = true; el.classList.add("dragging", "paused");
}
dx = mx; el.style.setProperty("--cnh-dx", (dx * 0.35) + "px");
}, { passive: true });
function end() {
if (x0 === null) return;
x0 = null;
if (!drag) return;
drag = false; el.classList.remove("dragging"); el.style.setProperty("--cnh-dx", "0px");
pause();
if (Math.abs(dx) > 60) go(cur + (dx > 0 ? 1 : -1));
}
addEventListener("pointerup", end); addEventListener("pointercancel", end);
el.addEventListener("click", function (e) { if (moved) { e.preventDefault(); e.stopPropagation(); moved = false; } }, true);
if ("IntersectionObserver" in window) new IntersectionObserver(function (en) { seen = en[0].isIntersecting; pause(); }).observe(el);
el.addEventListener("click", function (e) {
var a = e.target.closest('a[href="#cnh-cols"]'); if (!a) return;
var t = document.getElementById("cnh-cols"); if (!t) return;
e.preventDefault();
scrollTo({ top: t.getBoundingClientRect().top + scrollY - (parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--cnx-h")) || 0), behavior: "smooth" });
});
return true;
}
function cols() {
var d = window.__cnx; if (!d || document.getElementById("cnh-cols")) return !!d;
var list = d.items.filter(function (it) { return d.cfg.notCollections.indexOf(it.t) < 0; });
if (!list.length) return true;
var anchor = document.querySelector(".s-block--banners") || document.querySelector(".cnh-host");
if (!anchor) return false;
var sec = document.createElement("section"); sec.className = "cnh-cols"; sec.id = "cnh-cols";
var h = 'تسوّق حسب التشكيلة اختر القسم المناسب لك ولعائلتك
";
anchor.parentNode.insertBefore(sec, anchor.nextSibling);
return true;
}
function story() {
if (document.querySelector(".cnh-story")) return true;
var anchor = document.getElementById("cnh-faq");
if (!anchor) return false;
var about = link("من نحن", "/redirect/pages/827436784");
var sec = document.createElement("section"); sec.className = "cnh-story cnh-last";
sec.innerHTML = '' +
'
من قطن النيل إلى خزانتك ' +
"
في قطن النيل نوفّر لك تشكيلة قطونيل الأصلية بخامات القطن المصري طويل التيلة، لأن الراحة تبدأ من أول قطعة تلبسها كل صباح.
" +
"
" + ICON.leaf + " خامات قطن مصري طبيعية تتنفس مع الجسم" + ICON.swap + " خياطة متينة تحافظ على شكلها بعد الغسيل" + ICON.shield + " مقاسات متنوعة لكل أفراد العائلة" +
'
تعرّف علينا ← ';
anchor.parentNode.insertBefore(sec, anchor.nextSibling);
sec.querySelectorAll(".cnh-story li i svg").forEach(function (s) { s.setAttribute("width", "16"); s.setAttribute("height", "16"); });
return true;
}
var ARR = function (prev) { return ' '; };
function catId(h) { var m = /\/c(\d+)/.exec(decodeURIComponent(h || "")); return m ? m[1] : ""; }
function railList(box, id) {
box.innerHTML = ' ';
}
function wireNav(sec) {
var nav = sec.querySelector(".cnh-nav"); if (!nav) return;
function wrap() { return sec.querySelector(".cnh-rail .s-products-list-wrapper"); }
function step(dir) {
var w = wrap(); if (!w || !w.firstElementChild) return;
var card = w.firstElementChild.getBoundingClientRect().width + 22;
w.scrollBy({ left: dir * card * (innerWidth < 1024 ? 1 : 2), behavior: "smooth" });
}
nav.querySelector("[data-d='next']").addEventListener("click", function () { step(-1); });
nav.querySelector("[data-d='prev']").addEventListener("click", function () { step(1); });
}
function navHtml() { return '' + ARR(true) + ' ' + ARR(false) + "
"; }
function picks() {
if (document.getElementById("cnh-picks")) return true;
var d = window.__cnx, after = document.getElementById("cnh-cols");
if (!d || !after) return false;
var cols = d.items.filter(function (it) { return d.cfg.notCollections.indexOf(it.t) < 0; });
var sec = document.createElement("section"); sec.className = "cnh-sec"; sec.id = "cnh-picks";
sec.innerHTML = 'اختيارات قطونيل قطع أساسية مختارة من كل تشكيلة
' +
'
' +
cols.map(function (c, i) { return '' + esc(c.t) + " "; }).join("") +
"
" + navHtml() + '
' +
'
";
after.parentNode.insertBefore(sec, after.nextSibling);
var rail = sec.querySelector(".cnh-rail"), all = sec.querySelector(".cnh-picks-all");
railList(rail, catId(cols[0] && cols[0].h));
sec.querySelector(".cnh-tabs").addEventListener("click", function (e) {
var b = e.target.closest(".cnh-tab"); if (!b || b.classList.contains("on")) return;
sec.querySelectorAll(".cnh-tab").forEach(function (x) { x.classList.toggle("on", x === b); });
railList(rail, b.getAttribute("data-id"));
all.href = b.getAttribute("data-h"); all.textContent = "عرض كل " + b.textContent + " ←";
});
wireNav(sec);
return true;
}
function fresh() {
if (document.getElementById("cnh-fresh")) return true;
var after = document.getElementById("cnh-banner"); if (!after) return false;
var sec = document.createElement("section"); sec.className = "cnh-sec cnh-fresh"; sec.id = "cnh-fresh";
sec.innerHTML = 'وصل حديثًا أحدث ما أضفناه إلى المتجر
' +
'
' +
'
';
after.parentNode.insertBefore(sec, after.nextSibling);
railList(sec.querySelector(".cnh-rail"), "");
wireNav(sec);
return true;
}
function branches() {
if (document.getElementById("cnh-branches")) return true;
var after = document.getElementById("cnh-fresh"); if (!after) return false;
var BR = [
{ n: "فرع حي النزهة", a: "طريق عثمان بن عفان، مجمع السدحان مقابل النخيل مول، الرياض", q: "24.7638375,46.7142615" },
{ n: "فرع حي السويدي", a: "تقاطع طريق عائشة بنت أبي بكر مع شارع سدير، الرياض", q: "24.5772707,46.6606184" },
{ n: "فرع الروابي", a: "شارع عنيزة بجوار محمصة الرفاعي، الرياض", q: "24.6940419,46.7847693" }
];
var pin = ' ';
var sec = document.createElement("section"); sec.className = "cnh-branches"; sec.id = "cnh-branches";
sec.innerHTML = 'زورونا في فروعنا جرّب الخامات والمقاسات بنفسك في أحد فروعنا بالرياض
' +
'
كل الفروع ← ' +
BR.map(function (b, i) {
return '
' + pin + " " + b.n + " " + b.a + "
" +
'الاتجاهات على الخريطة ← ';
}).join("") + "
";
after.parentNode.insertBefore(sec, after.nextSibling);
return true;
}
function banner() {
if (document.getElementById("cnh-banner")) return true;
var after = document.getElementById("cnh-picks"); if (!after) return false;
var offers = link("العروض", "/offers");
var img = "https://cdn.salla.sa/NoOnD/products/92XZebXAFqVVqoQgOlKy7Ob8e8gc1XGQSwhaL8bc.jpg";
var sec = document.createElement("section"); sec.className = "cnh-banner"; sec.id = "cnh-banner";
sec.innerHTML = '
' +
'
عروض قطونيل أساسيات يومك بأسعار تناسبك ' +
"
اختر من تشكيلة العروض على الملابس الداخلية والبيجامات والمناشف، بنفس جودة القطن المصري التي تعرفها.
" +
'
';
after.parentNode.insertBefore(sec, after.nextSibling);
return true;
}
function faq() {
if (document.getElementById("cnh-faq")) return true;
var after = document.getElementById("cnh-branches"); if (!after) return false;
var QA = [
["كم يستغرق توصيل الطلب؟", "نوصل طلبك خلال 2 – 7 أيام لجميع مناطق المملكة، وتصلك رسالة بتفاصيل الشحنة فور خروجها."],
["هل منتجاتكم أصلية؟", "نعم، جميع المنتجات منتجات قطونيل الأصلية المصنوعة من القطن المصري، وتصلك بتغليفها الأصلي."],
["كيف أختار المقاس المناسب؟", "اختر مقاسك المعتاد، وإن احترت بين مقاسين راسلنا على واتساب باسم المنتج ونساعدك تختار المقاس الأنسب."],
["ما طرق الدفع المتاحة؟", "تظهر لك جميع طرق الدفع المتاحة في صفحة إتمام الطلب قبل الدفع، والدفع يتم عبر بوابات آمنة."],
["هل يمكنني الشراء من الفروع مباشرة؟", "بالتأكيد، يسعدنا استقبالك في فروعنا الثلاثة بالرياض: حي النزهة، حي السويدي، والروابي."],
["كيف أتابع حالة طلبي؟", "من حسابك في المتجر ثم طلباتي، أو راسلنا على واتساب برقم الطلب ونرد عليك فورًا."]
];
var wa = "https://wa.me/966597826007?text=" + encodeURIComponent("مرحبًا قطن النيل، عندي سؤال:");
var sec = document.createElement("section"); sec.className = "cnh-faq"; sec.id = "cnh-faq";
sec.innerHTML = '' +
'
' +
QA.map(function (q, i) {
return '
";
}).join("") + "
";
after.parentNode.insertBefore(sec, after.nextSibling);
sec.querySelector(".cnh-faq__list").addEventListener("click", function (e) {
var b = e.target.closest(".cnh-q button"); if (!b) return;
var q = b.parentNode, open = !q.classList.contains("open");
sec.querySelectorAll(".cnh-q.open").forEach(function (x) { x.classList.remove("open"); x.querySelector("button").setAttribute("aria-expanded", "false"); });
if (open) { q.classList.add("open"); b.setAttribute("aria-expanded", "true"); }
});
return true;
}
function reveal() {
var els = document.querySelectorAll(".cnh-rv:not(.in)");
if (!("IntersectionObserver" in window)) { els.forEach(function (e) { e.classList.add("in"); }); return; }
var io = new IntersectionObserver(function (en) { en.forEach(function (x) { if (x.isIntersecting) { x.target.classList.add("in"); io.unobserve(x.target); } }); }, { rootMargin: "0px 0px -8% 0px" });
els.forEach(function (e) { io.observe(e); });
}
var n = 0, done = {};
function run() {
if (!document.body) return false;
if (!document.body.classList.contains("index")) return document.readyState !== "loading";
if (!done.h) done.h = hero();
if (!done.c) done.c = cols();
if (!done.p) done.p = picks();
if (!done.n) done.n = banner();
if (!done.f) done.f = fresh();
if (!done.b) done.b = branches();
if (!done.q) done.q = faq();
if (!done.s) done.s = story();
reveal();
return done.h && done.c && done.p && done.n && done.f && done.b && done.q && done.s;
}
if (!run()) { var iv = setInterval(function () { if (run() || ++n > 60) clearInterval(iv); }, 150); }
})();
/* ===== search ===== */
(function () {
function esc(t) { return String(t == null ? "" : t).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
var ICON = ' ';
function mount() {
if (!document.body) return false;
if (!document.body.classList.contains("product-index-search")) return document.readyState !== "loading";
var title = document.querySelector(".nav-header .nav-title");
if (!title) return false;
if (title.querySelector(".cnsr-form")) return true;
var q = (new URLSearchParams(location.search).get("q") || "").trim();
var h = document.createElement("div");
h.innerHTML = '' + (q ? 'نتائج البحث عن «' + esc(q) + '» ' : "ابحث في المتجر") + " " +
'
' +
'
';
while (h.firstChild) title.appendChild(h.firstChild);
var d = window.__cnx;
function sugg() {
d = window.__cnx; if (!d) return;
var cols = d.items.filter(function (it) { return d.cfg.notCollections.indexOf(it.t) < 0; });
title.querySelector(".cnsr-sugg").innerHTML = "تصفّح: " + cols.map(function (c) { return '' + esc(c.t) + " "; }).join("");
}
if (d) sugg(); else document.addEventListener("cnx:ready", sugg);
/* result count from Salla's own search facets */
var tries = 0;
(function count() {
if (!q) return;
if (!(window.salla && salla.api && salla.api.request)) { if (++tries < 50) setTimeout(count, 200); return; }
salla.api.request("products?source=search&filterable=1&source_value=" + encodeURIComponent(q)).then(function (r) {
var c = (r.filters || []).filter(function (x) { return x.key === "category_id"; })[0];
var n = c && c.values ? c.values.reduce(function (a, v) { return a + (+v.count || 0); }, 0) : (r.data || []).length;
title.querySelector(".cnsr-count").textContent = n ? n + " منتج مطابق" : "لم نجد منتجات مطابقة، جرّب كلمة أخرى أو تصفّح التشكيلات";
}).catch(function () { if (++tries < 50) setTimeout(count, 400); });
})();
/* Salla ships a raw translation key as the first sort option */
var sel = document.querySelector("#product-filter");
if (sel) [].forEach.call(sel.options, function (o) { if (/pages\./.test(o.text)) o.text = "اختر الترتيب"; });
return true;
}
if (!mount()) { var n = 0, iv = setInterval(function () { if (mount() || ++n > 60) clearInterval(iv); }, 150); }
})();
/* ===== page: about ===== */
(function () {
if (decodeURIComponent(location.pathname).indexOf("page-827436784") < 0) return;
var WA = "966597826007";
var MEDIA = {
hero: "https://cdn.salla.sa/NoOnD/products/pevD9zhAh92xCpuXBcUbwyagTV4FNdA60WyO4RZR.jpg",
story: "https://cdn.salla.sa/NoOnD/products/9q7k1KjnGa5PTgYtpBOPCciWHRWh0m7TKgtxOPRz.jpg",
journey: "https://cdn.salla.sa/NoOnD/products/eCOJf0oMiJWL5Okt3wz01oTAiqRl8phSFEnGjcKN.jpg",
branches: "https://cdn.salla.sa/NoOnD/products/kIWMhTnosqCNpeTjnjwcM6PKK9Y4AcFinIi5Bwv5.jpg",
cta: "https://cdn.salla.sa/NoOnD/products/MPtyHpYDPxYQWJByu7jf8XW8Rhxmlr4CJPRW4aP0.jpg"
};
var BRANCHES = [
{ n: "فرع حي النزهة", a: "طريق عثمان بن عفان، مجمع السدحان مقابل النخيل مول، الرياض", m: "https://www.google.com/maps/search/?api=1&query=24.7638375,46.7142615", q: "24.7638375,46.7142615" },
{ n: "فرع حي السويدي", a: "تقاطع طريق عائشة بنت أبي بكر مع شارع سدير، الرياض", m: "https://www.google.com/maps/search/?api=1&query=24.5772707,46.6606184", q: "24.5772707,46.6606184" },
{ n: "فرع الروابي", a: "شارع عنيزة بجوار محمصة الرفاعي، الرياض", m: "https://www.google.com/maps/search/?api=1&query=24.6940419,46.7847693", q: "24.6940419,46.7847693" }
];
var ICON = {
pin: ' ',
gem: ' ',
shield: ' ',
tag: ' ',
heart: ' '
};
function words(text, start, goldIdx) {
return text.split(" ").map(function (w, i) {
var g = goldIdx.indexOf(i) > -1 ? ' class="gold"' : "";
return '' + w + ' ';
}).join(" ");
}
function maps(q) { return "https://www.google.com/maps/search/?api=1&query=" + encodeURIComponent(q); }
var marq = ["قطن مصري 100%", "منتجات قطونيل الأصلية", "3 فروع في الرياض", "شحن لكل مدن المملكة", "راحة تدوم طوال اليوم", "جودة يُعتمد عليها"];
var marqHtml = marq.map(function (t) { return t + " ✦ "; }).join(" ");
var html =
/* 1 hero */
'' +
'' +
'
OUR STORY · قصتنا ' +
'
' + words("من أنقى خيط… تبدأ الراحة", 0.2, [3, 4]) + ' ' +
'
في مؤسسة قطن النيل اخترنا أن نكون وجهتكم الأولى لمنتجات قطونيل الأصلية، المصنوعة من أجود أنواع القطن المصري المعروف عالميًا بنقاوته وطول أليافه وملمسه الفاخر.
' +
'
' +
'
' +
'
100% قطن مصري طبيعي — تهوية مثالية وملمس لطيف يلائم احتياجاتك اليومية.
' +
'
SCROLL
' +
/* 2 marquee */
'' + marqHtml + ' ' + marqHtml + '
' +
/* 3 statement */
'WHO WE ARE ' +
'
نؤمن أن الراحة الحقيقية تبدأ من الأساس… لذلك نقدّم لكل أسرة في المملكة تجربة شراء تجمع بين الجودة والثقة والسعر العادل ، مع أحدث تشكيلات قطونيل للرجال والنساء والأطفال.
' +
'
' +
/* 4 numbers */
'' +
'
0 فروع في مدينة الرياض
' +
'
0 منتج في تشكيلتنا
' +
'
0 قطن طبيعي
' +
'
2–7 أيام للتوصيل لكل المملكة
' +
'
' +
/* 5 story */
'' +
'
' +
'
EGYPTIAN COTTON · PREMIUM QUALITY · أصلي قطونيل
' +
'
WHY EGYPTIAN COTTON ' +
'
لماذا القطن المصري ؟ ' +
'
واحد من أفضل أنواع الأقطان في العالم، وخصائصه الفريدة تجعله الخيار المثالي للملابس الداخلية التي ترافقك طوال اليوم.
' +
'
' +
'01 ألياف طويلة ومتينة قوة تحافظ على شكل القطعة بعد الغسيل المتكرر.
' +
'02 نعومة للبشرة الحساسة نسيج ناعم يمنحك شعورًا فائقًا بالراحة.
' +
'03 تهوية ممتازة يسمح بمرور الهواء ليبقيك منتعشًا طوال اليوم.
' +
' ' +
'
' +
/* 6 journey */
'' +
'
FROM FIELD TO YOU ' +
'
من الحقل إلى باب بيتك ' +
'
' +
'
01
القطن المصري أطول الألياف وأنقاها من الحقول المصرية. ' +
'
02
صناعة قطونيل تكنولوجيا حديثة تلتقي بإرث القطن العريق. ' +
'
03
قطن النيل منتجات أصلية مضمونة بأسعار مميزة. ' +
'
04
باب بيتك شحن سريع وآمن لجميع مدن المملكة. ' +
'
' +
/* 7 values */
'' +
'
' +
'
01 ' + ICON.gem + '
الجودة منتجات قطنية بمواد طبيعية 100% تدوم طويلًا. ' +
'
02 ' + ICON.shield + '
الأصالة والثقة منتجات قطونيل الأصلية فقط — بدون أي بدائل. ' +
'
03 ' + ICON.tag + '
السعر العادل جودة عالمية بأسعار مناسبة لكل أسرة. ' +
'
04 ' + ICON.heart + '
خدمة راقية فريق قريب منك في الفروع وعلى واتساب. ' +
'
' +
/* 8 branches */
'' +
'
' +
'
VISIT US أقرب إليكم في الرياض ' +
'
ثلاثة فروع موزّعة لتسهيل الوصول وخدمتكم بسرعة وكفاءة، إلى جانب متجرنا الإلكتروني الذي يصلكم في كل مدن المملكة.
' +
'
' +
'
' +
/* 9 vision */
'OUR VISION ' +
'
أن نكون الوجهة الموثوقة لكل أسرة تبحث عن الراحة والجودة والاستدامة — بمنتجات أصلية، وتجربة شراء رائعة، وخدمة عملاء راقية. ' +
'
— مؤسسة قطن النيل ' +
/* 10 cta */
'' +
'
SHOP THE COLLECTION جاهز تجرّب الفرق ؟ ' +
'
حيث يجتمع القطن المصري الفاخر مع خبرة وموثوقية قطونيل.
' +
'
' +
'
';
function mount() {
var src = document.querySelector(".app-inner > .container");
if (!src || document.getElementById("cna")) return !!document.getElementById("cna");
var root = document.createElement("div"); root.id = "cna"; root.innerHTML = html;
src.classList.add("cna-src");
src.parentNode.insertBefore(root, src);
document.body.classList.add("cna-on");
var io = new IntersectionObserver(function (es) {
es.forEach(function (e) {
if (!e.isIntersecting) return;
e.target.classList.add("is-in"); io.unobserve(e.target);
e.target.querySelectorAll("[data-count]").forEach(count);
});
}, { threshold: 0.18, rootMargin: "0px 0px -8% 0px" });
var pending = [].slice.call(root.querySelectorAll("[data-r]"));
pending.forEach(function (el) { io.observe(el); });
/* safety net: fast scrolling can skip past an element between frames */
var tick = false;
function sweep() {
tick = false;
pending = pending.filter(function (el) {
if (el.classList.contains("is-in")) return false;
if (el.getBoundingClientRect().top < window.innerHeight * 0.92) {
el.classList.add("is-in"); io.unobserve(el);
el.querySelectorAll("[data-count]").forEach(count);
return false;
}
return true;
});
if (!pending.length) window.removeEventListener("scroll", onScroll);
}
function onScroll() { if (!tick) { tick = true; requestAnimationFrame(sweep); } }
window.addEventListener("scroll", onScroll, { passive: true });
function count(el) {
var to = +el.getAttribute("data-count"), suf = el.getAttribute("data-suffix") || "", t0 = null, dur = 1600;
function step(t) { if (!t0) t0 = t; var p = Math.min(1, (t - t0) / dur), v = Math.round(to * (1 - Math.pow(1 - p, 3)));
el.textContent = v.toLocaleString("en-US") + suf; if (p < 1) requestAnimationFrame(step); }
requestAnimationFrame(step);
}
return true;
}
if (!mount()) {
var n = 0, t = setInterval(function () { if (mount() || ++n > 40) clearInterval(t); }, 120);
document.addEventListener("DOMContentLoaded", mount);
}
})();
/* ===== page: contact ===== */
(function () {
if (decodeURIComponent(location.pathname).indexOf("page-400881110") < 0) return;
var C = { wa: "966597826007", show: "+966 59 782 6007", tel: "+966597826007", email: "cotonnile@gmail.com" };
var MEDIA = { hero: "https://cdn.salla.sa/NoOnD/products/A9IgSDz1JdrwWu0rqB0uBOz3XyBOCP8UGLPr30Yf.jpg" };
var BR = [
{ n: "فرع حي النزهة", a: "طريق عثمان بن عفان، مجمع السدحان مقابل النخيل مول، الرياض", m: "https://www.google.com/maps/search/?api=1&query=24.7638375,46.7142615", q: "24.7638375,46.7142615" },
{ n: "فرع حي السويدي", a: "تقاطع طريق عائشة بنت أبي بكر مع شارع سدير، الرياض", m: "https://www.google.com/maps/search/?api=1&query=24.5772707,46.6606184", q: "24.5772707,46.6606184" },
{ n: "فرع الروابي", a: "شارع عنيزة بجوار محمصة الرفاعي، الرياض", m: "https://www.google.com/maps/search/?api=1&query=24.6940419,46.7847693", q: "24.6940419,46.7847693" }
];
var TOPICS = ["استفسار عن منتج", "متابعة طلب", "المقاسات", "الفروع", "أخرى"];
var FAQ = [
["كم يستغرق توصيل الطلب؟", "نوصل طلبك خلال 2 – 7 أيام لجميع مناطق المملكة."],
["هل المنتجات أصلية؟", "نعم، جميع منتجاتنا منتجات قطونيل الأصلية المصنوعة من القطن المصري."],
["هل يمكنني الشراء من الفروع مباشرة؟", "بالتأكيد، يسعدنا استقبالك في فروعنا الثلاثة بمدينة الرياض: حي النزهة، حي السويدي، والروابي."],
["كيف أتابع حالة طلبي؟", "من حسابك في المتجر ← طلباتي، أو راسلنا على واتساب برقم الطلب وسنساعدك فورًا."],
["ما طرق الدفع المتاحة؟", "تظهر لك جميع طرق الدفع المتاحة في صفحة إتمام الطلب قبل الدفع."]
];
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function mapSrc(q) { return "https://www.google.com/maps?q=" + encodeURIComponent(q) + "&z=16&output=embed&hl=ar"; }
function mapLink(q) { return "https://www.google.com/maps/search/?api=1&query=" + encodeURIComponent(q); }
var html =
'' +
'
CONTACT US · تواصل معنا ' +
'
نحن هنا… لنسمعك ' +
'
سؤال عن منتج، مقاس، أو متابعة طلب؟ فريق قطن النيل قريب منك — على واتساب، بالهاتف، أو في فروعنا بالرياض.
' +
'
' +
'
' +
'' +
'
واتساب ' + C.show + ' الطريقة الأسرع للتواصل معنا.
' +
'
' +
'
اتصل بنا ' + C.show + ' تحدّث مباشرة مع فريق خدمة العملاء.
' +
'
' +
'
البريد الإلكتروني ' + C.email + ' للاستفسارات التفصيلية والتعاون.
' +
'
' +
'
' +
'' +
'
SEND A MESSAGE اكتب رسالتك… ونوصلها فورًا ' +
'
املأ البيانات وسنجهّز رسالتك لتُرسل مباشرة على واتساب — شاهدها وهي تُكتب على اليسار.
' +
'
' +
'
قطن النيل · قطونيل متصل الآن
' +
'
أهلًا بك في قطن النيل 👋 كيف نقدر نساعدك؟الآن
' +
'
' +
'
' +
'' +
'
VISIT US زورونا في الرياض اختر الفرع لعرضه على الخريطة.
' +
'
' + BR.map(function (b, i) {
return '
';
}).join("") + '
' +
'
' +
'
' +
'FAQ أسئلة شائعة ' +
'
لم تجد إجابتك؟ راسلنا على واتساب ونرد عليك.
' +
FAQ.map(function (f, i) { return '
' + f[0] + ' ' + f[1] + '
'; }).join("") +
'
';
function mount() {
var src = document.querySelector(".app-inner > .container");
if (!src || document.getElementById("cnc")) return !!document.getElementById("cnc");
var root = document.createElement("div"); root.id = "cnc"; root.innerHTML = html;
src.classList.add("cnc-src"); src.parentNode.insertBefore(root, src);
document.body.classList.add("cnc-on");
var logo = document.querySelector(".cnx-brand img, .navbar-brand img"); if (logo) root.querySelector(".cnc-phone__top img").src = logo.src;
/* reveal */
var pending = [].slice.call(root.querySelectorAll("[data-r]"));
function sweep() { pending = pending.filter(function (el) { if (el.getBoundingClientRect().top < innerHeight * 0.92) { el.classList.add("is-in"); return false; } return true; }); }
sweep(); var tk = false; addEventListener("scroll", function () { if (!tk) { tk = true; requestAnimationFrame(function () { tk = false; sweep(); }); } }, { passive: true });
/* copy buttons */
root.addEventListener("click", function (e) {
var b = e.target.closest("[data-copy]"); if (!b) return;
var txt = b.getAttribute("data-copy"), label = b.textContent;
(navigator.clipboard ? navigator.clipboard.writeText(txt) : Promise.reject()).catch(function () {
var t = document.createElement("textarea"); t.value = txt; document.body.appendChild(t); t.select(); try { document.execCommand("copy"); } catch (x) {} t.remove();
}).finally(function () { b.textContent = "تم النسخ ✓"; b.classList.add("is-done"); setTimeout(function () { b.textContent = label; b.classList.remove("is-done"); }, 1800); });
});
/* composer + live bubble */
var form = root.querySelector(".cnc-form"), n = root.querySelector("#cnc-n"), p = root.querySelector("#cnc-p"), m = root.querySelector("#cnc-m");
var out = root.querySelector(".cnc-bubble.out"), typing = root.querySelector(".cnc-typing"), err = root.querySelector(".cnc-err");
var topic = TOPICS[0], tmr;
function text() {
var lines = ["مرحبًا قطن النيل 👋", "الموضوع: " + topic];
if (n.value.trim()) lines.push("الاسم: " + n.value.trim());
if (p.value.trim()) lines.push("الجوال: " + p.value.trim());
if (m.value.trim()) lines.push("", m.value.trim());
return lines.join("\n");
}
function render() {
typing.classList.add("on"); clearTimeout(tmr);
tmr = setTimeout(function () { typing.classList.remove("on"); }, 700);
var t = text(), now = new Date();
out.innerHTML = esc(t) + "" + now.getHours() + ":" + String(now.getMinutes()).padStart(2, "0") + " ✓✓ ";
out.classList.toggle("empty", !m.value.trim());
err.classList.remove("on");
}
[n, p, m].forEach(function (el) { el.addEventListener("input", render); });
root.querySelector(".cnc-topics").addEventListener("click", function (e) {
var b = e.target.closest("button"); if (!b) return;
root.querySelectorAll(".cnc-topics button").forEach(function (x) { x.classList.toggle("on", x === b); });
topic = b.textContent; render();
});
function valid() { var ok = n.value.trim() && m.value.trim(); err.classList.toggle("on", !ok); return ok; }
form.addEventListener("submit", function (e) { e.preventDefault(); if (!valid()) return; window.open("https://wa.me/" + C.wa + "?text=" + encodeURIComponent(text()), "_blank", "noopener"); });
root.querySelector("[data-mail]").addEventListener("click", function () {
if (!valid()) return; location.href = "mailto:" + C.email + "?subject=" + encodeURIComponent(topic + " — " + n.value.trim()) + "&body=" + encodeURIComponent(text());
});
render(); typing.classList.remove("on");
/* map: load when visible, switch per branch */
var map = root.querySelector(".cnc-map"), frame;
function show(q) {
if (!frame) { frame = document.createElement("iframe"); frame.loading = "lazy"; frame.referrerPolicy = "no-referrer-when-downgrade"; frame.title = "خريطة الفرع"; map.appendChild(frame); }
frame.src = mapSrc(q);
}
var mio = new IntersectionObserver(function (es) { if (es[0].isIntersecting) { show(root.querySelector(".cnc-b.on").getAttribute("data-q")); mio.disconnect(); } }, { rootMargin: "200px" });
mio.observe(map);
root.querySelector(".cnc-blist").addEventListener("click", function (e) {
if (e.target.closest("a")) return;
var b = e.target.closest(".cnc-b"); if (!b) return;
root.querySelectorAll(".cnc-b").forEach(function (x) { x.classList.toggle("on", x === b); });
show(b.getAttribute("data-q"));
});
root.querySelector(".cnc-blist").addEventListener("keydown", function (e) {
if ((e.key === "Enter" || e.key === " ") && e.target.classList.contains("cnc-b")) { e.preventDefault(); e.target.click(); }
});
return true;
}
if (!mount()) { var k = 0, t = setInterval(function () { if (mount() || ++k > 40) clearInterval(t); }, 120); }
})();
/* ===== page: branches ===== */
(function () {
if (decodeURIComponent(location.pathname).indexOf("page-2040898874") < 0) return;
var WA = "966597826007";
var BR = [
{ n: "فرع حي النزهة", area: "حي النزهة", a: "طريق عثمان بن عفان، مجمع السدحان — مقابل النخيل مول", q: "24.7638375,46.7142615",
m: "https://www.google.com/maps/search/?api=1&query=24.7638375,46.7142615",
img: "https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=900&q=70&auto=format&fit=crop" },
{ n: "فرع حي السويدي", area: "حي السويدي", a: "تقاطع طريق عائشة بنت أبي بكر مع شارع سدير", q: "24.5772707,46.6606184",
m: "https://www.google.com/maps/search/?api=1&query=24.5772707,46.6606184",
img: "https://images.unsplash.com/photo-1567401893414-76b7b1e5a7a5?w=900&q=70&auto=format&fit=crop" },
{ n: "فرع الروابي", area: "حي الروابي", a: "شارع عنيزة بجوار محمصة الرفاعي", q: "24.6940419,46.7847693",
m: "https://www.google.com/maps/search/?api=1&query=24.6940419,46.7847693",
img: "https://images.unsplash.com/photo-1489987707025-afc232f7ea0f?w=900&q=70&auto=format&fit=crop" }
];
var PIN = ' ';
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function embed(q) { return "https://www.google.com/maps?q=" + encodeURIComponent(q) + "&z=16&output=embed&hl=ar"; }
function wa(b) { return "https://wa.me/" + WA + "?text=" + encodeURIComponent("مرحبًا قطن النيل 👋\nعندي استفسار عن " + b.n + " (" + b.area + ")."); }
var html =
'' +
'
فروعنا في الرياض ' +
'
منتجات قطونيل الأصلية متوفرة في ثلاثة فروع بمدينة الرياض. اختر الفرع الأقرب لك واعرف طريقه على الخريطة.
' +
'
' + BR.map(function (b, i) {
return '
' + PIN + ' ' + b.n + ' ' + esc(b.a) + '
← ';
}).join("") + '
' +
'
' +
'زورنا في أقرب فرع ' +
'
راسلنا قبل زيارتك لنتأكد لك من توفر المقاس أو اللون الذي تبحث عنه.
' +
'
' + BR.map(function (b, i) {
return '
' + b.area + ' ' +
'' + b.n + ' ' + esc(b.a) + '، الرياض
' +
'
';
}).join("") + '
' +
'' +
'
في الفرع جرّب المقاس والخامة بنفسك تشكيلة قطونيل الأصلية كاملة فريق يساعدك تختار ' +
'
اختر فرعك ← ' +
'
أو أونلاين شحن لجميع مدن المملكة توصيل خلال 2 – 7 أيام نفس المنتجات الأصلية ' +
'
تسوّق الآن ← ' +
'
';
function mount() {
var src = document.querySelector(".app-inner > .container");
if (!src || document.getElementById("cnb")) return !!document.getElementById("cnb");
var root = document.createElement("div"); root.id = "cnb"; root.innerHTML = html;
src.classList.add("cnb-src"); src.parentNode.insertBefore(root, src);
document.body.classList.add("cnb-on");
var frame = root.querySelector(".cnb-map iframe"), map = root.querySelector(".cnb-map"), card = root.querySelector(".cnb-card");
frame.addEventListener("load", function () { map.classList.remove("is-loading"); });
function fill(i) {
var b = BR[i];
card.querySelector("small").textContent = b.area + " · الرياض";
card.querySelector("b").textContent = b.n;
card.querySelector("p").textContent = b.a;
card.querySelector("[data-dir]").href = b.m;
card.querySelector("[data-wa]").href = wa(b);
}
fill(0);
root.querySelector(".cnb-tabs").addEventListener("click", function (e) {
var t = e.target.closest(".cnb-tab"); if (!t || t.classList.contains("on")) return;
var i = +t.getAttribute("data-i");
root.querySelectorAll(".cnb-tab").forEach(function (x) { x.classList.toggle("on", x === t); });
map.classList.add("is-loading"); frame.src = embed(BR[i].q);
card.classList.add("swap"); setTimeout(function () { fill(i); card.classList.remove("swap"); }, 300);
});
root.addEventListener("click", function (e) {
var c = e.target.closest("[data-copy]");
if (c) {
var txt = c.getAttribute("data-copy"), label = c.textContent;
(navigator.clipboard ? navigator.clipboard.writeText(txt) : Promise.reject()).catch(function () {}).finally(function () {
c.textContent = "تم النسخ ✓"; c.classList.add("is-done"); setTimeout(function () { c.textContent = label; c.classList.remove("is-done"); }, 1800);
});
}
if (e.target.closest("[data-top]")) { e.preventDefault(); window.scrollTo({ top: 0, behavior: "smooth" }); }
});
var pending = [].slice.call(root.querySelectorAll("[data-r]"));
function sweep() { pending = pending.filter(function (el) { if (el.getBoundingClientRect().top < innerHeight * 0.92) { el.classList.add("is-in"); return false; } return true; }); }
sweep(); var tk = false; addEventListener("scroll", function () { if (!tk) { tk = true; requestAnimationFrame(function () { tk = false; sweep(); }); } }, { passive: true });
return true;
}
if (!mount()) { var k = 0, t = setInterval(function () { if (mount() || ++k > 40) clearInterval(t); }, 120); }
})();
/* ===== page: product ===== */
(function () {
var WA = "966597826007";
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
function mount() {
if (!document.body) return false;
if (!document.body.classList.contains("product-single")) return document.readyState !== "loading";
var tabs = document.querySelector(".product-form #product-tabs, #product-tabs");
if (!tabs || document.querySelector(".cnp-perks")) return !!document.querySelector(".cnp-perks");
var name = (document.querySelector(".main-content h1") || {}).textContent || "";
name = name.trim();
var msg = "مرحبًا قطن النيل 👋\nعندي استفسار عن المقاس/التوفر للمنتج:\n" + name + "\n" + location.href.split("?")[0];
var box = document.createElement("div");
box.className = "cnp-perks";
box.innerHTML =
'محتار في المقاس؟ اسألنا على واتساب ونساعدك تختار
' +
"";
tabs.parentNode.insertBefore(box, tabs);
var trig = [].slice.call(tabs.querySelectorAll(".tab-trigger"));
if (trig[0]) trig[0].classList.add("cnp-on");
trig.forEach(function (t) { t.addEventListener("click", function () { trig.forEach(function (x) { x.classList.toggle("cnp-on", x === t); }); }); });
return true;
}
/* buy bar: inline until you scroll past it, then fixed at the bottom */
function stickyBar() {
var bar = document.querySelector(".product-form > .sticky-product-bar");
if (!bar || bar.__cnp) return !!bar;
bar.__cnp = true;
var spacer = document.createElement("div"); spacer.className = "cnp-spacer";
bar.parentNode.insertBefore(spacer, bar);
var fixed = false, ticking = false;
function check() {
ticking = false;
var r = spacer.getBoundingClientRect(), h = fixed ? spacer.offsetHeight : bar.offsetHeight;
var past = r.top + h < 70;
if (past !== fixed) {
fixed = past;
spacer.style.height = fixed ? h + "px" : "0px";
bar.classList.toggle("cnp-fixed", fixed);
}
}
addEventListener("scroll", function () { if (!ticking) { ticking = true; requestAnimationFrame(check); } }, { passive: true });
addEventListener("resize", check, { passive: true });
check();
return true;
}
/* "buy now" lives in a shadow root with its own small bordered button — make it fill our pill */
function fixBuyNow() {
document.querySelectorAll("salla-mini-checkout-widget").forEach(function (w) {
var sr = w.shadowRoot; if (!sr || sr.querySelector("#cnp-reset")) return;
var st = document.createElement("style"); st.id = "cnp-reset";
st.textContent = ".s-fast-checkout-button{all:unset!important;box-sizing:border-box!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;width:100%!important;height:100%!important;cursor:pointer!important;color:inherit!important;font:inherit!important}:host{display:flex!important}";
sr.appendChild(st);
});
}
/* give the similar-products swiper the same gap as the CSS widths */
function railGap() {
document.querySelectorAll('.s-block--bundle-similar-products .swiper').forEach(function (el) {
var sw = el.swiper; if (!sw) return;
var gap = innerWidth <= 640 ? 14 : innerWidth <= 1023 ? 18 : 24;
if (sw.params.spaceBetween !== gap) { sw.params.spaceBetween = gap; sw.update(); }
});
}
/* "read more" opens the full description right where the short one is */
function readMore() {
var md = document.querySelector("#more-details");
if (!md || md.querySelector(".cnp-more")) return true;
var full = document.querySelector("#product-tabs-details .product__description");
if (!full) return !!document.querySelector("#product-tabs");
var p = md.querySelector("p"); if (!p) return true;
var link = p.querySelector("a.more-details"); var holder = link && link.closest("span");
if (holder) holder.remove();
var shortHtml = p.innerHTML;
md.innerHTML = '' + full.innerHTML + "
";
if (!link) return true;
var btn = document.createElement("button"); btn.type = "button"; btn.className = "cnp-more"; btn.innerHTML = "قراءة المزيد ⌄ ";
md.appendChild(btn);
btn.addEventListener("click", function () {
var open = btn.classList.toggle("open");
md.querySelector(".cnp-desc__short").hidden = open; md.querySelector(".cnp-desc__full").hidden = !open;
btn.firstChild.nodeValue = open ? "عرض أقل " : "قراءة المزيد ";
});
return true;
}
/* "you may also like": when Salla has no related products (small category), fill it from the parent collection */
var relDone = false;
function related() {
if (relDone) return true;
if (!window.salla || !salla.api || !salla.api.request) return false;
var pid = (/\/p(\d+)/.exec(decodeURIComponent(location.pathname)) || [])[1];
var cats = [].slice.call(document.querySelectorAll(".s-breadcrumb-wrapper a")).map(function (a) { var m = /\/c(\d+)/.exec(decodeURIComponent(a.getAttribute("href") || "")); return m && m[1]; }).filter(Boolean);
if (!pid || !cats.length) return !!document.querySelector(".s-breadcrumb-wrapper");
relDone = true;
salla.api.request("products?source=related&source_value=" + pid).then(function (r) {
if ((r.data || []).length >= 4) return;
var anchor = document.querySelector(".s-block--bundle-similar-products") || document.querySelector(".app-inner > .container.mt-4") || document.querySelector(".store-footer");
if (!anchor || document.getElementById("cnp-rel")) return;
var sec = document.createElement("section"); sec.id = "cnp-rel"; sec.className = "cnh-sec";
var arrow = function (prev) { return ' '; };
sec.innerHTML = 'قد يعجبك أيضًا قطع أخرى من نفس التشكيلة
' +
'
' + arrow(true) + ' ' + arrow(false) + "
" +
'
';
if (anchor.classList.contains("store-footer")) anchor.parentNode.insertBefore(sec, anchor); else anchor.parentNode.insertBefore(sec, anchor.nextSibling);
document.body.classList.add("cnp-rel-own");
/* drop the product the shopper is already looking at */
var mo = new MutationObserver(function () {
sec.querySelectorAll('custom-salla-product-card a[href*="/p' + pid + '"]').forEach(function (a) { var c = a.closest("custom-salla-product-card"); if (c) c.remove(); });
});
mo.observe(sec, { childList: true, subtree: true });
function step(dir) {
var w = sec.querySelector(".s-products-list-wrapper"); if (!w || !w.firstElementChild) return;
w.scrollBy({ left: dir * (w.firstElementChild.getBoundingClientRect().width + 22) * (innerWidth < 1024 ? 1 : 2), behavior: "smooth" });
}
sec.querySelector("[data-d='next']").addEventListener("click", function () { step(-1); });
sec.querySelector("[data-d='prev']").addEventListener("click", function () { step(1); });
}).catch(function () { relDone = false; });
return true;
}
/* move variation pickers out of the "options" tab to sit above the buy buttons */
function moveOptions() {
var form = document.querySelector(".product-form");
if (!form || form.querySelector(".cnp-opts")) return true;
var opts = document.querySelector("#product-tabs-options salla-product-options, #product-tabs salla-product-options");
if (!opts) return !!document.querySelector("#product-tabs");
var box = document.createElement("div"); box.className = "cnp-opts";
form.appendChild(box); box.appendChild(opts);
document.body.classList.add("cnp-has-opts");
var trig = document.querySelector('#product-tabs .tab-trigger[data-target="product-tabs-options"]');
var other = document.querySelector('#product-tabs .tab-trigger[data-target="product-tabs-details"]');
if (trig && other && trig.classList.contains("is-active")) other.click();
return true;
}
addEventListener('resize', function () { setTimeout(railGap, 150); }, { passive: true });
var lastGap = 0; addEventListener('scroll', function () { var n = Date.now(); if (n - lastGap > 600) { lastGap = n; railGap(); } }, { passive: true });
var tries = 0, iv = setInterval(function () {
if (!document.body || !document.body.classList.contains("product-single")) { if (document.readyState !== "loading") clearInterval(iv); return; }
moveOptions(); readMore(); related(); fixBuyNow(); stickyBar(); railGap(); if (++tries > 30) clearInterval(iv);
}, 300);
if (!mount()) { var n = 0, t = setInterval(function () { if (mount() || ++n > 40) clearInterval(t); }, 150); }
})();
/* ===== page: shop ===== */
(function () {
if (decodeURIComponent(location.pathname).indexOf("page-2045044345") < 0) return;
var IMG = "https://cdn.salla.sa/NoOnD/products/FpftZ2dFC75V5uyiGedBzviLlRqxSOnk0jZe844I.jpg";
var SORTS = [["ourSuggest", "مقترحاتنا"], ["bestSell", "الأكثر مبيعًا"], ["priceFromLowToTop", "السعر: من الأقل"], ["priceFromTopToLow", "السعر: من الأعلى"]];
function esc(t) { return String(t == null ? "" : t).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
var state = { src: "latest", id: "", sort: "ourSuggest" };
function list() {
var box = document.querySelector("#cns .cns-list");
var attrs = 'source="' + (state.id ? "categories" : "latest") + '"' + (state.id ? ' source-value="' + state.id + '"' : "") +
' autoload limit="24" product-card-component="custom-salla-product-card"';
box.innerHTML = " ";
/* Salla only sorts inside a collection, and only when sortBy changes after the list is ready */
document.getElementById("cns").classList.toggle("cns-all", !state.id);
var el = box.firstElementChild;
if (state.id && state.sort !== "ourSuggest" && el.componentOnReady) el.componentOnReady().then(function () { el.sortBy = state.sort; });
}
function mount() {
var src = document.querySelector(".app-inner > .container");
var d = window.__cnx;
if (!src || !d) return false;
if (document.getElementById("cns")) return true;
var cols = d.items.filter(function (it) { return d.cfg.notCollections.indexOf(it.t) < 0; }).map(function (it) {
var m = /\/c(\d+)/.exec(decodeURIComponent(it.h || "")); return m ? { t: it.t, id: m[1] } : null;
}).filter(Boolean);
var root = document.createElement("div"); root.id = "cns";
root.innerHTML =
'' +
'
الرئيسية • المتجر ' +
'
كل منتجات قطونيل تشكيلة كاملة من القطن المصري لكل أفراد العائلة. اختر القسم أو رتّب المنتجات كما تحب.
' +
"
" +
' ' +
'الكل ' +
cols.map(function (c) { return '' + esc(c.t) + " "; }).join("") +
'
الأحدث أولًا ترتيب حسب ' +
SORTS.map(function (s) { return '' + s[1] + " "; }).join("") +
"
" +
'';
src.parentNode.insertBefore(root, src);
list();
var track = root.querySelector(".cns-chips"), ind = root.querySelector(".cns-ind");
function slide() {
var on = track.querySelector(".cns-chip.on"); if (!on) return;
var tr = track.getBoundingClientRect(), r = on.getBoundingClientRect();
ind.style.width = r.width + "px";
ind.style.transform = "translateX(" + (r.right - tr.right + track.scrollLeft) + "px)";
}
slide(); addEventListener("resize", slide, { passive: true }); track.addEventListener("scroll", slide, { passive: true });
if (document.fonts && document.fonts.ready) document.fonts.ready.then(slide);
track.addEventListener("click", function (e) {
var b = e.target.closest(".cns-chip"); if (!b || b.classList.contains("on")) return;
root.querySelectorAll(".cns-chip").forEach(function (x) { x.classList.toggle("on", x === b); });
slide();
state.id = b.getAttribute("data-id"); list();
b.scrollIntoView({ block: "nearest", inline: "center", behavior: "smooth" });
});
root.querySelector(".cns-sort select").addEventListener("change", function (e) { state.sort = e.target.value; list(); });
return true;
}
if (!mount()) { var n = 0, iv = setInterval(function () { if (mount() || ++n > 60) clearInterval(iv); }, 150); }
})();