/* Add custom Js styles below */ /* Add custom Js styles below */ // live chat app window.chatwootSettings = {"position":"right","type":"standard","launcherTitle":"تواصل معنا"}; (function(d,t) { var BASE_URL="https://app.karzoun.chat"; var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; g.src=BASE_URL+"/packs/js/sdk.js"; g.async = true; s.parentNode.insertBefore(g,s); g.onload=function(){ window.chatwootSDK.run({ websiteToken: 'oefJKX5ZefDDqzuiquMgQmvW', baseUrl: BASE_URL }) } })(document,"script"); function appendGoogleReviewsIframe() { // Only on homepage if (!document.body.classList.contains("index")) return; // Prevent duplicates if (document.getElementById("google-reviews-iframe")) return; // Create iframe var iframe = document.createElement("iframe"); iframe.id = "google-reviews-iframe"; iframe.src = "https://3ada4976d062417999b48c2b54573f0c.elf.site/"; iframe.style.width = "100%"; iframe.style.height = "560px"; // adjust if needed iframe.style.overflow = "hidden"; iframe.style.border = "0"; iframe.frameBorder = "0"; // ✅ Find the section by its title text: "المراتب الطبية" var titleEl = Array.from(document.querySelectorAll("h2.title-section__title")) .find((el) => el.textContent.trim() === "المراتب الطبية"); // If found, insert iframe ABOVE that section wrapper if (titleEl) { var targetSection = titleEl.closest("div.flex.flex-wrap.items-center.justify-between"); if (targetSection && targetSection.parentNode) { targetSection.parentNode.insertBefore(iframe, targetSection); return; } } // Fallback: old behavior (after products list) if target section not found var sallaProductsList = document.querySelector("salla-products-list"); if (sallaProductsList && sallaProductsList.parentNode) { sallaProductsList.parentNode.insertBefore(iframe, sallaProductsList.nextSibling); } else { document.body.appendChild(iframe); } } // Run when ready + retry (themes often load sections later) function runReviewsWithRetry(tries = 20) { appendGoogleReviewsIframe(); if (document.getElementById("google-reviews-iframe")) return; if (tries <= 0) return; setTimeout(() => runReviewsWithRetry(tries - 1), 500); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", () => runReviewsWithRetry()); } else { runReviewsWithRetry(); } document.addEventListener("DOMContentLoaded", function () { const menuItem = document.querySelector(".offers-page-li a"); if (menuItem) { menuItem.href = "https://salla.sa/horsemattress/category/xDybe?filters[category_id]=256257279"; menuItem.setAttribute("aria-label", "الاكثر مبيعاً"); const textElement = menuItem.querySelector(".btm-menu-item span, .btm-menu-item p, .btm-menu-item div"); if (textElement) { textElement.textContent = "الاكثر مبيعاً"; } } }); document.addEventListener("DOMContentLoaded", function () { const interval = setInterval(function () { const kanbItem = document.querySelector('a[aria-label="كنب مودرن"]'); const mobileItem = document.getElementById("523790225"); if (kanbItem && !document.getElementById("blog-menu-item")) { const li = document.createElement("li"); li.id = "blog-menu-item"; li.className = kanbItem.closest("li").className.replace("has-children", "").trim(); li.innerHTML = `المدونة`; kanbItem.closest("li").insertAdjacentElement("afterend", li); } if (mobileItem && !document.getElementById("blog-menu-item-mobile")) { const li = document.createElement("li"); li.id = "blog-menu-item-mobile"; li.className = "lg:hidden text-sm font-normal"; li.innerHTML = `المدونة`; mobileItem.insertAdjacentElement("afterend", li); } if (document.getElementById("blog-menu-item") && document.getElementById("blog-menu-item-mobile")) { clearInterval(interval); } }, 200); });