if (window.location.href.includes("test") || true) { console.log("custom pc activated"); if (window.customCardProps?.custom_pc) { console.log("custom pc activated 2"); window.run_product_card = function (_this) { console.log("custom pc activated 3"); let lang = document.documentElement.getAttribute("lang"); const remained = salla.lang.get("pages.products.remained"); const donationPH = salla.lang.get("pages.products.donation_placeholder"); const startingPrice = salla.lang.get("pages.products.starting_price"); const outOfStock = salla.lang.get("pages.products.out_of_stock"); const calories = salla.lang.get("pages.products.calories"); // Custom props _this.product_preview_down = window.customCardProps?.product_preview_down; _this.p_atc_btn_hidden = window.customCardProps?.p_atc_btn_hidden; _this.product_preview_icon_hide = window.customCardProps?.product_preview_icon_hide; _this.preview_text = window.customCardProps?.preview_text; _this.is_price_ratio_on = window.customCardProps?.is_price_ratio_on; _this.price_ratio_place = window.customCardProps?.price_ratio_place; _this.price_ratio_word = window.customCardProps?.price_ratio_word; _this.small_atc = window.customCardProps?.small_atc; _this.show_pc_ratings = window.customCardProps?.show_pc_ratings; if (_this.show_pc_ratings === "hide") { _this.show_pc_ratings = false; } let product_ration_html; if (_this?.product?.is_on_sale) { _this.product_ratio_percent = Math.round( ((_this.product?.regular_price - _this.product?.sale_price) / _this.product?.regular_price) * 100 ); product_ration_html = `
${_this.price_ratio_word}${_this.product_ratio_percent}%
`; } _this.innerHTML = `
${ _this.product.is_on_sale && _this.is_price_ratio_on && _this.price_ratio_place === "over" ? product_ration_html || "" : "" } ${ _this.product.promotion_title ? `${_this.product.promotion_title}` : "" } ${ _this.showQuantity && _this.product.quantity ? `${remained} ${_this.product.quantity}` : "" } ${ _this.showQuantity && _this.product.is_out_of_stock ? `
${outOfStock}
` : "" } ${_this.product.image.alt} ${ _this.product_preview_down ? "" : `
` }
${ _this.showWishlist ? `` : "" }

${_this.product.subtitle || ""}

${_this.product.name}

${ _this.product.rating && _this.show_pc_ratings ? `` : "" } ${ _this.product.calories ? `
${_this.product.calories} ${calories}
` : "" } ${ _this.product.is_donation ? `
${ _this.product.can_donate ? `` : "" }
` : "" }
${ _this.product.is_on_sale ? `${salla.money( _this.product.sale_price )}${salla.money( _this.product.regular_price )}` : _this.product.starting_price ? `${startingPrice}${salla.money(_this.product.starting_price)}` : `${salla.money(_this.product.price)}` } ${ _this.product?.is_on_sale && _this.is_price_ratio_on && _this.price_ratio_place === "down" ? product_ration_html || "" : "" }
${ !_this.hideAddBtn ? `
${ _this.product.add_to_cart_label || "" }
` : "" } ${ !_this.product_preview_down ? `
${_this.preview_text}
` : "" }
`; }; } (function () { const selector = ".index #fullscreen-banner-0 salla-slider"; // const selector = ".index .sq-awesome-banners salla-slider"; const maxTime = 10000; // 10 seconds const checkInterval = 10; // 10ms let elapsed = 0; const interval = setInterval(() => { const element = document.querySelector(selector); if (element) { run_showControllsForSlider(element); clearInterval(interval); console.log("✅ Element found and updated"); return; } elapsed += checkInterval; if (elapsed >= maxTime) { clearInterval(interval); console.log("❌ Element not found after 10 seconds"); } }, checkInterval); function run_showControllsForSlider(el) { // add id to the element el.setAttribute("id", "fullscreen-banner-0-slider"); el.setAttribute("show-controls", "true"); el.setAttribute("pagination", "true"); el.setAttribute("controls-outer", ""); } })(); // move .header-search to .header-innerLeft using addjecentelement beforeend, no need for interval, all elements are found immediately // (function () { // const headerInnerLeft = document.querySelector(".header-innerLeft"); // const headerSearch = document.querySelector(".header-search"); // if (headerInnerLeft && headerSearch) { // headerInnerLeft.insertAdjacentElement("beforeend", headerSearch); // console.log("✅ Moved .header-search to .header-innerLeft"); // } else { // console.log("❌ Elements not found for moving .header-search"); // } // })(); (function () { // انتظر حتى تلقى العناصر let tries = 0; const maxTries = 1000; const interval = setInterval(() => { const socialList = document.querySelector(".footer-social-outer salla-social .s-social-list"); const contactsWhatsapp = document.querySelector('salla-contacts a[href*="wa.me"]'); if (socialList && contactsWhatsapp) { // أنشئ عنصر جديد للواتساب const whatsappLi = document.createElement("li"); whatsappLi.className = "s-social-link"; whatsappLi.innerHTML = ` whatsapp `; // أضفه للـ social list socialList.appendChild(whatsappLi); // اخفي الـ salla-contacts الأصلي (اختياري) const sallaContacts = document.querySelector("salla-contacts"); if (sallaContacts) { sallaContacts.style.display = "none"; } setTimeout(() => { inserContact(); }, 50); // make .footer-contact hidden in all screens const footerContact = document.querySelector(".footer-contact"); if (footerContact) { footerContact.setAttribute("style", "display: none !important;"); } // remove px-8 from .footer-container if exists const footerContainer = document.querySelector(".footer-container"); if (footerContainer && footerContainer.classList.contains("lg:px-8")) { footerContainer.classList.remove("lg:px-8"); } clearInterval(interval); console.log("✅ WhatsApp merged to social list"); } else if (++tries >= maxTries) { clearInterval(interval); console.log("❌ Timeout"); } }, 10); })(); // insert .footer-social-outer before .footer-bottom__inside-footer-top function inserContact() { console.log("inserContact called"); const footerTop = document.querySelector(".footer-bottom__inside-footer-top"); const footerSocial = document.querySelector(".footer-social-outer"); if (footerTop && footerSocial) { console.log(footerTop && footerSocial); footerTop.insertAdjacentElement("afterbegin", footerSocial); } } }