/* ExQute: Request-a-Quote via WhatsApp for service-type products (cleaning machines, tools, chemicals, parts, services) */
(function () {
if (window.__xqQuote) return; window.__xqQuote = 1;
var WA = '966533507288';
var en = (document.documentElement.lang || '').indexOf('en') === 0;
var LABEL = en ? 'Request a Quote' : 'اطلب عرض سعر';
var MSG = en ? 'Hello ExQute, I would like a quotation for: ' : 'السلام عليكم، أرغب في عرض سعر لـ: ';
var st = document.createElement('style');
st.textContent = '.xq-quote{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:40px;padding:8px 12px;border-radius:8px;background:#25D366;color:#fff!important;font-weight:700;font-size:14px;text-decoration:none!important;line-height:1.2}.xq-quote:hover{filter:brightness(.95)}.xq-quote i{font-size:18px}.xq-hide{display:none!important}';
document.head.appendChild(st);
function hide(el) { if (el) el.classList.add('xq-hide'); }
function waLink(name, url) { return 'https://wa.me/' + WA + '?text=' + encodeURIComponent(MSG + name + '\n' + url); }
function run() {
var btns = document.querySelectorAll('salla-add-product-button[product-type="service"]:not([data-xq])');
for (var i = 0; i < btns.length; i++) {
var b = btns[i]; b.setAttribute('data-xq', '1');
var card = b.closest('.s-product-card-entry');
var name = '', url = location.href.split('?')[0];
if (card) {
var t = card.querySelector('.s-product-card-content-title'); name = t ? t.textContent : '';
var a = card.querySelector('.s-product-card-image a, .s-product-card-content-title a, a[href]'); if (a) url = a.href;
card.querySelectorAll('.s-product-card-price, .s-product-card-content-sub').forEach(hide);
} else {
var opts = document.querySelector('salla-product-options');
var hasForm = opts && opts.innerHTML.trim().length > 0;
if (hasForm) { var q2 = document.createElement('a'); q2.className = 'xq-quote'; q2.style.marginTop = '8px'; q2.target = '_blank'; q2.rel = 'noopener'; var h2 = document.querySelector('h1'); q2.href = waLink((h2 ? h2.textContent : document.title).replace(/\s+/g, ' ').trim(), url); q2.innerHTML = '' + (en ? 'Or ask on WhatsApp' : 'أو تواصل عبر واتساب') + ''; b.parentNode.insertBefore(q2, b.nextSibling); continue; }
var h = document.querySelector('h1'); name = h ? h.textContent : document.title;
document.querySelectorAll('.price-descount-box, .p-price, .n-price, .o-price, salla-quick-order, salla-installment').forEach(hide);
var qty = document.querySelector('salla-quantity-input');
if (qty) { hide(qty.closest('.flex-box') || qty); }
}
var q = document.createElement('a');
q.className = 'xq-quote'; q.target = '_blank'; q.rel = 'noopener';
q.href = waLink(name.replace(/\s+/g, ' ').trim(), url);
q.innerHTML = '' + LABEL + '';
hide(b); b.parentNode.insertBefore(q, b);
}
}
function start() { run(); new MutationObserver(run).observe(document.documentElement, { childList: true, subtree: true }); }
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
})();
/* ExQute: LinkedIn icon in footer social links */
(function () {
var URL_LI = 'https://www.linkedin.com/company/exqute-solutions-company/';
var SVG = '';
function addLI() {
var lists = document.querySelectorAll('ul.s-social-list');
if (!lists.length) return false;
for (var i = 0; i < lists.length; i++) {
var ul = lists[i];
if (ul.querySelector('[data-xq-li]')) continue;
var li = ul.querySelector('li.s-social-link'); if (!li) continue;
var n = li.cloneNode(true); n.setAttribute('data-xq-li', '1');
var a = n.querySelector('a'); a.href = URL_LI; a.title = 'linkedin'; a.setAttribute('aria-label', 'linkedin');
var ic = n.querySelector('.s-social-icon'); if (ic) ic.innerHTML = SVG;
ul.appendChild(n);
}
return true;
}
function start() { if (!addLI()) { var mo = new MutationObserver(function () { if (addLI()) mo.disconnect(); }); mo.observe(document.documentElement, { childList: true, subtree: true }); } }
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
})();
/* ExQute: hero banner links -> category pages (banner images map to categories) */
(function () {
var F = '/%D8%A7%D9%84%D8%B9%D8%B7%D9%88%D8%B1-%D9%88%D8%A7%D9%84%D8%B9%D9%86%D8%A7%D9%8A%D8%A9-%D8%A8%D8%A7%D9%84%D9%85%D9%86%D8%B2%D9%84/c1948229826';
var MAP = {
'6458a1ec': F, '01e5cbc4': F, '52a6218e': F, 'afc31180': F,
'2ad1d71c': '/mobile-accessories/c1141797396', 'c0ef584d': '/mobile-accessories/c1141797396',
'4a373c7e': '/cleaning-tools-pads/c872230260', '4b340368': '/cleaning-tools-pads/c872230260',
'fdc22bbb': '/cleaning-machines/c1753325928', '6a352ab0': '/cleaning-machines/c1753325928',
'7690fe15': '/vacuum-parts/c2070587760', '37d0ba5c': '/vacuum-parts/c2070587760'
};
var lang = location.pathname.indexOf('/en') === 0 ? 'en' : 'ar';
function fix() {
var links = document.querySelectorAll('a.banner-media-link:not([data-xq-bn])');
for (var i = 0; i < links.length; i++) {
var a = links[i], img = a.querySelector('img');
var src = img ? (img.getAttribute('src') || img.getAttribute('data-src') || '') : '';
for (var k in MAP) { if (src.indexOf(k) > -1) { a.href = '/' + lang + MAP[k]; a.setAttribute('data-xq-bn', '1'); break; } }
}
}
function start() { fix(); new MutationObserver(fix).observe(document.documentElement, { childList: true, subtree: true }); }
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
})();
/* ExQute: announcement bar items are text only (no dead "#" links) */
(function(){
if (window.__xqBar) return; window.__xqBar = 1;
var s=document.createElement('style');
s.textContent='.marquee a[href="#"],.marquee a.xq-nolink{cursor:default!important;pointer-events:none!important;text-decoration:none!important}';
document.head.appendChild(s);
function fix(){
document.querySelectorAll('.marquee a[href="#"], .marquee a[href=""]').forEach(function(a){
a.removeAttribute('href'); a.classList.add('xq-nolink');
a.addEventListener('click',function(e){e.preventDefault();});
});
}
fix(); new MutationObserver(fix).observe(document.documentElement,{childList:true,subtree:true});
})();
/* ExQute: hide theme's broken left WhatsApp button + remove duplicate brand in page titles */
(function(){
if (window.__xqTidy) return; window.__xqTidy = 1;
var s=document.createElement('style');
s.textContent='.fixed-btm a[aria-label="whatsapp-btn"]{display:none!important}';
document.head.appendChild(s);
var re=/ [|] (إكسكيوت|ExQute)(?= [|] .*(إكسكيوت|ExQute))/;
function t(){ var n=document.title.replace(re,''); if(n!==document.title) document.title=n; }
t(); var el=document.querySelector('title'); if(el) new MutationObserver(t).observe(el,{childList:true});
})();
/* ExQute: hide duplicate GetButton WhatsApp widget (loaded via GTM) — keep Salla WhatsApp app button */
(function(){
if (window.__xqHideGB) return; window.__xqHideGB = 1;
var s = document.createElement('style');
s.textContent = '[id^="gb-widget"]{display:none!important}';
document.head.appendChild(s);
})();