/* ELS: kiekio akcijos ženklelis mėlynas – 2026-11-17 */ (function(){try{if(document.getElementById("els-tier"))return;var s=document.createElement("style");s.id="els-tier";s.textContent=".max-tier-price-icon{background:#eff6ff!important;background-image:none!important;color:#0b4f8a!important;border:1px solid #0284c7!important;border-radius:6px!important;box-shadow:none!important}.max-tier-price-icon *{color:#0b4f8a!important}";(document.head||document.documentElement).appendChild(s)}catch(e){console.warn("ELS tier",e)}})(); /* ELS: pavadinimas (variantas H) ir aprašymo išskleidimas – 2026-11-17 */ (function(){function run(){try{var LG=(location.pathname.match(/^\/(en|ru|lv|ee|pl)\//)||[0,"lt"])[1]; var hw=document.querySelector(".product-heading-wrapper"),h1=hw&&hw.querySelector("h1"); if(h1&&!document.getElementById("els-th")){var P=h1.textContent.replace(/\s+/g," ").trim().split(" | ").map(function(x){return x.trim()}).filter(Boolean); if(P.length>2){var code=((document.querySelector("#product_code .item-code")||{}).textContent||"").trim(),brand="",sub=[],chips=[],model=[],ST=/^(DIN|LED|AC|DC|PV|MCB|RCD|RCBO|USB|SMD|IP\d*|NO|NC|UV|RGB|PIR|GSM|LTE|POE|IK\d*|TH|MCCB|SPD)$/i; P.slice(1).forEach(function(x){if(x===code||/^\d{8,14}$/.test(x)||(/[A-Z]/.test(x)&&/\d/.test(x)&&/[-\/]/.test(x)&&!/\s/.test(x)&&x.length>6))return; /* modelis = gamintojas + kodas viename segmente (pvz. „SCHELINGER A53-SPD-MOV-DC-3P-T1T2“, „VECAS MC4-315“) */var MW=x.split(/\s+/);if(MW.length>1&&((code.length>=4&&x.indexOf(code)>=0)||(MW.some(function(w){return /[A-Z]/.test(w)&&/\d/.test(w)&&/[-\/]/.test(w)&&w.length>6})&&MW.some(function(w){return /^[A-ZĄČĘĖĮŠŲŪŽ][A-Za-ząčęėįšųūž]{2,}$/.test(w)&&!ST.test(w)&&!/^(RE|PRO)$/i.test(w)})))){model.push(x);return} if(!brand&&!/\d/.test(x)&&/^[A-ZĄČĘĖĮŠŲŪŽ]/.test(x)&&!ST.test(x)&&x.length>=3&&x.length<=28){brand=x;return} if(!/\d/.test(x)&&/^[a-ząčęėįšųūžа-я]/.test(x)){sub.push(x);return}chips.push(x)}); h1.textContent="";var t=document.createElement("span");t.id="els-th";t.textContent=P[0];h1.appendChild(t); if(sub.length){var s=document.createElement("span");s.style.cssText="display:block;font-size:.62em;font-weight:400;color:#475569;margin-top:4px";s.textContent=sub.join(" · ");h1.appendChild(s)} if(brand){hw.style.cssText="display:flex;justify-content:space-between;align-items:flex-start;gap:12px";var bd=document.createElement("span");bd.textContent=brand;bd.style.cssText="flex:none;font:700 12px/1.2 Arial,sans-serif;color:#0b4f8a;border:1px solid #0b4f8a;border-radius:4px;padding:4px 8px;margin-top:4px;white-space:nowrap";hw.appendChild(bd)} if(chips.length||model.length){var c=document.createElement("div");c.id="els-chips";c.style.cssText="margin:6px 0 2px;clear:both";chips.forEach(function(x){var k=document.createElement("span");k.textContent=x;k.style.cssText="display:inline-block;border:1px solid #94a3b8;border-radius:4px;padding:2px 8px;margin:4px 6px 0 0;font:13px/1.4 Arial,sans-serif;color:#334155;background:#fff";c.appendChild(k)}); /* ELS: modelis (gamintojas + kodas) – ne parametras: rodomas blankiu tekstu eilutės gale, be rėmelio (2026-11-18) */ if(model.length){var md=document.createElement("small");md.className="els-model";md.textContent=model.join(" · ");md.style.cssText="display:inline-block;margin:4px 0 0 4px;font:12px/1.4 Arial,sans-serif;color:#94a3b8;vertical-align:middle;white-space:nowrap";c.appendChild(md)} hw.parentNode.insertBefore(c,hw.nextSibling)}}} }catch(e){console.warn("ELS pavadinimas",e)} try{var di=document.querySelector(".product-tabs .duk-item"),hd=di&&di.querySelector(".duk-header"),b=hd&&hd.nextElementSibling; if(b&&!document.getElementById("els-dmore")&&b.scrollHeight>900){var T={lt:["Rodyti visą aprašymą ↓","Suskleisti aprašymą ↑"],en:["Show full description ↓","Collapse description ↑"],ru:["Показать всё описание ↓","Свернуть описание ↑"],lv:["Rādīt visu aprakstu ↓","Sakļaut aprakstu ↑"],ee:["Näita kogu kirjeldust ↓","Ahenda kirjeldus ↑"],pl:["Pokaż cały opis ↓","Zwiń opis ↑"]}[LG]; var open=false;b.style.maxHeight="640px";b.style.overflow="hidden";b.style.position="relative";var fd=document.createElement("div");fd.style.cssText="position:absolute;left:0;right:0;bottom:0;height:90px;background:linear-gradient(rgba(255,255,255,0),#fff);pointer-events:none";b.appendChild(fd); var m=document.createElement("a");m.id="els-dmore";m.href="javascript:;";m.textContent=T[0];m.style.cssText="display:block;margin:8px auto 14px;width:max-content;padding:8px 16px;border:2px solid #0284c7;border-radius:6px;color:#0369a1;font:700 14px Arial,sans-serif;text-decoration:none;background:#fff"; m.onclick=function(){open=!open;b.style.maxHeight=open?"none":"640px";fd.style.display=open?"none":"block";m.textContent=T[open?1:0];if(!open)di.scrollIntoView({block:"start"})};b.parentNode.insertBefore(m,b.nextSibling)}}catch(e){console.warn("ELS aprasymas",e)}} if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",run);else run()})(); /* ELS: komplektų kortelės v2 (2 stulpeliai, nuotraukos, bendra kaina) – 2026-11-17 */ (function(){function run(){try{var ks=document.querySelectorAll(".els-kmp:not([data-kx])");if(!ks.length)return; var L=(location.pathname.match(/^\/(en|ru|lv|ee|pl)\//)||[0,"lt"])[1]; var T={lt:["Komplekto kaina:","Į krepšelį visą komplektą","Dedama…","✓ Įdėta {a} iš {b} prekių","Kainos su PVM imamos iš e-parduotuvės realiu laiku. Komplektą krepšelyje galima koreguoti.","vnt."], en:["Set price:","Add the whole set to cart","Adding…","✓ Added {a} of {b} items","Prices incl. VAT are taken live from the e-shop. You can adjust the set in the cart.","pcs"], ru:["Цена комплекта:","Весь комплект в корзину","Добавляем…","✓ Добавлено {a} из {b} товаров","Цены с НДС берутся из магазина в реальном времени. Комплект можно изменить в корзине.","шт."], lv:["Komplekta cena:","Visu komplektu grozā","Pievieno…","✓ Pievienoti {a} no {b} produktiem","Cenas ar PVN tiek ņemtas no e-veikala reāllaikā. Komplektu grozā var mainīt.","gab."], ee:["Komplekti hind:","Kogu komplekt ostukorvi","Lisatakse…","✓ Lisatud {a}/{b} toodet","Hinnad koos KM-ga võetakse e-poest reaalajas. Komplekti saab ostukorvis muuta.","tk"], pl:["Cena zestawu:","Cały zestaw do koszyka","Dodawanie…","✓ Dodano {a} z {b} produktów","Ceny z VAT pobierane są ze sklepu na bieżąco. Zestaw można zmienić w koszyku.","szt."]}[L]; if(!document.getElementById("els-kx-css")){var st=document.createElement("style");st.id="els-kx-css";st.textContent=".els-kmp-n{display:none!important}.els-kmp-w>h3{font:700 22px/1.3 Arial,Helvetica,sans-serif;color:#0f172a;margin:26px 0 12px}.els-kmp-g{grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr))!important;gap:16px!important}.els-kx{border:1px solid #cbd5e1;border-radius:10px;background:#fff;display:flex;flex-direction:column;font-family:Arial,Helvetica,sans-serif;color:#0f172a;overflow:hidden}.els-kx .kx-h{display:flex;gap:14px;align-items:flex-start;padding:14px 14px 10px}.els-kx .kx-ic{flex:none;width:64px;height:56px;border-radius:8px;background:#e0f2fe;display:flex;align-items:center;justify-content:center}.els-kx .kx-t{font-size:18px;font-weight:700;line-height:1.25;margin:2px 0 4px}.els-kx .kx-d{font-size:13px;color:#475569;line-height:1.4}.els-kx .kx-rs{padding:0 14px;flex:1}.els-kx .kx-r{display:flex;gap:12px;align-items:center;padding:8px 0;border-top:1px solid #e2e8f0;text-decoration:none!important;color:inherit}.els-kx .kx-r:hover .kx-n b{color:#0369a1}.els-kx .kx-im{flex:none;width:44px;height:44px;object-fit:contain;background:#fff}.els-kx .kx-n{flex:1;min-width:0;font-size:13px;line-height:1.3}.els-kx .kx-n b{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-weight:700;color:#0f172a}.els-kx .kx-n small{display:block;color:#64748b;font-size:12px;margin-top:2px}.els-kx .kx-p{white-space:nowrap;font-size:14px;font-weight:700;color:#0f172a}.els-kx .kx-tot{display:flex;justify-content:space-between;align-items:center;margin:0 14px;padding:10px 0 4px;border-top:1px solid #e2e8f0;font-size:15px;font-weight:700}.els-kx .kx-tot b{font-size:26px;color:#0284c7}.els-kx .kx-no{margin:0 14px;font-size:11px;color:#94a3b8}.els-kx .kx-b{margin:10px 14px 14px;padding:12px;border:0;border-radius:6px;background:#0284c7;color:#fff;font:700 15px Arial,sans-serif;cursor:pointer}.els-kx .kx-b:hover{background:#0369a1}.els-kx .kx-b.ok{background:#0b4f8a}.els-kx .kx-b:disabled{opacity:.7;cursor:wait}";document.head.appendChild(st)} var IC={pv:'',fu:'',ba:'',bx:''}; function icon(t){var k=/saugikl|fuse|предохр|drošin|kaitsm|bezpiecz/i.test(t)?"fu":/akumul|batter|аккум|aku/i.test(t)?"ba":/styg|string|saul|solar|pv|солн|saule|päike|fotow/i.test(t)?"pv":"bx";return ''+IC[k]+''} function fmt(v){return isNaN(v)?"–":v.toFixed(2).replace(".",L==="en"?".":",")+" €"} var cache={};function info(u){if(!cache[u])cache[u]=fetch(u,{credentials:"same-origin"}).then(function(r){return r.text()}).then(function(h){var hl={en:"en",ru:"ru",lv:"lv",ee:"et",pl:"pl"}[L];var mm=hl&&h.match(new RegExp('hreflang="'+hl+'"[^>]*href="([^"]+)"'));if(mm){return fetch(mm[1],{credentials:"same-origin"}).then(function(r){return r.text()}).then(function(h2){return [h2,mm[1]]})}return [h,u]}).then(function(hu){var h=hu[0];var m=h.match(/"offers":\{[^}]*"price":"?([\d.]+)/),im=h.match(/"image":\s*\[?\s*"([^"]+)"/),hh=h.match(/]*>([\s\S]*?)<\/h1>/),cd=h.match(/class="item-code"[^>]*>\s*([^<\s]+)/); var nm=hh?hh[1].replace(/<[^>]+>/g,"").replace(/&/g,"&").replace(/"/g,'"').replace(/\s+/g," ").trim():"",P=nm.split(" | ").map(function(x){return x.trim()}),code=cd?cd[1]:"",br="",pa=[]; P.slice(1).forEach(function(x){if(!x||x===code||/^\d{8,14}$/.test(x))return;if(/[A-Z]/.test(x)&&/\d/.test(x)&&/[-\/]/.test(x)&&!/\s/.test(x)&&x.length>6)return;if(!br&&!/\d/.test(x)&&/^[A-ZĄČĘĖĮŠŲŪŽ]/.test(x)&&x.length>=3&&x.length<=28&&!/^(DIN|LED|AC|DC|PV|MCB|RCD|IP\d*|MC4)$/i.test(x)){br=x;return}if(/\d/.test(x)||/^[A-Z0-9]{2,6}$/.test(x))pa.push(x)}); return {u:hu[1],p:m?parseFloat(m[1]):NaN,img:im?im[1]:"",n:P[0]||nm,s:[br].concat(pa.slice(0,4)).filter(Boolean).join(" · ")}}).catch(function(){return {p:NaN,img:"",n:"",s:""}});return cache[u]} [].forEach.call(ks,function(k){k.setAttribute("data-kx","1");var items=(k.getAttribute("data-i")||"").split(",").map(function(s){var a=s.trim().split(":");return {id:a[0],q:parseInt(a[1],10)||1,u:a.slice(2).join(":")}}).filter(function(x){return x.id&&x.u});if(!items.length)return; var c=document.createElement("div");c.className="els-kx";c.setAttribute("data-kx","1");var t=k.getAttribute("data-t")||"",d=k.getAttribute("data-d")||""; c.innerHTML='
'+icon(t+" "+d)+'
…
'; c.querySelector(".kx-t").textContent=t;c.querySelector(".kx-d").textContent=d;c.querySelector(".kx-tot span").textContent=T[0];c.querySelector(".kx-no").textContent=T[4];var btn=c.querySelector(".kx-b");btn.textContent=T[1]; var rs=c.querySelector(".kx-rs");items.forEach(function(x){var a=document.createElement("a");a.className="kx-r";a.href=x.u;a.innerHTML='……';rs.appendChild(a);x.el=a}); k.parentNode.replaceChild(c,k); var load=function(){Promise.all(items.map(function(x){return info(x.u).then(function(r){var a=x.el;if(r.u)a.href=r.u;a.querySelector("b").textContent=r.n||x.u;a.querySelector("small").textContent=(x.q>1?x.q+" "+T[5]+" · ":"")+r.s;var im=a.querySelector("img");if(r.img){im.src=r.img;im.alt=r.n}else im.style.visibility="hidden";a.querySelector(".kx-p").textContent=fmt(r.p*x.q);return r.p*x.q})})).then(function(v){var tot=0,ok=true;v.forEach(function(p){if(isNaN(p))ok=false;else tot+=p});c.querySelector(".kx-tot b").textContent=ok?fmt(tot):"–"})}; if("IntersectionObserver" in window){var io=new IntersectionObserver(function(e){if(e[0].isIntersecting){io.disconnect();load()}},{rootMargin:"400px"});io.observe(c)}else load(); btn.onclick=function(){btn.disabled=true;btn.textContent=T[2];var ok=0,i=0;(function next(){if(i>=items.length){try{jQuery.cart.refresh_cart();jQuery.cart.open_cart()}catch(x){}btn.className="kx-b ok";btn.textContent=T[3].replace("{a}",ok).replace("{b}",items.length);btn.disabled=false;return}var x=items[i++];try{jQuery.post(site_url("cart_controller/add_item"),{good_id:x.id,quantity:x.q},function(dd){if(dd&&dd.result!==false)ok++;next()}).fail(function(){next()})}catch(e){next()}})()}}) }catch(e){console.warn("ELS komplektai",e)}} if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",function(){setTimeout(run,0)});else run();setTimeout(run,1500)})();