/* 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+='
افتح نوع الشحنة، اختر مدينة الوصول والكمية، ثم أضفها إلى سلة طلبك.
حرّك الخريطة وكبّرها، ثم اضغط على مكان الاستلام وضع العلامة.
جارٍ تحميل الخريطة…
'; 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(); })();