PageSourceSearch

https://www.jrdecal.co.uk/cdn/shop/t/24/assets/quick-order-list.js?v=145160198372566173901787562902

js jrdecal.co.uk collected 2026-10-09 23:06:45 UTC 4,815 bytes, 2 lines download raw bytes

1if(!customElements.get("quick-order-list")){class QuickOrderList extends HTMLElement{constructor(){super(),this.init()}init(){this.fetchRequestOpts={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}},this.cartDrawer=document.getElementById("cart-drawer"),this.itemStatus=document.getElementById("qol-line-item-status"),this.currentItemCount=Array.from(this.querySelectorAll('[name="updates[]"]')).reduce((total,quantityInput)=>total+parseInt(quantityInput.value,10),0),this.addEventListener("click",this.handleClick.bind(this)),this.addEventListener("change",debounce(this.handleChange.bind(this)))}handleClick(evt){evt.target.matches(".js-remove-item")&&(evt.preventDefault(),this.updateQuantity(evt.target.dataset.index,0,evt.target.dataset.variantId,evt.target))}handleChange(evt){evt.target.dataset.index?this.updateQuantity(evt.target.dataset.index,evt.target.value,evt.target.dataset.variantId,evt.target):this.addToCart(evt.target.dataset.variantId,evt.target.value)}async addToCart(variantId,quantity){const requestData={items:[{id:variantId,quantity}],sections_url:window.location.pathname,sections:this.getSectionsToRender().map(section=>section.section)};let data;try{this.querySelectorAll(".alert").forEach(alert=>alert.remove()),this.classList.add("pointer-events-none");const response=await fetch(`${theme.routes.cartAdd}.js`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(requestData)});if(data=await response.json(),!response.ok)throw new Error(response);this.cartDrawer&&this.cartDrawer.refreshCartDrawer(),this.getSectionsToRender().forEach(section=>{const sectionEl=document.getElementById(section.id);if(!sectionEl)return;const el=sectionEl.querySelector(section.selector)||sectionEl;el.innerHTML=QuickOrderList.getElementHTML(data.sections[section.section],section.selector)}),this.dispatchEvent(new CustomEvent("on:quick-order-list:update",{bubbles:!0,detail:{productId:this.dataset.productId}}))}catch(error){console.error(error);const item=this.querySelector(`[data-variant-id="${variantId}"] .cart-item__details`),msg=document.createElement("div");msg.classList.add("alert","mt-6","bg-error-bg","text-error-text"),msg.textContent=data.description?data.description:error,item.appendChild(msg)}finally{this.classList.remove("pointer-events-none")}}async updateQuantity(line,quantity,variantId,quantityElem){this.enableLoading();const sectionsToRender=this.getSectionsToRender();if(this.cartDrawer){const cartDrawerId=this.cartDrawer.closest(".shopify-section").id.replace("shopify-section-","");sectionsToRender.push({id:"cart-drawer",section:cartDrawerId,selector:"#cart-drawer"})}this.fetchRequestOpts.body=JSON.stringify({line,quantity,sections:sectionsToRender.map(section=>section.section),sections_url:window.location.pathname});let data;try{this.querySelectorAll(".alert").forEach(alert=>alert.remove());const response=await fetch(`${theme.routes.cartChange}`,this.fetchRequestOpts);if(data=await response.json(),!response.ok)throw new Error(response);sectionsToRender.forEach(section=>{const sectionEl=document.getElementById(section.id);if(!sectionEl)return;const el=sectionEl.querySelector(section.selector)||sectionEl;el.innerHTML=QuickOrderList.getElementHTML(data.sections[section.section],section.selector)}),this.dispatchEvent(new CustomEvent("on:quick-order-list:update",{bubbles:!0,detail:{productId:this.dataset.productId}})),this.closest("quick-add-drawer")||this.disableLoading()}catch(error){console.log(error);const item=this.querySelector(`[data-variant-id="${variantId}"] .cart-item__qty`),msg=document.createElement("div");msg.classList.add("alert","mt-6","bg-error-bg","text-error-text"),msg.textContent=data.errors?data.errors:error,item.appendChild(msg),quantityElem.value=quantityElem.dataset.initialValue,quantityElem.closest("quantity-input").currentQty=quantityElem.dataset.initialValue,this.disableLoading()}}getSectionsToRender(){return[{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:`quick-order-list_${this.dataset.section}`,section:this.dataset.section,selector:`#quick-order-list_${this.dataset.section}`},{id:"free-shipping-notice",section:"cart-drawer",selector:".free-shipping-notice"}]}static getElementHTML(html,selector){const tmpl=document.createElement("template");tmpl.innerHTML=html;const el=tmpl.content.querySelector(selector);return el?el.innerHTML:""}enableLoading(){this.classList.add("pointer-events-none"),document.activeElement.blur(),this.itemStatus.setAttribute("aria-hidden","false")}disableLoading(){this.classList.remove("pointer-events-none")}}customElements.define("quick-order-list",QuickOrderList)}
2//# sourceMappingURL=/cdn/shop/t/24/assets/quick-order-list.js.map?v=145160198372566173901787562902

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.