/* Add custom JS code below */ //mazen /* رام أجمل — إصلاح نافذة «دليل المقاسات» في صفحة المنتج: مكوّن سلة يضع محتوى الجدول خارج النافذة البيضاء، فنُعيده إلى داخلها. */ (function(){ function fix(){ var m=document.getElementById('salla-product-size-guide-modal'); if(!m) return; var b=m.querySelector('.s-modal-body'); if(!b) return; Array.prototype.slice.call(m.children).forEach(function(c){ if(c.tagName==='SALLA-TABS'){ b.appendChild(c); } }); } function start(){ fix(); new MutationObserver(fix).observe(document.body,{childList:true,subtree:true}); } if(document.body) start(); else document.addEventListener('DOMContentLoaded',start); })(); /* رام أجمل — عنوان قسم «تصنيفات مميزة» (rx-cats) */ (function(){ function add(){ document.querySelectorAll('.rx-cats .special-categories__inner').forEach(function(w){ if(w.querySelector('.rx-cats__head')) return; var h=document.createElement('div'); h.className='rx-cats__head'; h.innerHTML='
'+esc(r.content||r.text||'')+'
تفاصيل صغيرة تجعل تجربتكِ أسهل.
'; var LIFT=[6,30,-4,24]; var reduce=window.matchMedia&&matchMedia('(prefers-reduced-motion: reduce)').matches; var NS='http://www.w3.org/2000/svg'; var BG=''; var VEIL=''; function el(t,c){ var e=document.createElement(t); if(c) e.className=c; return e; } function build(s){ if(s.getAttribute('data-rxfj')) return; var grid=s.querySelector('.enhanced-features__grid'); if(!grid) return; s.setAttribute('data-rxfj','1'); s.classList.add('rx-fj'); var old=s.querySelector('.rx-feat__head'); if(old) old.remove(); var bg=el('div','rx-fj__bg'); bg.innerHTML=BG; s.insertBefore(bg,s.firstChild); var inner=el('div','rx-fj__inner'); var th=document.createElementNS(NS,'svg'); th.setAttribute('class','rx-fj__thread'); th.setAttribute('aria-hidden','true'); var ghost=document.createElementNS(NS,'path'); ghost.setAttribute('class','rx-fj__ghost'); var line=document.createElementNS(NS,'path'); var cn=document.createElementNS(NS,'polygon'); cn.setAttribute('class','rx-fj__corner'); var tl=document.createElementNS(NS,'path'); tl.setAttribute('class','rx-fj__tail'); th.appendChild(ghost); th.appendChild(line); th.appendChild(tl); th.appendChild(cn); var TL=0, tv=0; inner.appendChild(th); var cf=2; var main=el('div','rx-fj__main'); var head=el('div','rx-feat__head'); head.innerHTML=HEAD; main.appendChild(head); var list=el('div','rx-fj__list'); main.appendChild(list); var items=[], svgs=[]; grid.querySelectorAll('.s-block--enhanced-features__item').forEach(function(src,i){ var it=el('div','rx-fj__item'), pin=el('div','rx-fj__pin'), node=el('span','rx-fj__node'); pin.style.setProperty('--lift',(LIFT[i%4])+'px'); var ic=src.querySelector('.feature-icon'); if(ic){ pin.appendChild(ic); var img=ic.querySelector('img'), sv=null; if(img){ var u=img.getAttribute('data-src')||img.getAttribute('src')||''; for(var k in SVG){ if(u.indexOf(k)>-1){ var w=el('div'); w.innerHTML=SVG[k]; sv=w.firstChild; sv.setAttribute('role','img'); sv.setAttribute('aria-label',img.getAttribute('alt')||''); img.replaceWith(sv); try{ sv.pauseAnimations(); sv.setCurrentTime(T[k]||0); }catch(e){} break; } } } svgs.push(sv); } else svgs.push(null); pin.appendChild(node); it.appendChild(pin); var h=src.querySelector('h2'), p=src.querySelector('p'); if(h) it.appendChild(h); if(p) it.appendChild(p); list.appendChild(it); items.push({el:it,node:node,sv:svgs[i],on:false,f:0}); }); var vis=el('div','rx-fj__visual'), fr=el('div','rx-fj__frame'), arch=el('div','rx-fj__arch'); var ph=new Image(); ph.alt=''; ph.loading='lazy'; ph.decoding='async'; ph.src=C.photo||''; arch.appendChild(ph); fr.appendChild(arch); var veil=el('div','rx-fj__veil'); veil.innerHTML=VEIL; fr.appendChild(veil); var logo=el('div','rx-fj__logo'); if(C.logoSvg) logo.innerHTML=C.logoSvg; else if(C.logo){ var li=new Image(); li.alt='رام أجمل'; li.src=C.logo; logo.appendChild(li); } vis.appendChild(fr); vis.appendChild(logo); inner.appendChild(main); inner.appendChild(vis); s.appendChild(inner); var L=0, prog=-1, ticking=false; function rel(r,b){ return {x:r.left+r.width/2-b.left, y:r.top+r.height/2-b.top}; } function layout(){ var b=inner.getBoundingClientRect(); var desk=getComputedStyle(list).gridTemplateColumns.split(' ').length>1; var P=items.map(function(o){ return rel(o.node.getBoundingClientRect(),b); }); if(!P.length) return; var lr=logo.getBoundingClientRect(); var lx=lr.left-b.left+lr.width*(C.rx||.946), ly=lr.top-b.top+lr.height*(C.ry||.634); var start=desk?{x:b.width+60,y:P[0].y-36}:{x:P[0].x,y:P[0].y-90}; var pts=[start].concat(P,[{x:lx,y:ly}]); var d='M'+pts[0].x.toFixed(1)+' '+pts[0].y.toFixed(1), td=''; if(!desk){ /* الجوال: خط عمودي عبر العقد، ثم زاوية منحنية، ثم أفقي إلى ماسة الشعار */ P.forEach(function(q){ d+=' L'+q.x.toFixed(1)+' '+q.y.toFixed(1); }); /* زاوية منحنية (نصف قطر 26px) بين الخط العمودي وخط الشعار الأفقي */ var la=P[P.length-1], sg=la.x>lx?1:-1, cx=la.x, cy=ly, rr=Math.max(0,Math.min(26,Math.abs(cx-lx)/2,(cy-la.y)/2)); /* الجزء الأخير (من «شحن سريع» إلى الشعار) مسار مستقل بلون خافت مثل إطار الصورة */ td='M'+cx.toFixed(1)+' '+la.y.toFixed(1)+' L'+cx.toFixed(1)+' '+(cy-rr).toFixed(1)+' Q'+cx.toFixed(1)+' '+cy.toFixed(1)+' '+(cx-sg*rr).toFixed(1)+' '+cy.toFixed(1)+' L'+lx.toFixed(1)+' '+cy.toFixed(1); tv=Math.max(0,cy-la.y); cn.classList.remove('is-show','is-on'); pts=[]; } for(var i=0;i