/* Add custom JS code below */
/*
*/
(function () { window.dataLayer = window.dataLayer || []; function g() { window.dataLayer.push(arguments); } document.addEventListener('click', function (e) { var a = e.target && e.target.closest ? e.target.closest('a[href*="wa.me"], a[href*="api.whatsapp.com"], a[href*="whatsapp.com"]') : null; if (!a) { return; } var f = (typeof window.gtag === 'function') ? window.gtag : g; f('event', 'conversion', {'send_to': 'AW-18547378415/r3XwCJDokbsdEO-RioxF'}); }, true); })();
(function () {
if (!/\/p\d+\/?$/.test(location.pathname)) { return; }
function add() {
if (document.getElementById('atmtah-wa-biz')) { return true; }
var bar = document.querySelector('section.addtocart-bar');
var h = document.querySelector('h1');
if (!bar || !h) { return false; }
var name = h.textContent.replace(/\s+/g, ' ').trim();
var q = String.fromCharCode(34);
var msg = 'جيتك من المتجر وعندي إستفسار بخصوص ' + q + name + q;
var a = document.createElement('a');
a.id = 'atmtah-wa-biz'; a.target = '_blank'; a.rel = 'noopener';
a.href = 'https://wa.me/966570574773' + String.fromCharCode(63) + 'text=' + encodeURIComponent(msg);
var ic = document.createElement('i'); ic.className = 'sicon-whatsapp'; ic.style.cssText = 'font-size:22px;line-height:1;';
var sp = document.createElement('span'); sp.textContent = 'اضغط هنا للتواصل واتساب في حال كان لديك استفسار';
a.appendChild(ic); a.appendChild(sp);
a.style.cssText = 'display:flex;align-items:center;justify-content:center;gap:8px;width:100%;box-sizing:border-box;margin:12px 0;padding:12px 16px;text-align:center;background:#25D366;color:#fff;border-radius:6px;font-weight:700;font-size:14px;text-decoration:none;font-family:inherit;';
var att=null; var bs=document.querySelectorAll('label.form-label b'); for (var k=0;k-1){ att=bs[k].closest('section'); break; } } if (att) { att.insertAdjacentElement('beforebegin', a); } else { bar.insertAdjacentElement('afterend', a); }
return true;
}
if (!add()) { var n = 0; var t = setInterval(function () { n++; if (add() || n > 40) { clearInterval(t); } }, 250); }
})();
(function () {
if (!/\/p\d+\/?$/.test(location.pathname)) { return; }
function addNote() {
if (document.getElementById('atmtah-attach-note')) { return true; }
var labels = document.querySelectorAll('label.form-label b');
var target = null;
for (var i = 0; i < labels.length; i++) {
if (labels[i].textContent.replace(/\s+/g, '') === 'المرفقات') { target = labels[i]; break; }
}
if (!target) { return false; }
var row = target.parentElement && target.parentElement.parentElement;
if (!row) { return false; }
var p = document.createElement('p');
p.id = 'atmtah-attach-note';
p.textContent = 'أرفق صورة بابك في حال كنت متردد بخصوص التركيب وسيتم التأكد منه قبل شحن القفل';
p.style.cssText = 'margin:10px 0 0;padding:10px 12px;background:#f0fdf4;border:1px solid #bbf7d0;border-radius:6px;color:#166534;font-size:13px;line-height:1.7;text-align:start;';
row.insertAdjacentElement('afterend', p);
return true;
}
var n = 0;
var t = setInterval(function () { n++; if (addNote() || n > 40) { clearInterval(t); } }, 250);
})();
(function () {
if (!/\/p\d+\/?$/.test(location.pathname)) { return; }
if (!document.getElementById('atmtah-mobile-css')) {
var st = document.createElement('style');
st.id = 'atmtah-mobile-css';
st.textContent = '@media (max-width: 639px) { section.addtocart-bar { flex-direction: row !important; align-items: center !important; } section.addtocart-bar > .center-between { flex: 0 0 38% !important; width: 38% !important; } section.addtocart-bar salla-add-product-button { flex: 1 1 auto !important; width: auto !important; min-width: 0; } section.addtocart-bar salla-add-product-button button.s-button-element { background: #103d48 !important; color: #fff !important; } .floating-contacts { display: none !important; } }';
document.head.appendChild(st);
}
function addTrust() {
if (document.getElementById('atmtah-trust')) { return true; }
var h = document.querySelector('h1');
if (!h) { return false; }
var e = h.nextElementSibling;
while (e && !(e.tagName === 'DIV' && /\d/.test(e.textContent))) { e = e.nextElementSibling; }
if (!e) { return false; }
var tl = document.createElement('div');
tl.id = 'atmtah-trust';
tl.textContent = 'ضمان 3 سنوات • وصلك وما ناسبك؟ إسترجعه خلال 30 يوم';
tl.style.cssText = 'margin:-8px 0 16px;padding:8px 12px;background:#f0fdf4;border:1px solid #bbf7d0;border-radius:6px;color:#166534;font-size:13px;font-weight:700;text-align:center;';
e.insertAdjacentElement('afterend', tl);
return true;
}
var n = 0;
var t = setInterval(function () { n++; if (addTrust() || n > 40) { clearInterval(t); } }, 250);
})();
(function () { if (!/\/p\d+\/?$/.test(location.pathname)) { return; } var s = document.createElement('style'); s.id = 'atmtah-pp-css'; s.textContent = 'salla-quick-order{display:none !important;} salla-installment{zoom:0.7;display:block;}'; document.head.appendChild(s); var n = 0; var t = setInterval(function () { n++; var st = document.querySelectorAll('li strong'); for (var i = 0; i < st.length; i++) { if (st[i].textContent.indexOf('مشاركة') > -1) { var li = st[i].closest('li'); if (li) { li.style.display = 'none'; } } } if (n > 40) { clearInterval(t); } }, 250); })();
/* Section dividers between homepage product sections */
(function(){var s=document.createElement('style');s.id='section-dividers';s.textContent='.s-block--fixed-products.container{position:relative}.s-block--fixed-products.container::before{content:"";position:absolute;top:-32px;left:15px;right:15px;height:1px;background:linear-gradient(to right,transparent,#c9ced6 15%,#c9ced6 85%,transparent)}';document.head.appendChild(s);})();
/* Responsive YouTube videos inside product descriptions */
(function(){var s=document.createElement('style');s.id='ql-video-fix';s.textContent='iframe.ql-video{display:block;width:100%;max-width:800px;aspect-ratio:16/9;height:auto;margin:16px auto;border:0;border-radius:12px}';document.head.appendChild(s);})();