PageSourceSearch

https://www.thestacksystem.com/cdn/shop/t/60/assets/product-form.js?v=14853092025818778711778037100

js thestacksystem.com collected 2026-10-01 14:34:42 UTC 3,872 bytes, 2 lines download raw bytes

1if(!customElements.get("product-form")){class ProductForm extends HTMLElement{constructor(){super(),this.hasChildNodes()&&this.init()}init(){this.form=this.querySelector(".js-product-form"),this.cartDrawer=document.querySelector("cart-drawer"),this.submitBtn=this.querySelector('[name="add"]'),theme.settings.afterAtc!=="no-js"&&this.form.addEventListener("submit",this.handleSubmit.bind(this))}async handleSubmit(evt){if(window.location.pathname===theme.routes.cart||(evt.preventDefault(),this.submitBtn=this.querySelector('[name="add"]'),this.submitBtn.getAttribute("aria-disabled")==="true"))return;this.errorMsg=null,this.setErrorMsgState(),this.submitBtn.setAttribute("aria-disabled","true"),this.submitBtn.classList.add("is-loading"),this.submitBtn.setAttribute("disabled","disabled");const formData=new FormData(this.form),sections=this.cartDrawer?`${this.cartDrawer.dataset.section},cart-icon-bubble`:"cart-icon-bubble";formData.append("sections_url",window.location.pathname),formData.append("sections",sections);const fetchRequestOpts={method:"POST",headers:{Accept:"application/javascript","X-Requested-With":"XMLHttpRequest"},body:formData};try{const oldCartResponse=await fetch(`${theme.routes.cart}.js`);if(!oldCartResponse.ok)throw new Error(oldCartResponse.status);const oldCartData=await oldCartResponse.json(),response=await fetch(theme.routes.cartAdd,fetchRequestOpts),data=await response.json(),error=typeof data.description=="string"?data.description:data.message;if(data.status&&this.setErrorMsgState(error),!response.ok)throw new Error(response.status);if(theme.settings.afterAtc==="page")setTimeout(()=>{window.location.href=theme.routes.cart},300);else{ProductForm.updateCartIcon(data);const quickAddDrawer=this.closest("quick-add-drawer");quickAddDrawer&&quickAddDrawer.addedToCart(),setTimeout(()=>{if(this.cartDrawer)this.cartDrawer.renderContents(data,!quickAddDrawer&&theme.settings.afterAtc==="drawer");else if(window.location.pathname===theme.routes.cart){const cartItems=document.querySelector("cart-items");cartItems&&(cartItems.dataset.empty==="true"?window.location.reload():cartItems.refresh())}},700)}const newCartResponse=await fetch(`${theme.routes.cart}.js`);if(!newCartResponse.ok)throw new Error(newCartResponse.status);const newCartData=await newCartResponse.json(),itemInOldCart=oldCartData.items.filter(item=>item.variant_id===data.variant_id)[0];itemInOldCart?this.dispatchEvent(new CustomEvent("on:line-item:change",{bubbles:!0,detail:{cart:newCartData,variantId:data.variant_id,oldQuantity:itemInOldCart.quantity,newQuantity:itemInOldCart.quantity===data.quantity?itemInOldCart.quantity:data.quantity}})):this.dispatchEvent(new CustomEvent("on:cart:add",{bubbles:!0,detail:{cart:newCartData,variantId:data.variant_id}})),this.submitBtn.classList.add("is-success"),this.submitBtn.removeAttribute("aria-disabled"),setTimeout(()=>{this.submitBtn.classList.remove("is-loading"),this.submitBtn.classList.remove("is-success"),this.submitBtn.removeAttribute("disabled")},2e3)}catch(error){console.log(error),this.dispatchEvent(new CustomEvent("on:cart:error",{bubbles:!0,detail:{error:this.errorMsg.textContent}})),this.submitBtn.classList.remove("is-loading"),this.submitBtn.classList.remove("is-success"),this.submitBtn.removeAttribute("disabled"),this.submitBtn.removeAttribute("aria-disabled"),this.cartDrawer&&this.cartDrawer.refresh(!0)}}static updateCartIcon(response){const cartIconBubble=document.getElementById("cart-icon-bubble");cartIconBubble.innerHTML=response.sections["cart-icon-bubble"]}setErrorMsgState(error=!1){this.errorMsg=this.errorMsg||this.querySelector(".js-form-error"),this.errorMsg&&(this.errorMsg.hidden=!error,error&&(this.errorMsg.textContent=error))}}customElements.define("product-form",ProductForm)}
2//# sourceMappingURL=/cdn/shop/t/60/assets/product-form.js.map?v=14853092025818778711778037100

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.