PageSourceSearch

https://www.thermoworks.com/cdn/shop/t/9/assets/component-quantity…?v=158038953106622648991778271683

js thermoworks.com collected 2026-10-02 03:00:01 UTC 3,731 bytes, 2 lines download raw bytes

1import{Component}from"@theme/component";import{QuantitySelectorUpdateEvent}from"@theme/events";class QuantitySelectorComponent extends Component{increaseQuantity(event){if(!(event.target instanceof HTMLElement))return;event.preventDefault();const input=this.refs.quantityInput;if(!input)return;const container=input.closest?.(".tw-qty-validation-wrapper"),msgEl=container?container.querySelector("[data-max-qty-text]"):null,maxAttr=input.getAttribute?.("data-max-qty"),max=maxAttr?parseInt(maxAttr,10):input.max?parseInt(input.max,10):NaN,tpl=window?.translations?.cart?.max_qty,maxQtyMessage=tpl?tpl.replace("-[X]-",String(max)):"";if(Number.isNaN(max)){input.stepUp(),msgEl&&(msgEl.textContent=""),this.#onQuantityChange();return}if((Number(input.value)||0)>=max){msgEl&&(msgEl.textContent=maxQtyMessage);return}input.stepUp(),Number(input.value)<=max?msgEl&&(msgEl.textContent=""):(msgEl&&(msgEl.textContent=maxQtyMessage),input.value=String(max)),this.#onQuantityChange()}decreaseQuantity(event){if(!(event.target instanceof HTMLElement))return;const container=this.refs.quantityInput?.closest?.(".tw-qty-validation-wrapper"),msgEl=container?container.querySelector("[data-max-qty-text]"):null;msgEl&&(msgEl.textContent=""),event.preventDefault(),this.refs.quantityInput.stepDown(),this.#onQuantityChange()}selectInputValue(event){const{quantityInput}=this.refs;!(event.target instanceof HTMLInputElement)||document.activeElement!==quantityInput||quantityInput.select()}setQuantity(event){if(!(event.target instanceof HTMLElement))return;event.preventDefault();const input=this.refs.quantityInput,container=input?.closest?.(".tw-qty-validation-wrapper"),msgEl=container?container.querySelector("[data-max-qty-text]"):null,maxAttr=input?.getAttribute?.("data-max-qty"),max=maxAttr?parseInt(maxAttr,10):input?.max?parseInt(input.max,10):NaN,maxQtyMessage=(window?.translations?.cart?.max_qty).replace("-[X]-",String(max));if(Number.isNaN(max)){event.target instanceof HTMLInputElement&&(input.value=event.target.value),msgEl&&(msgEl.textContent=""),this.#onQuantityChange();return}if((event.target instanceof HTMLInputElement?Number(event.target.value):Number(input.value))>max){msgEl&&(msgEl.textContent=maxQtyMessage),input.value=String(max),this.#onQuantityChange();return}msgEl&&(msgEl.textContent=""),event.target instanceof HTMLInputElement&&(this.refs.quantityInput.value=event.target.value),this.#onQuantityChange()}#onQuantityChange(){const{quantityInput}=this.refs;this.#checkQuantityRules();const newValue=parseInt(quantityInput.value);quantityInput.dispatchEvent(new QuantitySelectorUpdateEvent(newValue,Number(quantityInput.dataset.cartLine))),this.#announceQuantity(newValue)}#announceQuantity(quantity){const liveRegion=this.querySelector("[data-quantity-live-region]");liveRegion&&(liveRegion.textContent="",requestAnimationFrame(()=>{liveRegion.textContent=`Quantity: ${quantity}`}))}#checkQuantityRules=()=>{const{quantityInput}=this.refs,val=Number(quantityInput.value),minVal=quantityInput.min!==""?Number(quantityInput.min):0,maxVal=quantityInput.max!==""?Number(quantityInput.max):1/0;let next=Number.isFinite(val)?val:Number.isFinite(minVal)?minVal:1;Number.isFinite(minVal)&&next<minVal&&(next=minVal),Number.isFinite(maxVal)&&next>maxVal&&(next=maxVal),quantityInput.value=String(next)};get quantityInput(){if(!this.refs.quantityInput)throw new Error('Missing <input ref="quantityInput" /> inside <quantity-selector-component />');return this.refs.quantityInput}}customElements.get("quantity-selector-component")||customElements.define("quantity-selector-component",QuantitySelectorComponent);
2//# sourceMappingURL=/cdn/shop/t/9/assets/component-quantity-selector.js.map?v=158038953106622648991778271683

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.