PageSourceSearch

https://www.evolutionsupplements.co.uk/cdn/shop/t/20/assets/cart.s.min.js?v=110180814244924960981791453430

js evolutionsupplements.co.uk collected 2026-10-08 20:12:03 UTC 6,604 bytes, 1 lines download raw bytes

1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault();(this.closest("cart-items")||this.closest("cart-drawer-items")).updateQuantity(this.dataset.index,0,t)})}}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 t=debounce(t=>{this.onChange(t)},ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener("change",t.bind(this))}cartUpdateUnsubscriber=void 0;connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,t=>{if("cart-items"!==t.source)return this.onCartUpdate()})}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}resetQuantityInput(t){const e=this.querySelector(`#Quantity-${t}`);e.value=e.getAttribute("value"),this.isEnterPressed=!1}setValidity(t,e,r){t.target.setCustomValidity(r),t.target.reportValidity(),this.resetQuantityInput(e),t.target.select()}validateQuantity(t){const e=parseInt(t.target.value),r=t.target.dataset.index;let n="";e<t.target.dataset.min?n=window.quickOrderListStrings.min_error.replace("[min]",t.target.dataset.min):e>parseInt(t.target.max)?n=window.quickOrderListStrings.max_error.replace("[max]",t.target.max):e%parseInt(t.target.step)!==0&&(n=window.quickOrderListStrings.step_error.replace("[step]",t.target.step)),n?this.setValidity(t,r,n):(t.target.setCustomValidity(""),t.target.reportValidity(),this.updateQuantity(r,e,t,document.activeElement.getAttribute("name"),t.target.dataset.quantityVariantId))}onChange(t){this.validateQuantity(t)}onCartUpdate(){return"CART-DRAWER-ITEMS"===this.tagName?fetch(`${routes.cart_url}?section_id=cart-drawer`).then(t=>t.text()).then(t=>{const e=(new DOMParser).parseFromString(t,"text/html"),r=["cart-drawer-items",".cart-drawer__footer"];for(const t of r){const r=document.querySelector(t),n=e.querySelector(t);r&&n&&r.replaceWith(n)}}).catch(t=>{console.error(t)}):fetch(`${routes.cart_url}?section_id=main-cart-items`).then(t=>t.text()).then(t=>{const e=(new DOMParser).parseFromString(t,"text/html").querySelector("cart-items");this.innerHTML=e.innerHTML}).catch(t=>{console.error(t)})}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"}]}updateQuantity(t,e,r,n,a){this.enableLoading(t);const i=JSON.stringify({line:t,quantity:e,sections:this.getSectionsToRender().map(t=>t.section),sections_url:window.location.pathname}),s=r.currentTarget instanceof CartRemoveButton?"clear":"change";fetch(`${routes.cart_change_url}`,{...fetchConfig(),body:i}).then(t=>t.text()).then(e=>{const i=JSON.parse(e);CartPerformance.measure(`${s}:paint-updated-sections"`,()=>{const e=document.getElementById(`Quantity-${t}`)||document.getElementById(`Drawer-quantity-${t}`),r=document.querySelectorAll(".cart-item");if(i.errors)return e.value=e.getAttribute("value"),void this.updateLiveRegions(t,i.errors);this.classList.toggle("is-empty",0===i.item_count);const a=document.querySelector("cart-drawer"),s=document.getElementById("main-cart-footer");s&&s.classList.toggle("is-empty",0===i.item_count),a&&a.classList.toggle("is-empty",0===i.item_count),this.getSectionsToRender().forEach(t=>{(document.getElementById(t.id).querySelector(t.selector)||document.getElementById(t.id)).innerHTML=this.getSectionInnerHTML(i.sections[t.section],t.selector)});const o=i.items[t-1]?i.items[t-1].quantity:void 0;let c="";r.length===i.items.length&&o!==parseInt(e.value)&&(c=void 0===o?window.cartStrings.error:window.cartStrings.quantityError.replace("[quantity]",o)),this.updateLiveRegions(t,c);const d=document.getElementById(`CartItem-${t}`)||document.getElementById(`CartDrawer-Item-${t}`);d&&d.querySelector(`[name="${n}"]`)?a?trapFocus(a,d.querySelector(`[name="${n}"]`)):d.querySelector(`[name="${n}"]`).focus():0===i.item_count&&a?trapFocus(a.querySelector(".drawer__inner-empty"),a.querySelector("a")):document.querySelector(".cart-item")&&a&&trapFocus(a,document.querySelector(".cart-item__name"))}),CartPerformance.measureFromEvent(`${s}
1:user-action`,r),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items",cartData:i,variantId:a})}).catch(()=>{this.querySelectorAll(".loading__spinner").forEach(t=>t.classList.add("hidden"));(document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors")).textContent=window.cartStrings.error}).finally(()=>{this.disableLoading(t)})}updateLiveRegions(t,e){const r=document.getElementById(`Line-item-error-${t}`)||document.getElementById(`CartDrawer-LineItemError-${t}`);r&&(r.querySelector(".cart-item__error-text").textContent=e),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(t,e){return(new DOMParser).parseFromString(t,"text/html").querySelector(e).innerHTML}enableLoading(t){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled");[...this.querySelectorAll(`#CartItem-${t} .loading__spinner`),...this.querySelectorAll(`#CartDrawer-Item-${t} .loading__spinner`)].forEach(t=>t.classList.remove("hidden")),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(t){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled");const e=this.querySelectorAll(`#CartItem-${t} .loading__spinner`),r=this.querySelectorAll(`#CartDrawer-Item-${t} .loading__spinner`);e.forEach(t=>t.classList.add("hidden")),r.forEach(t=>t.classList.add("hidden"))}}customElements.define("cart-items",CartItems),customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super(),this.addEventListener("input",debounce(t=>{const e=JSON.stringify({note:t.target.value});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body:e}).then(()=>CartPerformance.measureFromEvent("note-update:user-action",t))},ON_CHANGE_DEBOUNCE_TIMER))}});

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.