PageSourceSearch

https://belugakids.shop/cdn/shop/t/67/assets/custom.js?v=74302444240633691051791536839

js belugakids.shop collected 2026-10-10 01:18:46 UTC 18,573 bytes, 2 lines download raw bytes

1(()=>{if(/\/products\/geschenkpapier\/?$/.test(window.location.pathname)){const root=window.Shopify&&window.Shopify.routes&&window.Shopify.routes.root||"/";window.location.replace(root)}})(),(()=>{const dataEl=document.getElementById("beluga-gift-data");if(!dataEl)return;let GIFT;try{GIFT=JSON.parse(dataEl.textContent)}catch{return}if(!GIFT||!GIFT.variantId)return;const GIFT_VARIANT=Number(GIFT.variantId),KEY_TIME="_gift_time",KEY_CARD="_gift card",KEY_LINK="_added_product_id",locale=(document.documentElement.lang||"de").slice(0,2).toLowerCase(),TEXT={de:{add:"Als Geschenk verpacken",for:"Geschenkverpackung f\xFCr",unlinked:"Bitte entferne diese Zeile und setze beim gew\xFCnschten Artikel das H\xE4kchen \xABAls Geschenk verpacken\xBB."},fr:{add:"Emballer comme cadeau",for:"Emballage cadeau pour",unlinked:"Veuillez supprimer cette ligne et cocher \xAB Emballer comme cadeau \xBB sous l\u2019article souhait\xE9."},en:{add:"Gift wrap this item",for:"Gift wrap for",unlinked:"Please remove this line and tick \xABGift wrap this item\xBB on the item you want wrapped."},it:{add:"Confezione regalo",for:"Confezione regalo per",unlinked:"Rimuovi questa riga e seleziona \xABConfezione regalo\xBB sull\u2019articolo desiderato."}}[locale]||{add:"Als Geschenk verpacken",for:"Geschenkverpackung f\xFCr",unlinked:"Bitte entferne diese Zeile und setze beim gew\xFCnschten Artikel das H\xE4kchen \xABAls Geschenk verpacken\xBB."},ICON='<svg class="beluga-gift__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3.5" y="9" width="17" height="11.5" rx="1" fill="#C0D5DB"/><rect x="2.5" y="6.5" width="19" height="3.5" rx="1" fill="none" stroke="#1E1E1C" stroke-width="1.3"/><path d="M12 6.5v14M3.5 10v10.5h17V10" fill="none" stroke="#1E1E1C" stroke-width="1.3"/><path d="M12 6.5c-1.6-2.9-4.8-3.4-5.3-1.6-.5 1.9 3.1 1.6 5.3 1.6Zm0 0c1.6-2.9 4.8-3.4 5.3-1.6.5 1.9-3.1 1.6-5.3 1.6Z" fill="none" stroke="#1E1E1C" stroke-width="1.3" stroke-linejoin="round"/></svg>';let cartModulePromise=null;const getCart=()=>(cartModulePromise||(cartModulePromise=import("cart-store").then(m=>m.default)),cartModulePromise),buildBox=id=>{const wrap=document.createElement("div");return wrap.className="beluga-gift",wrap.innerHTML='<label class="beluga-gift__label" for="'+id+'"><input class="beluga-gift__input" type="checkbox" id="'+id+'">'+ICON+"<span>"+TEXT.add+'</span></label><span class="beluga-gift__price">+ '+GIFT.price+"</span>",wrap},stripGiftProps=props=>{const clean={};return Object.keys(props||{}).forEach(k=>{k!==KEY_TIME&&k!==KEY_CARD&&(clean[k]=props[k])}),clean},postJSON=(url,body)=>fetch((window.Shopify&&window.Shopify.routes?window.Shopify.routes.root:"/")+url,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(body)}).then(r=>r.json()),addWrapLine=time=>postJSON("cart/add.js",{items:[{id:GIFT_VARIANT,quantity:1,properties:{[KEY_TIME]:String(time),[KEY_LINK]:String(time)}}]});let pendingPdpGift=null;const initProductPage=()=>{GIFT.productGiftOption&&document.querySelectorAll(".product-single form.js-product-form, product-single form.js-product-form").forEach((form,i)=>{if(form.dataset.belugaGift||form.closest(".crosscell_pdp, .croscell_product_ul, product-card, .product-card, quick-shop"))return;const anchor=form.querySelector(".product-form__add");if(!anchor)return;form.dataset.belugaGift="1";const box=buildBox("beluga-gift-pdp-"+i);anchor.parentNode.insertBefore(box,anchor)})};document.addEventListener("submit",event=>{const form=event.target;if(!(form instanceof HTMLFormElement)||!form.dataset.belugaGift)return;form.querySelectorAll("input[data-beluga-gift-prop]").forEach(el=>el.remove());const box=form.querySelector(".beluga-gift__input");if(!box||!box.checked)return;const time=Date.now();[[KEY_TIME,time],[KEY_CARD,GIFT_VARIANT]].forEach(([name,value])=>{const input=document.createElement("input");input.type="hidden",input.name="properties["+name+"]",input.value=String(value),input.dataset.belugaGiftProp="1",form.appendChild(input)}),pendingPdpGift=time},!0),document.addEventListener("on:cart:loaded",async event=>{if(!event.detail||event.detail.type!=="ADD"||!pendingPdpGift)return;const time=pendingPdpGift;pendingPdpGift=null;try{await addWrapLine(time),await(await getCart()).refresh()}catch(e){console.warn("Beluga Geschenkverpackung:",e)}}),document.addEventListener("on:cart:failed",event=>{event.detail&&event.detail.type==="ADD"&&(pendingPdpGift=null)});const tagCache=new Map,hasGiftOption=handle=>handle?(tagCache.has(handle)||tagCache.set(handle,fetch((window.Shopify&&window.Shopify.routes?window.Shopify.routes.root:"/")+"products/"+handle+".js").then(r=>r.ok?r.json():{tags:[]}).then(p=>(p.tags||[]).includes("_gift_option")).catch(()=>!1)),tagCache.get(handle)):Promise.resolve(!1);let busy=!1;const findWrapLine=(items,time)=>items.find(it=>it.variant_id===GIFT_VARIANT&&it.properties&&String(it.properties[KEY_TIME])===String(time)),toggleCartGift=async(item,checked,box)=>{if(!busy){busy=!0,box.setAttribute("aria-busy","true");try{const Cart=await getCart();if(checked){const time=Date.now();await Cart.change({id:item.key,quantity:item.quantity,properties:{...stripGiftProps(item.properties),[KEY_TIME]:String(time),[KEY_CARD]:String(GIFT_VARIANT)}}),await addWrapLine(time)}else{const state=Cart.getState(),items=state.cart&&state.cart.items||[],wrap=findWrapLine(items,item.properties[KEY_TIME]);wrap&&await postJSON("cart/change.js",{id:wrap.key,quantity:0}),await Cart.change({id:item.key,quantity:item.quantity,properties:{...stripGiftProps(item.properties),[KEY_TIME]:"",[KEY_CARD]:""}})}await Cart.refresh()}catch(e){console.warn("Beluga Geschenkverpackung:",e)}finally{busy=!1,box.removeAttribute("aria-busy")}}};let cleaning=!1;const cleanOrphans=async items=>{if(cleaning||busy)return;const orphans=items.filter(it=>it.variant_id!==GIFT_VARIANT||!it.properties||!it.properties[KEY_TIME]?!1:!items.some(p=>p.variant_id!==GIFT_VARIANT&&p.properties&&String(p.properties[KEY_TIME])===String(it.properties[KEY_TIME])));if(orphans.length){cleaning=!0;try{const updates={};orphans.forEach(o=>{updates[o.key]=0}),await postJSON("cart/update.js",{updates}),await(await getCart()).refresh()}catch(e){console.warn("Beluga Geschenkverpackung:",e)}finally{cleaning=!1}}},decorateCart=async()=>{const elements=document.querySelectorAll("cart-item[key]");if(!elements.length)return;const state=(await getCart()).getState(),items=state.cart&&state.cart.items||[];if(!items.length){setTimeout(scheduleDecorate,400);return}for(const el of elements){const key=el.getAttribute("key"),item=items.find(it=>it.key===key);if(!item)continue;if(item.variant_id===GIFT_VARIANT){const time=item.properties&&item.properties[KEY_TIME],owner=time&&items.find(p=>p.variant_id!==GIFT_VARIANT&&p.properties&&String(p.properties[KEY_TIME])===String(time)),details=el.querySelector(".cart-item__details")||el;let note=el.querySelector(".beluga-gift-note");el.classList.add("beluga-gift-line"),note||(note=document.createElement("span"),note.className="beluga-gift-note",(details.querySelector(".cart-item__header")||details).appendChild(note)),owner?(note.classList.remove("beluga-gift-note--warn"),note.textContent=TEXT.for+" "+owner.product_title):(note.classList.add("beluga-gift-note--warn"),note.textContent=TEXT.unlinked);continue}if(item.gift_card||!await hasGiftOption(item.handle))continue;const isChecked=!!(item.properties&&item.properties[KEY_TIME]&&item.properties[KEY_CARD]);let box=el.querySelector(".beluga-gift");box||(box=buildBox("beluga-gift-"+key.replace(/[^a-z0-9]/gi,"")),(el.querySelector(".cart-item__details")||el).appendChild(box));const input=box.querySelector("input");input.checked=isChecked,input.onchange=()=>toggleCartGift(item,input.checked,box)}cleanOrphans(items)};let scheduled=!1;const scheduleDecorate=()=>{scheduled||(scheduled=!0,setTimeout(()=>{scheduled=!1,decorateCart().catch(e=>console.warn("Beluga Geschenkverpackung:",e))},30))},injectStyle=()=>{if(document.getElementById("beluga-gift-line-style"))return;const st=document.createElement("style");st.id="beluga-gift-line-style",st.textContent=".beluga-gift-line cart-item-quantity{display:none!important}.beluga-gift-note--warn{display:block;color:#b3261e;font-size:.85em;margin-top:.35em}",document.head.appendChild(st)},start=()=>{injectStyle(),initProductPage(),scheduleDecorate(),getCart().then(Cart=>{typeof Cart.subscribe=="function"&&Cart.subscribe(scheduleDecorate),scheduleDecorate()}).catch(()=>{}),document.addEventListener("on:cart:loaded",scheduleDecorate),new MutationObserver(mutations=>{for(const m of mutations)for(const n of m.addedNodes)if(n.nodeType===1&&(n.matches("cart-item, form.js-product-form")||n.querySelector("cart-item, form.js-product-form"))){initProductPage(),scheduleDecorate();return}}).observe(document.body,{childList:!0,subtree:!0})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",start):start()})(),document.addEventListener("click",event=>{const link=event.target.closest(".custom_faq_details");if(!link)return;event.preventDefault();const cat=link.getAttribute("data_cate"),root=link.closest("section, .shopify-section")||document;root.querySelectorAll(".custom_faq_item").forEach(li2=>li2.classList.remove("active"));const li=link.closest("li");li&&li.classList.add("active"),root.querySelectorAll(".custom_faq_data[data_cate]").forEach(el=>{el.hidden=el.getAttribute("data_cate")!==cat}),root.querySelectorAll(".custom_faq_artical[data_cate]").forEach(el=>{el.hidden=el.getAttribute("data_cate")!==cat})}),(()=>{const ready=()=>
1document.querySelectorAll(".hotspotImageSlider_cls .home-carousel--image--loading").forEach(el=>el.classList.remove("home-carousel--image--loading"));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ready):ready()})(),(function(){var slot=null;function place(){slot=slot||document.getElementById("bk-pdp-wish-slot");var wrap=document.querySelector(".product-form--single .js-product-buttons");!slot||!wrap||(slot.parentNode!==wrap&&(wrap.appendChild(slot),wrap.classList.add("bk-has-wish")),slot.hidden=!1)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",place):place();var t;new MutationObserver(function(){clearTimeout(t),t=setTimeout(place,100)}).observe(document.documentElement,{childList:!0,subtree:!0})})(),(function(){function tidy(){document.querySelectorAll(".localization-form__country").forEach(function(el){var t=el.textContent.replace(/\s+/g," ").trim(),m=t.match(/^\((\S+) (\S+)\)$/);m&&m[1]===m[2]&&(el.textContent="("+m[1]+")")}),document.querySelectorAll('[id*="klaviyo_reviews"], #klaviyo-product-reviews-wrapper').forEach(function(el){var txt=(el.innerText||"").trim();if(/Noch keine Bewertungen|No reviews yet|Aucun avis/i.test(txt)){var sec=el.closest(".shopify-section")||el;sec.style.display="none"}})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",tidy):tidy();var n=0,iv=setInterval(function(){tidy(),++n>20&&clearInterval(iv)},750)})(),(function(){function add(){var box=document.querySelector(".mobile-draw__account");if(!(!box||box.querySelector(".beluga-drawer-search"))){var src=document.querySelector(".search-draw-trigger-icon a, .header-trigger__link--search"),a=document.createElement("a");a.href="/search",a.className="mobile-footer__text-link beluga-drawer-search",a.setAttribute("aria-label","Suche"),a.setAttribute("aria-haspopup","dialog"),a.setAttribute("data-a11y-dialog-show","modal-search"),a.innerHTML=src?src.innerHTML:"Suche",box.insertBefore(a,box.firstChild)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",add):add()})(),(function(){var SEL=".items-scroll [data-items], .template-index .section--collections-list .grid-layout";function setup(){document.querySelectorAll(SEL).forEach(function(sc){if(sc.__bkp)return;var ov=getComputedStyle(sc).overflowX;if(ov!=="auto"&&ov!=="scroll"||sc.scrollWidth<=sc.clientWidth+4)return;sc.__bkp=!0;var bar=document.createElement("div");bar.className="bk-progress",bar.setAttribute("aria-hidden","true"),bar.innerHTML="<span></span>";var host=sc.closest(".items-scroll")||sc;host.parentNode.insertBefore(bar,host.nextSibling);var s=bar.firstChild;function u(){var r=Math.min(1,sc.clientWidth/sc.scrollWidth),max=sc.scrollWidth-sc.clientWidth,p=max>0?sc.scrollLeft/max:0;bar.style.display=r>=.99?"none":"",s.style.width=r*100+"%",s.style.transform="translateX("+p*(1/r-1)*100+"%)"}sc.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),u()})}function run(){setup(),setTimeout(setup,1200),setTimeout(setup,3500)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",run):run(),window.addEventListener("resize",function(){setTimeout(setup,300)})})(),(function(){function go(){document.querySelectorAll(".about_image_banner_cls .home-carousel--image--loading").forEach(function(el){el.classList.remove("home-carousel--image--loading")})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",go):go()})(),(function(){var cache={};function productUrl(li){var a=li.querySelector('a[href*="/products/"]');return a?a.getAttribute("href").split("?")[0].split("#")[0]:null}function getProduct(url){return cache[url]||(cache[url]=fetch(url+".js",{credentials:"same-origin"}).then(function(r){return r.json()})),cache[url]}function sync(li){var url=productUrl(li);if(!url)return Promise.resolve();var selects=Array.prototype.slice.call(li.querySelectorAll("select"));return selects.length?getProduct(url).then(function(p){var names=(p.options||[]).map(function(o){return(typeof o=="string"?o:o.name||"").trim()}),wanted=[];
1selects.forEach(function(s,i){var m=(s.name||"").match(/options\[(.*)\]/),idx=m?names.indexOf(m[1].trim()):i;idx<0&&(idx=i),wanted[idx]=s.value});var v=p.variants.filter(function(v2){return wanted.every(function(val,i){return val===void 0||v2.options[i]===val})})[0];if(v){li.querySelectorAll('input[name="id"]').forEach(function(inp){inp.value=v.id}),li.setAttribute("product-var-id",v.id);var btn=li.querySelector(".product-card-btn__btn");btn&&(btn.disabled=!v.available)}}):Promise.resolve()}document.addEventListener("change",function(e){var li=e.target.closest&&e.target.closest(".crosscell_pdp li.pdp_detail");li&&e.target.tagName==="SELECT"&&sync(li)},!0),document.addEventListener("focusin",function(e){var li=e.target.closest&&e.target.closest(".crosscell_pdp li.pdp_detail");if(li){var u=productUrl(li);u&&getProduct(u)}},!0);function preload(){document.querySelectorAll(".crosscell_pdp li.pdp_detail").forEach(function(li){var u=productUrl(li);!u||!li.querySelector("select")||getProduct(u).then(function(p){var sels=li.querySelectorAll("select");sels.length===1&&p.options&&p.options.length===1&&Array.prototype.forEach.call(sels[0].options,function(o){var v=p.variants.filter(function(v2){return v2.options[0]===o.value})[0];if(v&&!v.available&&!/ausverkauft|épuisé|sold out/i.test(o.text)){var lang=(document.documentElement.lang||"de").slice(0,2);o.text=o.text+(lang==="fr"?" \u2013 \xE9puis\xE9":lang==="en"?" \u2013 sold out":" \u2013 ausverkauft")}}),sync(li)})})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",preload):preload()})(),(function(){function fix(){document.querySelectorAll('a[href="#swym-wishlist"], a.swym-wishlist').forEach(function(a){a.setAttribute("href","#k-hub/favorites"),a.classList.remove("swym-wishlist"),a.classList.add("bk-fav-link"),a.setAttribute("aria-label","Favoriten"),a.setAttribute("title","Favoriten")})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",fix):fix()})(),(function(){var KEYS=["money_format","money_with_currency_format","money_product_price_format","money_total_price_format"];function patch(){var t=window.theme;t&&KEYS.forEach(function(k){typeof t[k]=="string"&&t[k].indexOf("amount_with_apostrophe_separator")>-1&&(t[k]=t[k].replace(/amount_with_apostrophe_separator/g,"amount"))})}patch(),document.addEventListener("DOMContentLoaded",patch);var RE=/(\d),(?=\d{3}(?:[,.]|\b))/g;function fix(root){for(var w=document.createTreeWalker(root,NodeFilter.SHOW_TEXT),n;n=w.nextNode();)/CHF|EUR|\.\d{2}/.test(n.nodeValue)&&/\d,\d{3}/.test(n.nodeValue)&&(n.nodeValue=n.nodeValue.replace(RE,"$1'"))}new MutationObserver(function(ms){ms.forEach(function(m){m.addedNodes.forEach(function(x){x.nodeType===1&&x.closest&&x.closest(".money, [class*=price], [class*=total], cart-item, cart-items, .cart")?fix(x):x.nodeType===3&&x.parentElement&&x.parentElement.closest(".money, [class*=price], [class*=total]")&&fix(x.parentElement)})})}).observe(document.documentElement,{childList:!0,subtree:!0})})(),(()=>{const KEY="bk-plp-restore",here=()=>window.location.pathname+window.location.search,getRoot=()=>document.querySelector('dynamic-product-search[data-infinite="true"]');document.addEventListener("click",event=>{const link=event.target.closest('a[href*="/products/"]');if(!link)return;const root=getRoot();if(!root||!root.contains(link))return;const results=root.querySelector(".js-results");if(!results)return;const cards=results.querySelectorAll("product-card, .search-grid-item").length,clone=results.cloneNode(!0);clone.querySelectorAll(".klaviyo-favorites-plp-slot").forEach(slot=>{slot.innerHTML="",slot.removeAttribute("data-rendered")});try{sessionStorage.setItem(KEY,JSON.stringify({path:here(),html:clone.innerHTML,cards,scrollY:window.scrollY,time:Date.now()}))}catch{}},!0);const restore=()=>{let saved;try{saved=JSON.parse(sessionStorage.getItem(KEY)||"null")}catch{saved=null}if(!saved||saved.path!==here()||Date.now()-saved.time>18e5)return;const nav=performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(!nav||nav.type!=="back_forward")return;const root=getRoot(),results=root&&root.querySelector(".js-results");if(!results)return;const currentCards=results.querySelectorAll("product-card, .search-grid-item").length;if("scrollRestoration"in history&&(history.scrollRestoration="manual"),saved.cards>currentCards){results.innerHTML=saved.html;const ctrl=root.infiniteController;ctrl&&(typeof ctrl.updateCount=="function"&&ctrl.updateCount(),typeof ctrl.setupLoadMoreButton=="function"&&ctrl.setupLoadMoreButton())}window.scrollTo(0,saved.scrollY),setTimeout(()=>window.scrollTo(0,saved.scrollY),300)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>setTimeout(restore,0)):setTimeout(restore,0)})();
2//# sourceMappingURL=/cdn/shop/t/67/assets/custom.js.map?v=74302444240633691051791536839

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.