/* SUDAMEX navigation and shipment selection v1 */ (function(){ function start(){ if(document.getElementById('sudamex-global-nav'))return; var home='https://sudamex95.com/', shipping=home+'pages/lp1304367330/2147075346', shop=home+'pages/lp1304367330/1971855901', purchase=home+'pages/lp1304367330/463667996'; var style=document.createElement('style');style.id='sudamex-navigation-style';style.textContent='.sx-appbar{display:none!important}body{padding-bottom:calc(86px + env(safe-area-inset-bottom))!important}#sudamex-global-nav{position:fixed;inset:auto 0 0;z-index:990;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));direction:rtl;background:#101010;border-top:1px solid #665332;padding:7px 6px calc(8px + env(safe-area-inset-bottom));font-family:Tahoma,Arial,sans-serif;box-shadow:0 -3px 18px #0002}#sudamex-global-nav a{color:#eee4d1;text-decoration:none;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:5px;min-height:48px;font-size:12px;position:relative}#sudamex-global-nav i{font-size:21px;color:#d4b67a}#sudamex-global-nav a[aria-current=page]{color:#e5c98c;font-weight:bold}#sudamex-global-nav a:focus-visible{outline:2px solid #d4b67a;outline-offset:-2px}#sx-native-count{background:#d4b67a;color:#111;border-radius:10px;padding:0 5px;font-size:11px;position:absolute;top:0;left:calc(50% + 8px)}.sx-live-panel{direction:rtl;font-family:Tahoma,Arial,sans-serif;background:#111;color:#eee4d1;padding:24px 18px;margin:16px auto;max-width:1120px;border-radius:12px}.sx-live-panel h2{font-size:24px;margin:0 0 14px}.sx-live-panel p{font-size:14px;line-height:1.8}.sx-live-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.sx-live-card{display:flex;flex-direction:column;gap:12px;padding:18px;border:1px solid #665332;border-radius:10px;color:#eee4d1!important;text-decoration:none!important;background:#1c1812}.sx-live-card strong{font-size:18px}.sx-live-card span{color:#dfc48d}.sx-live-card small{line-height:1.8}.sx-live-action{display:block;text-align:center;border-radius:6px;padding:13px;background:#d7bb80;color:#17130d!important;text-decoration:none!important}.sx-live-links{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:18px}.sx-live-links a{border:1px solid #665332;padding:10px 15px;border-radius:6px;color:#e5c98c;text-decoration:none}.sx-live-air{margin-top:16px}@media(min-width:900px){#sudamex-global-nav{left:50%;right:auto;transform:translateX(-50%);width:640px;border-radius:16px 16px 0 0}}@media(max-width:550px){.sx-live-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sx-live-card{padding:12px}.sx-live-card strong{font-size:15px}#sudamex-global-nav a{font-size:11px}}';document.head.appendChild(style); var nav=document.createElement('nav');nav.id='sudamex-global-nav';nav.setAttribute('aria-label','التنقل الرئيسي للمتجر'); nav.innerHTML='الرئيسيةالأقسامالمفضلةالسلةحسابي'; document.body.appendChild(nav); Array.prototype.forEach.call(nav.querySelectorAll('a'),function(a){if(a.href===location.origin+location.pathname)a.setAttribute('aria-current','page');}); function repairQuantityLimits(){document.querySelectorAll('salla-quantity-input[max=""],salla-quantity-input input[max=""]').forEach(function(el){el.removeAttribute("max");});}repairQuantityLimits();new MutationObserver(repairQuantityLimits).observe(document.body,{childList:true,subtree:true}); function syncCount(){var source=document.querySelector('salla-cart-summary .s-cart-summary-count');var target=document.getElementById('sx-native-count');if(source&&target){var text=source.textContent.trim();if(target.textContent!==text)target.textContent=text;target.hidden=false;}} syncCount();var summary=document.querySelector('salla-cart-summary');if(summary)new MutationObserver(syncCount).observe(summary,{childList:true,subtree:true,characterData:true}); if(/2147075346|1971855901|463667996|1196769566/.test(location.pathname)){ var panel=document.createElement('section');panel.className='sx-live-panel';panel.setAttribute('aria-label','اختيار الطلب');panel.innerHTML=''; if(/2147075346|1971855901/.test(location.pathname)){ var items=[['كرتون حتى 30 كجم',200,'خدمة-شحن-كرتون-حتى-30-كجم-من-الرياض-إلى-السودان/p1185733739'],['شنطة كبيرة',250,'خدمة-شحن-شنطة-كبيرة-من-الرياض-إلى-السودان/p452632169'],['برميل',300,'خدمة-شحن-برميل-من-الرياض-إلى-السودان/p944555282']];panel.innerHTML+='

اختر شحنتك

افتح نوع الشحنة، اختر مدينة الوصول والكمية، ثم أضفها إلى سلة طلبك.

'+items.map(function(p){return ''+p[0]+''+p[1]+' ر.سمن الباب إلى الباب مع التغليفاختيار الخيارات ←';}).join('')+'
'; if(/2147075346/.test(location.pathname))panel.innerHTML+='الشحن الجوي — طلب عرض سعر'; }else{panel.innerHTML+='إرسال تفاصيل الطلب لعرض السعر';} var main=document.querySelector('main');if(main)main.prepend(panel);else{var header=document.querySelector('header');if(header)header.after(panel);else document.body.insertBefore(panel,nav);} } } if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start(); })(); /* SUDAMEX: shipping cart first */ (function(){function init(){ var ids=['1185733739','452632169','944555282']; if(ids.some(function(id){return location.pathname.endsWith('/p'+id);})){var s=document.createElement('style');s.textContent='form.product-form salla-mini-checkout-widget,form.product-form salla-quick-buy{display:none!important}form.product-form .s-add-product-button-main{display:block!important;width:100%!important}form.product-form .s-add-product-button-main>salla-button{display:block!important;width:100%!important}form.product-form .s-add-product-button-main>salla-button>button{display:flex!important;width:100%!important;min-height:52px;align-items:center;justify-content:center;background:#bba36b!important;color:#fff!important;border:1px solid #bba36b!important}.sx-pickup-hint{direction:rtl;padding:14px;margin-top:12px;background:#f8f5ee;border:1px solid #d7c695;border-radius:10px;line-height:1.9;font-size:14px;color:#3a3325}';document.head.appendChild(s);var form=document.querySelector('form.product-form');if(form&&!document.getElementById('sx-pickup-hint')){var p=document.createElement('p');p.id='sx-pickup-hint';p.className='sx-pickup-hint';p.textContent='أضف الشنط أو البراميل أو الكراتين والكمية إلى السلة، ثم اطلب الاستلام من البيت وأضف عنوانك ورابط الموقع من السلة.';form.appendChild(p);}document.addEventListener('click',function(e){var b=e.target.closest('button');if(b&&b.textContent.trim()==='إتمام الطلب'&&!b.closest('form.product-form')){e.preventDefault();e.stopImmediatePropagation();location.href='/cart';}},true);} }if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init,{once:true});else init();})(); /* SUDAMEX: keep native mobile checkout above bottom navigation */ (function(){function showMobileCheckout(){ if(location.pathname.split('/').filter(Boolean).pop()!=='cart'||document.getElementById('sudamex-mobile-checkout-style'))return; var style=document.createElement('style');style.id='sudamex-mobile-checkout-style'; style.textContent='@media(max-width:1023px){body{padding-bottom:calc(96px + env(safe-area-inset-bottom))!important}salla-cart-summary-card.s-cart-summary-card{position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;top:auto!important;z-index:auto!important;width:100%!important;max-width:100%!important;margin:0!important;display:block!important;visibility:visible!important;opacity:1!important;background:#fff!important;box-shadow:0 -3px 16px #0002!important}.s-cart-summary-card-action{display:block!important;visibility:visible!important;padding:8px 14px!important}#s-cart-summary-card-submit{display:block!important;width:100%!important;visibility:visible!important;opacity:1!important}#s-cart-summary-card-submit button{display:flex!important;width:100%!important;min-height:52px!important;align-items:center!important;justify-content:center!important;background:#bba36b!important;color:#fff!important;font-weight:700!important;font-size:16px!important;border-radius:10px!important}}'; document.head.appendChild(style); function placeSummary(){var card=document.querySelector('salla-cart-summary-card.s-cart-summary-card'),main=document.querySelector('main');if(card&&main&&card.classList.contains('hydrated')){if(!main.contains(card))main.appendChild(card);return true;}return false;}if(!placeSummary()){var watcher=new MutationObserver(function(){if(placeSummary())watcher.disconnect();});watcher.observe(document.body,{childList:true,subtree:true,attributes:true,attributeFilter:['class']});} }if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',showMobileCheckout,{once:true});else showMobileCheckout();})(); /* SUDAMEX pickup map v1 */ (function(){ if(!/\/cart\/?$/.test(location.pathname))return; var loading; function library(){ if(window.L)return Promise.resolve(window.L); if(loading)return loading; loading=new Promise(function(resolve,reject){ var css=document.createElement('link');css.rel='stylesheet';css.href='https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';document.head.appendChild(css); var script=document.createElement('script');script.src='https://unpkg.com/leaflet@1.9.4/dist/leaflet.js';script.onload=function(){resolve(window.L);};script.onerror=function(){loading=null;reject(new Error('map'));};document.head.appendChild(script); });return loading; } function mount(){ var field=document.getElementById('option-19981566');if(!field||document.getElementById('sx-pickup-map-controls'))return; var controls=document.createElement('div');controls.id='sx-pickup-map-controls';controls.dir='rtl';controls.style.cssText='margin:12px 0;display:flex;flex-wrap:wrap;gap:10px;align-items:center'; var open=document.createElement('button');open.type='button';open.textContent='تحديد موقع الاستلام على الخريطة';open.style.cssText='background:#111;color:#e8cd96;border:1px solid #bba36b;border-radius:8px;padding:13px 18px;font:700 15px Tahoma,Arial;cursor:pointer'; var status=document.createElement('span');status.setAttribute('role','status');status.style.cssText='display:block;font-size:13px;color:#54472e';controls.append(open,status);field.before(controls); field.placeholder='حدّد الموقع على الخريطة أو الصق رابط خرائط Google هنا'; open.onclick=function(){ if(document.getElementById('sx-pickup-map-dialog'))return; var dialog=document.createElement('dialog');dialog.id='sx-pickup-map-dialog';dialog.dir='rtl';dialog.setAttribute('aria-label','تحديد موقع استلام الشحنة');dialog.style.cssText='position:fixed;inset:0;margin:auto;width:min(94vw,680px);max-height:92dvh;overflow:auto;padding:18px;border:1px solid #bba36b;border-radius:14px;background:white;color:#171717;z-index:2147483000;font:14px Tahoma,Arial'; dialog.innerHTML='

موقع استلام الشحنة من المنزل

حرّك الخريطة وكبّرها، ثم اضغط على مكان الاستلام وضع العلامة.

جارٍ تحميل الخريطة…

'; document.body.appendChild(dialog);dialog.showModal(); var map,marker,chosen=null,oldFocus=document.activeElement; var message=dialog.querySelector('[data-message]'),confirm=dialog.querySelector('[data-confirm]'),gps=dialog.querySelector('[data-gps]'); dialog.addEventListener('close',function(){if(map)map.remove();dialog.remove();open.focus();},{once:true});dialog.querySelector('[data-cancel]').onclick=function(){dialog.close();}; function choose(lat,lng){chosen=[lat,lng];if(marker)marker.setLatLng(chosen);else marker=window.L.marker(chosen,{draggable:true}).addTo(map).on('dragend',function(){var p=marker.getLatLng();choose(p.lat,p.lng);});confirm.disabled=false;message.textContent='تم تحديد النقطة. اضغط اعتماد موقع الاستلام لحفظها في الطلب.';} confirm.onclick=function(){if(!chosen)return;var value='https://www.google.com/maps?q='+chosen[0].toFixed(6)+','+chosen[1].toFixed(6);var current=document.getElementById('option-19981566');if(!current){message.textContent='تغيّرت السلة. أغلق الخريطة وأعد المحاولة.';return;}var setter=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,'value').set;setter.call(current,value);current.dispatchEvent(new Event('input',{bubbles:true}));current.dispatchEvent(new Event('change',{bubbles:true}));status.textContent='تمت إضافة رابط موقع الاستلام إلى الطلب.';dialog.close();}; gps.onclick=function(){if(!map)return;if(!navigator.geolocation){message.textContent='تحديد الموقع غير متاح. اختر المكان يدويًا على الخريطة.';return;}gps.disabled=true;message.textContent='جارٍ تحديد موقعك…';navigator.geolocation.getCurrentPosition(function(p){gps.disabled=false;if(!dialog.isConnected)return;choose(p.coords.latitude,p.coords.longitude);map.setView(chosen,17);},function(){gps.disabled=false;if(dialog.isConnected)message.textContent='تعذّر الوصول إلى الموقع. اسمح للموقع من إعدادات المتصفح أو اختر النقطة يدويًا.';},{enableHighAccuracy:true,timeout:15000,maximumAge:0});}; library().then(function(L){if(!dialog.isConnected)return;map=L.map(dialog.querySelector('[data-map]')).setView([24.7136,46.6753],11);var tiles=L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png',{maxZoom:19,attribution:'© OpenStreetMap'}).addTo(map);var loaded=false;tiles.once('tileload',function(){loaded=true;});tiles.on('tileerror',function(){if(!loaded)message.textContent='تعذّر تحميل بعض أجزاء الخريطة. يمكنك المحاولة لاحقًا أو لصق رابط الموقع في الحقل.';});map.on('click',function(e){choose(e.latlng.lat,e.latlng.lng);});var match=field.value.match(/[?&]q=(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)/);if(match){choose(Number(match[1]),Number(match[2]));map.setView(chosen,16);}else message.textContent='اضغط على موقع الاستلام لتحديده، أو استخدم موقعك الحالي.';map.invalidateSize();}).catch(function(){if(dialog.isConnected){message.textContent='تعذّر تحميل الخريطة. أغلق النافذة والصق رابط خرائط Google في الحقل، أو أعد المحاولة.';gps.disabled=true;}}); }; } function start(){mount();var scheduled=false;new MutationObserver(function(){if(scheduled)return;scheduled=true;requestAnimationFrame(function(){scheduled=false;mount();});}).observe(document.body,{childList:true,subtree:true});} if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start(); })(); /* SUDAMEX pickup payment v1 */ (function(){ if(!/\/cart\/?$/.test(location.pathname))return; function mount(){ var hasShipping=Array.from(document.querySelectorAll('main a[href]')).some(function(a){return /\/p(?:1185733739|452632169|944555282)$/.test(a.pathname);}); var native=document.getElementById('s-cart-summary-card-submit'),existing=document.getElementById('sx-pickup-payment'); if(!hasShipping){if(existing)existing.remove();return;}if(!native||existing)return; var panel=document.createElement('section');panel.id='sx-pickup-payment';panel.dir='rtl';panel.setAttribute('aria-label','الدفع بعد استلام المندوب');panel.style.cssText='margin:14px 0;padding:16px;border:1px solid #bba36b;border-radius:10px;background:#faf7ef;color:#24201a;font:14px Tahoma,Arial;line-height:1.9'; var text=document.createElement('p');text.textContent='سجّل طلب استلام شحنتك الآن، واختر «الدفع عند الاستلام» في خطوة الدفع. يتم السداد بعد أن يؤكد فريق SUDAMEX استلام المندوب للشحنة.';text.style.cssText='margin:0 0 12px'; var button=document.createElement('button');button.type='button';button.textContent='الدفع بعد استلام المندوب';button.style.cssText='display:block;width:100%;padding:14px;background:#111;color:#e8cd96;border:1px solid #bba36b;border-radius:8px;font:700 15px Tahoma,Arial;cursor:pointer'; button.onclick=function(){var host=document.getElementById('s-cart-summary-card-submit');var target=host&&(host.querySelector('button')||host);if(target)target.click();};panel.append(text,button);native.before(panel); } function start(){mount();var pending=false;new MutationObserver(function(){if(pending)return;pending=true;requestAnimationFrame(function(){pending=false;mount();});}).observe(document.body,{childList:true,subtree:true});} if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start(); })(); /* SUDAMEX checkout below location v1 */ (function(){ if(!/\/cart\/?$/.test(location.pathname))return; var media=window.matchMedia('(max-width:1023px)'),anchor=null; function place(){ var field=document.getElementById('option-19981566'),button=document.getElementById('s-cart-summary-card-submit'),holder=document.getElementById('sx-mobile-checkout-after-location'); if(!button)return; if(media.matches&&field){ if(!holder){holder=document.createElement('div');holder.id='sx-mobile-checkout-after-location';holder.style.cssText='margin:16px 0 8px;width:100%;clear:both';field.after(holder);} if(!holder.contains(button)){if(!anchor||!anchor.isConnected){anchor=document.createElement('span');anchor.hidden=true;anchor.id='sx-checkout-original-position';button.before(anchor);}holder.appendChild(button);} }else if(holder){if(anchor&&anchor.isConnected)anchor.after(button);else{var action=document.querySelector('.s-cart-summary-card-action');if(action)action.appendChild(button);}if(!holder.contains(button))holder.remove();} } function start(){var style=document.createElement('style');style.textContent='@media(max-width:1023px){#sx-mobile-checkout-after-location #s-cart-summary-card-submit{display:block!important;width:100%!important;position:static!important;margin:0!important}#sx-mobile-checkout-after-location button{display:flex!important;width:100%!important;min-height:54px!important;align-items:center!important;justify-content:center!important;background:#bba36b!important;color:#fff!important;font-size:16px!important;font-weight:700!important;border-radius:10px!important}}';document.head.appendChild(style);place();media.addEventListener('change',place);var pending=false;new MutationObserver(function(){if(pending)return;pending=true;requestAnimationFrame(function(){pending=false;place();});}).observe(document.body,{childList:true,subtree:true});} if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start(); })();