PageSourceSearch

https://ledakcijas.lv/cdn/shop/t/85/assets/product-recommendations.js?v=59408943349096485931791284724

js ledakcijas.lv collected 2026-10-06 15:02:38 UTC 4,501 bytes, 2 lines download raw bytes

1if(!window.Maximize.loadedScript.includes("product-recommendations.js")){window.Maximize.loadedScript.push("product-recommendations.js");const _registerProductRecommendations=()=>{Alpine.store("xProductRecommendations",{loading:!1,load(el,sectionId,productId,limit,intent,disableInitSwiffy){this.updateCartDrawerUpsellStatus(),this.loading=!0,limit=limit||10,fetch(`${window.Maximize.routes.productRecommendations}?section_id=${sectionId}&product_id=${productId}&limit=${limit}&intent=${intent}`).then(response=>response.text()).then(text=>{const html=document.createElement("div");html.innerHTML=text;const recommendations=html.querySelector(".product-recommendations");if(recommendations&&recommendations.innerHTML.trim().length){if(recommendations.classList.contains("cart-upsell__product-recommendations")){const maxItemsToShow=parseInt(el.dataset.maxItems),container=el.querySelector(".slider-container"),currentItems=el.querySelectorAll(".cart-upsell__item"),itemsToAdd=Math.max(0,maxItemsToShow-currentItems.length);let listRecommendationsItems=recommendations.querySelectorAll(".cart-upsell__item");if(sectionId=="cart-upsell-recommendations"){const currentItemsProductIds=Array.from(currentItems).map(item=>item.dataset?.productId).filter(id=>id!==void 0);listRecommendationsItems=Array.from(listRecommendationsItems).filter(item=>!currentItemsProductIds.includes(item.dataset?.productId))}if(itemsToAdd>0){listRecommendationsItems.forEach((item,index)=>{if(index<itemsToAdd){const clone=item.cloneNode(!0);container.appendChild(clone)}});const currentSlideIndicator=el.querySelector(".swiffy-slide-indicator"),newSlideIndicator=html.querySelector(".swiffy-slide-indicator");currentSlideIndicator&&newSlideIndicator&&currentSlideIndicator.replaceWith(newSlideIndicator)}requestAnimationFrame(()=>{this.__updateCartUpsell(sectionId)})}else requestAnimationFrame(()=>{el.innerHTML=recommendations.innerHTML});recommendations.classList.contains("recommendation__main-product")&&(el.className+=" mb-[var(--spacing-between-heading-and-content)]")}else this.__updateCartUpsell(sectionId);if(!disableInitSwiffy){let observerEl,hasSlider=!1;const handleCheck=()=>{if(!el||el.innerHTML.trim()==="")return;let slider=el.querySelector(".product-recommendations__slider")||el.querySelector(".complementary__list-products")||el;const datasetString=slider.dataset.swiffyConfig,config=datasetString?JSON.parse(datasetString.replace(/'/g,'"')):{};new IntersectionObserver((entries,observer2)=>{entries.forEach(entry=>{entry.isIntersecting&&(hasSlider||(new SwiffySlider(slider,config),hasSlider=!0),observer2.unobserve(entry.target))})},{threshold:.1}).observe(slider),observerEl&&observerEl.disconnect()};handleCheck(),observerEl=new MutationObserver(handleCheck),observerEl.observe(el,{childList:!0,subtree:!0})}}).finally(()=>{this.loading=!1}).catch(e=>{console.error(e)})},updateCartUpsellWhenCartChanged(sectionId){document.addEventListener(`${CART_EVENT.cartUpdate}`,event=>{const{isItemCountChanged}=event.detail;isItemCountChanged&&fetch(`${window.location.pathname}?section_id=${sectionId}`,{method:"GET"}).then(response=>response.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html"),oldSectionEl=document.querySelector(`.section--${sectionId}`),newSectionEl=html.querySelector(`.section--${sectionId}`);oldSectionEl&&newSectionEl&&(oldSectionEl.innerHTML=newSectionEl.innerHTML)})})},__updateCartUpsell(sectionId){if(window.Maximize.isCartPage){const sectionEle=document.querySelector(`.section--${sectionId}`);if(sectionEle){const mainCartUpsellHeading=sectionEle.querySelector(".main-cart-upsell__heading"),mainCartUpsellContainer=sectionEle.querySelector(".main-cart-upsell__container");sectionEle.querySelectorAll(".cart-upsell__item").length?(mainCartUpsellHeading.classList.remove("hidden"),mainCartUpsellContainer.classList.remove("hidden")):sectionEle.classList.add("hidden")}document.dispatchEvent(new CustomEvent(`${PRODUCT_EVENT.productRecommendationsChange}`))}else this.updateCartDrawerUpsellStatus()},updateCartDrawerUpsellStatus:function(){const isOpen=!!document.querySelectorAll(".cart-drawer-upsell__item").length,upsellEl=document.querySelector("cart-drawer-upsell");upsellEl&&(upsellEl.isOpen=isOpen)}})};window.Alpine?_registerProductRecommendations():document.addEventListener("alpine:init",_registerProductRecommendations)}
2//# sourceMappingURL=/cdn/shop/t/85/assets/product-recommendations.js.map?v=59408943349096485931791284724

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.