/* Green whatsapp corner icon */ document.addEventListener("DOMContentLoaded", function () { const wa = document.createElement("a"); wa.href = "https://wa.me/966114042641?text=Hi%20ESBT%2C%20I%20need%20a%20quotation%20for%3A"; wa.target = "_blank"; wa.className = "esbt-whatsapp"; const img = document.createElement("img"); img.src = "https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg"; img.alt = "WhatsApp"; wa.appendChild(img); document.body.appendChild(wa); }); /*================================*/ (function () { const WRAP_ID = "esbt-home-hero"; const WA_LINK = "https://wa.me/966114042641"; function isHome() { const p = (location.pathname || "").replace(/\/+$/, ""); return p === "" || p === "/" || p === "/ar"; } function getLang() { const lang = (document.documentElement.getAttribute("lang") || "").toLowerCase(); const dir = (document.documentElement.getAttribute("dir") || "").toLowerCase(); if (lang.startsWith("ar")) return "ar"; return dir === "rtl" ? "ar" : "en"; } function mount() { if (!isHome()) return; const header = document.querySelector("header"); if (!header || !header.parentNode) return; let wrap = document.getElementById(WRAP_ID); if (!wrap) { wrap = document.createElement("section"); wrap.id = WRAP_ID; wrap.style.cssText = "padding:28px 16px;text-align:center"; header.parentNode.insertBefore(wrap, header.nextSibling); } const lang = getLang(); if (lang === "ar") { wrap.innerHTML = `
توريد أجهزة قياس صناعية للاستخدامات الصناعية والمهنية — فروعنا في الرياض والدمام والخبر
`; } else { wrap.innerHTML = `Supplying industrial measuring instruments for professional use — Riyadh, Dammam & Khobar branches
`; } } window.addEventListener("load", mount); setTimeout(mount, 600); new MutationObserver(mount).observe(document.documentElement, { attributes: true, attributeFilter: ["lang", "dir"] }); })();