PageSourceSearch

https://www.saltxo.com/cdn/shop/t/53/assets/pdp-recommendations.js?v=91995750155210328021788555073

js saltxo.com collected 2026-10-08 05:14:12 UTC 2,733 bytes, 2 lines download raw bytes

1class SaltbaeRecs extends HTMLElement{connectedCallback(){if(this.productId=this.dataset.productId,this.maxProducts=this.dataset.maxProducts||3,this.intent=this.dataset.intent||"related",this.sectionName=this.dataset.sectionName||"pdp-recommendations",this.container=this.querySelector("[data-products-container]"),!this.productId||!this.container){this.remove();return}this.bindQuickAdd(),this.load()}bindQuickAdd(){this.addEventListener("click",e=>{const btn=e.target.closest("[data-quick-add]");if(!btn||!this.contains(btn))return;const variantId=btn.dataset.variantId,t=window.theme,isDrawerCart=t&&t.settings&&t.settings.cart_type==="drawer";!variantId||!isDrawerCart||!t.cart||!t.cart.addItems||(e.preventDefault(),this.quickAdd(btn,variantId))})}async quickAdd(btn,variantId){if(btn.getAttribute("aria-busy")==="true")return;btn.setAttribute("aria-busy","true");const opts={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id:variantId,quantity:"1"}).toString()};try{await window.theme.cart.addItems(opts,variantId);const drawer=window.theme.drawer;drawer&&drawer.open&&drawer.open("right","cart-drawer",btn),this.clearBusyWhenCartOpens(btn)}catch(err){console.error("PDP recommendations quick-add failed:",err),btn.setAttribute("aria-busy","false"),btn.href&&(window.location.href=btn.href)}}clearBusyWhenCartOpens(btn){const done=()=>btn.setAttribute("aria-busy","false"),deadline=Date.now()+2500,poll=()=>{const ocu=document.querySelector(".ocu-cart-drawer.ocu-visible"),native=document.querySelector("drawer-root"),nativeOpen=native&&getComputedStyle(native).display!=="none";if(ocu&&getComputedStyle(ocu).visibility!=="hidden"||nativeOpen||Date.now()>=deadline)return done();setTimeout(poll,100)};poll()}async load(){const url=`${window.theme&&window.theme.urls&&window.theme.urls.product_recommendations?window.theme.urls.product_recommendations:"/recommendations/products"}?section_id=${this.sectionName}&product_id=${this.productId}&intent=${this.intent}&limit=${this.maxProducts}`;try{const res=await fetch(url);if(!res.ok){this.remove();return}const html=await res.text(),newItems=new DOMParser().parseFromString(html,"text/html").querySelectorAll("[data-product-item]");if(!newItems.length){this.remove();return}const frag=document.createDocumentFragment();newItems.forEach(item=>frag.appendChild(item)),this.container.innerHTML="",this.container.appendChild(frag),this.style.display="block"}catch(e){console.error("PDP recommendations failed:",e),this.remove()}}}customElements.get("saltbae-recs-root")||customElements.define("saltbae-recs-root",SaltbaeRecs);
2//# sourceMappingURL=/cdn/shop/t/53/assets/pdp-recommendations.js.map?v=91995750155210328021788555073

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.