PageSourceSearch

https://stila.co.uk/cdn/shop/t/33/assets/component-cart.js?v=124722777586897427061723099981

js stila.co.uk collected 2026-09-25 18:46:29 UTC 4,371 bytes, 2 lines download raw bytes

1if(typeof CartForm!="function"){class CartForm2 extends HTMLElement{constructor(){super(),this.ajaxifyCartItems()}ajaxifyCartItems(){this.form=this.querySelector("form"),this.querySelectorAll("[data-js-cart-item]").forEach(item=>{const remove=item.querySelector(".remove");remove&&(remove.dataset.href=remove.getAttribute("href"),remove.setAttribute("href",""),remove.addEventListener("click",e=>{e.preventDefault(),this.updateCartQty(item,0)}));const qty=item.querySelector(".qty");qty&&(qty.addEventListener("input",debounce(e=>{e.preventDefault(),e.target.blur(),this.updateCartQty(item,parseInt(qty.value))},500)),qty.addEventListener("click",e=>{e.target.select()}))})}updateCartQty(item,newQty){let alert=null;this.form.classList.add("processing"),this.querySelector(".alert")&&this.querySelector(".alert").remove();const body=JSON.stringify({line:parseInt(item.dataset.line),quantity:newQty});fetch(KROWN.settings.routes.cart_change_url,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/javascript"},body}).then(response=>response.json()).then(response=>(response.status==422&&(alert=document.createElement("span"),alert.classList.add("alert","alert--error"),typeof response.description=="string"?alert.innerHTML=response.description:alert.innerHTML=response.message),fetch("?section_id=helper-cart"))).then(response=>response.text()).then(text=>{const sectionInnerHTML=new DOMParser().parseFromString(text,"text/html"),cartFormInnerHTML=sectionInnerHTML.getElementById("AjaxCartForm").innerHTML,cartSubtotalInnerHTML=sectionInnerHTML.getElementById("AjaxCartSubtotal").innerHTML,cartItems=document.getElementById("AjaxCartForm");cartItems.innerHTML=cartFormInnerHTML,cartItems.ajaxifyCartItems(),document.querySelectorAll("[data-header-cart-count]").forEach(elm=>{elm.textContent=cartItems.querySelector("[data-cart-count]").textContent}),document.querySelectorAll("[data-header-cart-total").forEach(elm=>{elm.textContent=cartItems.querySelector("[data-cart-total]").textContent}),alert!==null&&this.form.prepend(alert),document.getElementById("AjaxCartSubtotal").innerHTML=cartSubtotalInnerHTML;const event=new Event("cart-updated");this.dispatchEvent(event)}).catch(e=>{console.log(e);let alert2=document.createElement("span");alert2.classList.add("alert","alert--error"),alert2.textContent=KROWN.settings.locales.cart_general_error,this.form.prepend(alert2)}).finally(()=>{this.form.classList.remove("processing")})}}typeof customElements.get("cart-form")>"u"&&customElements.define("cart-form",CartForm2)}if(typeof CartProductQuantity!="function"){class CartProductQuantity2 extends HTMLElement{constructor(){super(),this.querySelector(".qty-minus").addEventListener("click",this.changeCartInput.bind(this)),this.querySelector(".qty-plus").addEventListener("click",this.changeCartInput.bind(this))}changeCartInput(){setTimeout(()=>{document.getElementById("AjaxCartForm").updateCartQty(this.closest("[data-js-cart-item]"),parseInt(this.querySelector(".qty").value))},50)}}typeof customElements.get("cart-product-quantity")>"u"&&customElements.define("cart-product-quantity",CartProductQuantity2)}window.refreshCart||(window.refreshCart=()=>{fetch("?section_id=helper-cart").then(response=>response.text()).then(text=>{const sectionInnerHTML=new DOMParser().parseFromString(text,"text/html"),cartFormInnerHTML=sectionInnerHTML.getElementById("AjaxCartForm").innerHTML,cartSubtotalInnerHTML=sectionInnerHTML.getElementById("AjaxCartSubtotal").innerHTML,cartItems=document.getElementById("AjaxCartForm");cartItems.innerHTML=cartFormInnerHTML,cartItems.ajaxifyCartItems(),document.querySelectorAll("[data-header-cart-count]").forEach(elm=>{elm.textContent=cartItems.querySelector("[data-cart-count]").textContent}),document.querySelectorAll("[data-header-cart-total").forEach(elm=>{elm.textContent=cartItems.querySelector("[data-cart-total]").textContent}),document.getElementById("AjaxCartSubtotal").innerHTML=cartSubtotalInnerHTML,document.querySelector("[data-js-site-cart-sidebar]")&&document.querySelector("[data-js-site-cart-sidebar]").show(),document.querySelector("cart-recommendations")&&(
1document.querySelector("cart-recommendations").innerHTML="",document.querySelector("cart-recommendations").generateRecommendations())})});
2//# sourceMappingURL=/cdn/shop/t/33/assets/component-cart.js.map?v=124722777586897427061723099981

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.