PageSourceSearch

https://www.360cookware.com/cdn/shop/t/154/assets/cart.js?v=9162627468598702361784225148

js 360cookware.com collected 2026-09-25 20:09:33 UTC 8,865 bytes, 2 lines download raw bytes

1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",e2=>{e2.preventDefault(),(this.closest("cart-items")||this.closest("cart-drawer-items")).updateQuantity(this.dataset.index,0)})}}customElements.define("cart-remove-button",CartRemoveButton);class CartItems extends HTMLElement{constructor(){super(),this.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus");const e2=debounce(e3=>{this.onChange(e3)},ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener("change",e2.bind(this))}cartUpdateUnsubscriber=void 0;connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,e2=>{e2.source!=="cart-items"&&Promise.resolve(this.onCartUpdate()).catch(()=>{})})}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}onChange(e2){this.updateQuantity(e2.target.dataset.index,e2.target.value,document.activeElement.getAttribute("name"))}scrollToSaveForLaterSection(){const e2=document.getElementById("save-for-later-page-toolbar");e2&&requestAnimationFrame(()=>{e2.scrollIntoView({behavior:"smooth",block:"start"})})}updateCartTitleCount(e2){const t=document.querySelector(".heading-cart-product .title span");t&&(t.textContent=`(${e2})`)}processCartChangeResponse(e2,n,r2){const a2=document.getElementById(`Quantity-${e2}`)||document.getElementById(`Drawer-quantity-${e2}`),i=document.querySelectorAll(".cart-item");if(n.errors){a2&&(a2.value=a2.getAttribute("value")),this.updateLiveRegions(e2,n.errors);return}this.classList.toggle("is-empty",n.item_count===0),this.updateCartTitleCount(n.item_count);const s=document.querySelector("cart-drawer"),o=document.getElementById("main-cart-footer");o&&o.classList.toggle("is-empty",n.item_count===0),s&&s.classList.toggle("is-empty",n.item_count===0),this.get
1SectionsToRender().forEach(t=>{const el=document.getElementById(t.id);if(!el)return;const sectionHtml=n.sections&&n.sections[t.section];if(!sectionHtml)return;const target=el.querySelector(t.selector)||el;target.innerHTML=this.getSectionInnerHTML(sectionHtml,t.selector)});const c=n.items[e2-1]?n.items[e2-1].quantity:void 0;let d="";i.length===n.items.length&&a2&&c!==parseInt(a2.value)&&(d=c===void 0?window.cartStrings.error:window.cartStrings.quantityError.replace("[quantity]",c)),this.updateLiveRegions(e2,d);const l=document.getElementById(`CartItem-${e2}`)||document.getElementById(`CartDrawer-Item-${e2}`);l&&r2&&l.querySelector(`[name="${r2}"]`)?s?trapFocus(s,l.querySelector(`[name="${r2}"]`)):l.querySelector(`[name="${r2}"]`).focus():n.item_count===0&&s?trapFocus(s.querySelector(".drawer__inner-empty"),s.querySelector("a")):document.querySelector(".cart-item")&&s&&trapFocus(s,document.querySelector(".cart-item__name")),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items"})}saveForLater(e2,snapshot){this.enableLoading(e2);const body={quantity:0,sections:this.getSectionsToRender().map(e3=>e3.section),sections_url:window.location.pathname};snapshot&&snapshot.lineKey?body.id=snapshot.lineKey:body.line=e2;const n=JSON.stringify(body);fetch(`${routes.cart_change_url}`,{...fetchConfig(),body:n}).then(e3=>e3.text()).then(t=>{const n2=JSON.parse(t);if(n2.errors){const a2=document.getElementById(`Quantity-${e2}`)||document.getElementById(`Drawer-quantity-${e2}`);return a2&&(a2.value=a2.getAttribute("value")),void this.updateLiveRegions(e2,n2.errors)}window.SaveForLaterStore&&window.SaveForLaterStore.add(snapshot),this.processCartChangeResponse(e2,n2,null),this.scrollToSaveForLaterSection()}).catch(()=>{this.querySelectorAll(".loading-overlay").forEach(e3=>e3.classList.add("hidden")),(document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors")).textContent=window.cartStrings.error}).finally(()=>{this.disableLoading(e2)})}onCartUpdate(){const mainCart=document.getElementById("main-cart-items"),sectionId=mainCart&&mainCart.getAttribute("data-id")||"cart-items";return fetch(`${routes.cart_url}?section_id=${encodeURIComponent(sectionId)}`).then(e2=>e2.text()).then(html=>{const doc=new DOMParser().parseFromString(html,"text/html");let t=doc.querySelector("cart-items");if(!t){const wrap=doc.querySelector("[id^='shopify-section-']");wrap&&(t=wrap.querySelector("cart-items"))}if(!t)throw new Error("cart-items fragment missing");this.innerHTML=t.innerHTML}).catch(e2=>(console.error(e2),Promise.reject(e2)))}renderCartPage(t){if(t==""||t.length==0)return;const n=JSON.parse(t),i=document.querySelectorAll(".cart-item");if(n.errors)return a.value=a.getAttribute("value"),void this.updateLiveRegions(e,n.errors);this.classList.toggle("is-empty",n.item_count===0);const s=document.querySelector("cart-drawer"),o=document.getElementById("main-cart-footer");o&&o.classList.toggle("is-empty",n.item_count===0),s&&s.classList.toggle("is-empty",n.item_count===0),this.get
1SectionsToRender().forEach(e2=>{(document.getElementById(e2.id).querySelector(e2.selector)||document.getElementById(e2.id)).innerHTML=this.getSectionInnerHTML(n.sections[e2.section],e2.selector)});const c=n.items[e-1]?n.items[e-1].quantity:void 0;let d="";i.length===n.items.length&&c!==parseInt(a.value)&&(d=c===void 0?window.cartStrings.error:window.cartStrings.quantityError.replace("[quantity]",c)),this.updateLiveRegions(e,d);const l=document.getElementById(`CartItem-${e}`)||document.getElementById(`CartDrawer-Item-${e}`);l&&l.querySelector(`[name="${r}"]`)?s?trapFocus(s,l.querySelector(`[name="${r}"]`)):l.querySelector(`[name="${r}"]`).focus():n.item_count===0&&s?trapFocus(s.querySelector(".drawer__inner-empty"),s.querySelector("a")):document.querySelector(".cart-item")&&s&&trapFocus(s,document.querySelector(".cart-item__name")),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items"})}getSectionsToRender(){return[{id:"main-cart-items",section:document.getElementById("main-cart-items").dataset.id,selector:".js-contents"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"cart-live-region-text",section:"cart-live-region-text",selector:".shopify-section"},{id:"main-cart-footer",section:document.getElementById("main-cart-footer").dataset.id,selector:".js-contents-footer"},{id:"main-cart-footer",section:document.getElementById("main-cart-footer").dataset.id,selector:".desktop-cart-progress"},{id:"mobile-progress",section:document.getElementById("mobile-progress").dataset.id,selector:".mobile-progress"}]}updateQuantity(e2,t,r2){this.enableLoading(e2);const n=JSON.stringify({line:e2,quantity:t,sections:this.getSectionsToRender().map(e3=>e3.section),sections_url:window.location.pathname});fetch(`${routes.cart_change_url}`,{...fetchConfig(),body:n}).then(e3=>e3.text()).then(t2=>{const n2=JSON.parse(t2);this.processCartChangeResponse(e2,n2,r2)}).catch(()=>{this.querySelectorAll(".loading-overlay").forEach(e3=>e3.classList.add("hidden")),(document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors")).textContent=window.cartStrings.error}).finally(()=>{this.disableLoading(e2)})}updateLiveRegions(e2,t){const r2=document.getElementById(`Line-item-error-${e2}`)||document.getElementById(`CartDrawer-LineItemError-${e2}`);r2&&(r2.querySelector(".cart-item__error-text").innerHTML=t),this.lineItemStatusElement.setAttribute("aria-hidden",!0);const n=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");n.setAttribute("aria-hidden",!1),setTimeout(()=>{n.setAttribute("aria-hidden",!0)},1e3)}getSectionInnerHTML(e2,t){let temp=new DOMParser().parseFromString(e2,"text/html").querySelector(t);return temp!=null?temp.innerHTML:""}enableLoading(e2){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled"),[...this.querySelectorAll(`#CartItem-${e2} .loading-overlay`),...this.querySelectorAll(`#CartDrawer-Item-${e2} .loading-overlay`)].forEach(e3=>e3.classList.remove("hidden")),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(e2){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled");const t=this.querySelectorAll(`#CartItem-${e2} .loading-overlay`),r2=this.querySelectorAll(`#CartDrawer-Item-${e2} .loading-overlay`);t.forEach(e3=>e3.classList.add("hidden")),r2.forEach(e3=>e3.classList.add("hidden"))}}customElements.define("cart-items",CartItems),customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super(),this.addEventListener("change",debounce(e2=>{const t=JSON.stringify({note:e2.target.value});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body:t})},ON_CHANGE_DEBOUNCE_TIMER))}});
2//# sourceMappingURL=/cdn/shop/t/154/assets/cart.js.map?v=9162627468598702361784225148

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.