PageSourceSearch

https://johnbellcroyden.co.uk/cdn/shop/t/490/assets/quantity-input.js?v=159856816494502251081789724911

js johnbellcroyden.co.uk collected 2026-09-24 23:19:27 UTC 2,104 bytes, 2 lines download raw bytes

1import{d as debounce}from"./debounce-f0994045.js";import{E as EVENTS}from"./events-58bc9098.js";class QuantityInput extends HTMLElement{connectedCallback(){this.input=this.querySelector("[js-quantity-input"),this.minusButton=this.querySelector("[js-quantity-minus]"),this.plusButton=this.querySelector("[js-quantity-plus]"),this.debounce=debounce(),this.input.addEventListener("keyup",this.handleInputKeyup.bind(this)),this.input.addEventListener("change",this.handleInputChange.bind(this)),this.minusButton.addEventListener("click",this.handleButtonClick.bind(this)),this.plusButton.addEventListener("click",this.handleButtonClick.bind(this)),this.lastValue=this.input.value,this.updateInputWidth()}handleInputKeyup(){this.updateInputWidth()}handleInputChange(event){this.updateInputWidth();const inputChangeEvent=new CustomEvent(EVENTS.QUANTITY_INPUT_CHANGE,{bubbles:!0,detail:{input:this.input,minusButton:this.minusButton,plusButton:this.plusButton,quantity:parseInt(this.input.value,10),previousQuantity:parseInt(this.lastValue,10)}});this.dispatchEvent(inputChangeEvent),this.lastValue=this.input.value}handleButtonClick(event){event.preventDefault();const currentQuantity=parseInt(this.input.value,10),minQuantity=parseInt(this.input.getAttribute("min"),10);if(event.currentTarget===this.minusButton){const newQuantity=currentQuantity-1;this.input.value=Math.max(newQuantity,minQuantity)}else this.input.value=currentQuantity+1;return this.updateInputWidth(),this.debounce(()=>this.input.dispatchEvent(new Event("change"))),!1}updateInputWidth(){this.input.style.setProperty("--num-chars",this.input.value.length)}setQuantity(value){this.input.value=value,this.updateInputWidth()}disconnectedCallback(){this.input.removeEventListener("change",this.handleInputChange),this.minusButton.removeEventListener("click",this.handleButtonClick),this.plusButton.removeEventListener("click",this.handleButtonClick)}}customElements.get("quantity-input")||customElements.define("quantity-input",QuantityInput);
2//# sourceMappingURL=/cdn/shop/t/490/assets/quantity-input.js.map?v=159856816494502251081789724911

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.