PageSourceSearch

https://t3micro.com/cdn/shop/t/101/assets/component-product-swatch.js?v=115720474422631166621777572946

js t3micro.com collected 2026-09-24 09:17:09 UTC 5,268 bytes, 2 lines download raw bytes

1(()=>{class ProductSwatch extends HTMLElement{constructor(){super(),this.onSwatchChangeBound=this.onSwatchChange.bind(this),this.onColorSwatchMouseEnterBound=this.onColorSwatchMouseEnter.bind(this),this.onSwatchMouseLeaveBound=this.onSwatchMouseLeave.bind(this)}connectedCallback(){this.colorLabelContainer=this.querySelector("[data-color-swatch-name-container]"),this.colorLabel=this.querySelector("[data-color-swatch-name]"),this.colorLabelState=this.querySelector("[data-color-swatch-state]"),this.soldOutString=this.getAttribute("data-swatch-sold-out-string"),this.colorSwatches=this.querySelectorAll(".swatch-element.color"),this.sectionId=this.getAttribute("data-section-id"),this.isColorSwatch=this.getAttribute("data-is-color-swatch")==="true"||this.classList.contains("is-color-swatch"),this.setEventListeners(),this.setColorLabelState(),this.syncInitialVariantState()}setEventListeners(){this.colorSwatches.forEach(swatch=>{swatch.addEventListener("mouseenter",this.onColorSwatchMouseEnterBound),swatch.addEventListener("mouseleave",this.onSwatchMouseLeaveBound)}),this.addEventListener("change",this.onSwatchChangeBound)}setColorLabelState(){const activeSwatch=this.querySelector(".swatch-element.color.active");if(!activeSwatch)return;const activeSwatchAvailable=activeSwatch.getAttribute("data-swatch-option-available");!this.soldOutString||!this.colorLabelState||(this.updateColorLabelState(activeSwatchAvailable),this.currentLabel="",this.colorLabel&&(this.currentLabel=this.colorLabel.textContent))}updateColorLabelState(available){this.colorLabelState&&(this.colorLabelState.innerText=available==="false"?`(${this.soldOutString})`:"")}onSwatchChange(event){const input=event.target;if(input?.disabled)return;const currentVariant=this.getVariantData(input.id);input.getAttribute("data-force-out-of-stock")==="true"&&currentVariant&&(currentVariant.available=!1,currentVariant.force_out_of_stock=!0);const productUrl=input.getAttribute("data-product-url"),productFetchUrl=input.getAttribute("data-product-fetch-url"),isCombinedListing=input.getAttribute("data-is-combined-listing")==="true";this.emitVariantChangeEvent(currentVariant,productFetchUrl,productUrl,isCombinedListing)}emitVariantChangeEvent(variant,productFetchUrl,productUrl,isCombinedListing=!1){eventBus.emit("variant:change",{sectionId:this.sectionId,variant,fetchURL:productFetchUrl,productURL:productUrl,isCombinedListing,isColorSwatch:this.isColorSwatch})}onColorSwatchMouseEnter(event){this.updateColorLabel(event.currentTarget);const activeSwatch=this.querySelector(".swatch-element.color.active");activeSwatch&&!event.currentTarget.classList.contains("active")&&activeSwatch.classList.add("sibling-hover-active")}onSwatchMouseLeave(){const siblingHoverActiveSwatch=this.querySelector(".swatch-element.sibling-hover-active");siblingHoverActiveSwatch&&siblingHoverActiveSwatch.classList.remove("sibling-hover-active"),this.resetColorLabel()}updateColorLabel=swatch=>{if(!swatch)return;const label=swatch.getAttribute("data-value"),swatchAvailable=swatch.getAttribute("data-swatch-option-available");!label||!this.colorLabel||(this.colorLabel.textContent=label,this.animateColorLabel(label),this.updateColorLabelState(swatchAvailable))};resetColorLabel=()=>{const activeSwatch=this.querySelector(".swatch-element.color.active");if(!activeSwatch||!this.colorLabel)return;const activeSwatchValue=activeSwatch.getAttribute("data-value"),swatchAvailable=activeSwatch.getAttribute("data-swatch-option-available");activeSwatchValue&&(this.colorLabel.textContent=activeSwatchValue,this.animateColorLabel(activeSwatchValue),this.updateColorLabelState(swatchAvailable))};animateColorLabel(label){label!==this.currentLabel&&(this.colorLabelContainer.classList.remove("fade-in-label"),this.colorLabelContainer.offsetWidth,this.colorLabelContainer.classList.add("fade-in-label"),this.currentLabel=label)}removeEventListeners(){this.colorSwatches.forEach(swatch=>{swatch.removeEventListener("mouseenter",this.onColorSwatchMouseEnterBound),swatch.removeEventListener("mouseleave",this.onSwatchMouseLeaveBound)}),this.removeEventListener("change",this.onSwatchChangeBound)}getVariantData(inputId){return JSON.parse(this.getVariantDataElement(inputId).textContent)}getVariantDataElement(inputId){return this.querySelector(`script[type="application/json"][data-resource="${inputId}"]`)}syncInitialVariantState(){const checkedInput=this.querySelector("input[data-product-variant]:checked");if(!checkedInput)return;const currentVariant=this.getVariantData(checkedInput.id);if(!(checkedInput.getAttribute("data-force-out-of-stock")==="true")||!currentVariant)return;
1currentVariant.available=!1,currentVariant.force_out_of_stock=!0;const productUrl=checkedInput.getAttribute("data-product-url"),productFetchUrl=checkedInput.getAttribute("data-product-fetch-url"),isCombinedListing=checkedInput.getAttribute("data-is-combined-listing")==="true";this.emitVariantChangeEvent(currentVariant,productFetchUrl,productUrl,isCombinedListing)}disconnectedCallback(){this.removeEventListeners()}}window.customElements.get("product-swatch")||window.customElements.define("product-swatch",ProductSwatch)})();
2//# sourceMappingURL=/cdn/shop/t/101/assets/component-product-swatch.js.map?v=115720474422631166621777572946

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.