PageSourceSearch

https://duncanstewart1978.co.uk/cdn/shop/t/28/assets/section-main-cart.js?v=80211154776589628851745926857

js duncanstewart1978.co.uk collected 2026-10-09 18:01:42 UTC 5,269 bytes, 1 lines download raw bytes

1!function(){"use strict";var t,e={6072:function(t,e,r){r.d(e,{Ds:function(){return o},Q2:function(){return n}});const n=function(){return{method:"POST",headers:{"Content-Type":"application/json",Accept:`application/${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"json"}`}}};function o(t,e){const r=this;let n;return function(){for(var o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];clearTimeout(n),n=setTimeout((function(){return t.apply(r,a)}),e)}}document.querySelectorAll(".local-scroll").forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const e=t.target.getAttribute("href");!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=document.getElementById("nav-wrapper"),n=document.querySelector(".header").getAttribute("data-ux-position"),o=t.getBoundingClientRect().top;window.scrollTo({top:"off"!==n?o+window.scrollY-e+parseFloat(r.style.marginTop):o+window.scrollY-e,behavior:"smooth"})}(document.querySelector(e))}))}))}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,n),a.exports}n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t=n(6072),new class{constructor(){this.items=Array.from(document.querySelectorAll(".cart-item")),this.items.forEach((t=>this.manageState(t))),this.selectorsToUpdate=[".cart-summary__header","#cart-total-price","#checkout",".cart-summary__free-shipping"],this.mainCartSelector=".shopify-section.cart",this.miniCart=document.getElementById("mini-cart"),this.itemsContainersSelector=".cart-items-container, .cart__empty, .mini-cart--empty",this.parser=new DOMParser}manageState(t){const e=t.getAttribute("data-variant-id");t.querySelector(".cart-item-delete, .cart-item__remove").addEventListener("click",(async()=>{await this.changeCartItem({id:e,quantity:0}),t.remove()}));const r=t.querySelector('input[name="quantity"]');if(!r)return;const n=t.querySelector('button[name="plus"]'),o=t.querySelector('button[name="minus"]'),a=t.querySelector('input[name="quantity"]');let c=parseInt(r.value);n.addEventListener("click",(()=>{c+=1,r.value=c,this.changeCartItem({id:e,quantity:c})})),o.addEventListener("click",(()=>{c-=1,r.value=c,this.changeCartItem({id:e,quantity:c})})),a.addEventListener("change",(t=>{parseInt(t.target.value)>0?(c=parseInt(t.target.value),this.changeCartItem({id:e,quantity:c})):a.value=c})),a.addEventListener("keypress",(t=>{(8!==t.which&&0!==t.which&&t.which<48||t.which>57)&&t.preventDefault()}))}async changeCartItem(e){const r={...(0,t.Q2)(),body:JSON.stringify({line:+e.id,quantity:e.quantity,sections:"main-cart"})};fetch(`${routes.cartChange}`,r).then((t=>t.json())).then((t=>{const e=e=>{const r=this.parser.parseFromString(e,"text/html");if(0===t.item_count){const t=document.querySelector(this.mainCartSelector);t&&(t.innerHTML=r.querySelector(this.mainCartSelector).innerHTML),this.renderElements(r)}else this.renderItems(r)};if(t.sections&&null!==t.sections["main-cart"])e(t.sections["main-cart"]);else{const t=`${window.location.pathname}?section_id=main-cart`;fetch(t).then((t=>t.text())).then((t=>{e(t)}))}const r=`${window.location.pathname}?section_id=navigation-main`;fetch(r).then((t=>t.text())).then((e=>{const r=this.parser.parseFromString(e,"text/html");if(0===t.item_count){const t=document.querySelector("#mini-cart");t&&(t.innerHTML=r.querySelector("#mini-cart").innerHTML,t.addEventListeners(),t.querySelectorAll(".icon").forEach((t=>t.classList.add("loaded"))))}}))})).catch((t=>{console.error(t)}))}renderElements(t){this.selectorsToUpdate.forEach((e=>{try{const r=document.querySelectorAll(e),n=t.querySelector(e);r.length&&n&&r.forEach((t=>{n.querySelectorAll(".icon").forEach((t=>t.classList.add("loaded"))),t.replaceWith(n.cloneNode(!0))}))}catch(t){console.error(`Error updating ${e}`,t)}}));const e=t.querySelector(".cart-count");document.querySelectorAll("#cart-open-block .header__icons--cart-open .cart-count").forEach((t=>{e?(t.classList.contains("visually-hidden")&&t.classList.remove("visually-hidden"),t.textContent=e.textContent):t.classList.add("visually-hidden")})),document.querySelector("#cart-open-block .icon").classList.add("loaded")}renderItems(t){this.renderElements(t);const e=Array.from(document.querySelectorAll(this.itemsContainersSelector)),r=t.querySelector(this.itemsContainersSelector);e.forEach((t=>{t&&t.replaceWith(r.cloneNode(!0))})),document.querySelectorAll(".cart-item").forEach((t=>{t.querySelectorAll(".icon").forEach((t=>t.classList.add("loaded"))),this.manageState(t)}))}updateMiniCart(t){return fetch("/?section_id=main-cart").then((t=>t.text())).then((e=>{this.renderItems((new DOMParser).parseFromString(e,"text/html")),t&&"mini-cart"===cartStrings.uxCart&&this.miniCart&&this.miniCart.open()})).catch((t=>{console.error("Error updating mini cart:",t)}))}},customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super(),this.querySelector("textarea").addEventListener("change",(0,t.Ds)((e=>{const r=JSON.stringify({note:e.target.value});fetch(`${routes.cartUpdate}`,{...(0,t.Q2)(),body:r})}),300))}})}();

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.