PageSourceSearch

https://diner-tokyo.com/cdn/shop/t/22/assets/product-information.js?v=182852260445572895501770170238

js diner-tokyo.com collected 2026-10-09 03:00:41 UTC 11,707 bytes, 2 lines download raw bytes

1customElements.get("product-information")||customElements.define("product-information",class extends HTMLElement{staticBuyTools=!0;quantityInput=void 0;onVariantChangeUnsubscriber=void 0;cartUpdateUnsubscriber=void 0;abortController=void 0;pendingRequestUrl=null;preProcessHtmlCallbacks=[];postProcessHtmlCallbacks=[];constructor(){super(),this.buyToolsTrigger=this.querySelector("#product__buy-tools-trigger"),this.productInfoContainer=this.querySelector(".product__info-container"),this.onScrollToolsHandler=this.onScrollBuyTools.bind(this),this.quantityInput=this.querySelector(`#QuantityInput-${this.sectionId}`),this.initBreakpoints()}initBreakpoints(){const self=this;enquire.register("screen and (max-width: 1000px)",{match:()=>{self.bpSmall=!0,this.productInfoContainer.classList.remove("product__info-container--modal--out"),this.productInfoContainer.classList.remove("product__info-container--modal","background-modal")},unmatch:()=>{self.bpSmall=!1,this.productInfoContainer.classList.remove("product__info-container--modal--out"),this.productInfoContainer.classList.remove("product__info-container--modal","background-modal")}})}connectedCallback(){this.initializeProductSwapUtility(),this.onVariantChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.optionValueSelectionChange,this.handleOptionValueChange.bind(this))}addPreProcessCallback(callback){this.preProcessHtmlCallbacks.push(callback)}disconnectedCallback(){this.onVariantChangeUnsubscriber()}initializeProductSwapUtility(){this.preProcessHtmlCallbacks.push(html=>{html.querySelectorAll(".scroll-trigger").forEach(element=>element.classList.add("scroll-trigger--cancel"))}),this.postProcessHtmlCallbacks.push(newNode=>{window?.Shopify?.PaymentButton?.init(),window?.ProductModel?.loadShopifyXR()})}handleOptionValueChange({data:{event,target,selectedOptionValues}}){if(!this.contains(event.target))return;this.resetProductFormState();const productUrl=target.dataset.productUrl||this.pendingRequestUrl||this.dataset.url;this.pendingRequestUrl=productUrl;const shouldSwapProduct=this.dataset.url!==productUrl,shouldFetchFullPage=this.dataset.updateUrl==="true"&&shouldSwapProduct;this.renderProductInfo({requestUrl:this.buildRequestUrlWithParams(productUrl,selectedOptionValues,shouldFetchFullPage),targetId:target.id,callback:shouldSwapProduct?this.handleSwapProduct(productUrl,shouldFetchFullPage):this.handleUpdateProductInfo(productUrl)})}resetProductFormState(){const productForm=this.productForm;this.toggleSubmitButton(!0),productForm?.handleErrorMessage()}handleSwapProduct(productUrl,updateFullPage){return html=>{this.productModal?.remove();const selector=updateFullPage?"product-information[id^='MainProduct']":"product-information",variant=this.getSelectedVariant(html.querySelector(selector));this.updateURL(productUrl,variant?.id),updateFullPage?(document.querySelector("head title").innerHTML=html.querySelector("head title").innerHTML,HTMLUpdateUtility.viewTransition(document.querySelector("main"),html.querySelector("main"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks)):HTMLUpdateUtility.viewTransition(this,html.querySelector("product-information"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks)}}renderProductInfo({requestUrl,targetId,callback}){this.abortController?.abort(),this.abortController=new AbortController,fetch(requestUrl,{signal:this.abortController.signal}).then(response=>response.text()).then(responseText=>{this.pendingRequestUrl=null;const html=new DOMParser().parseFromString(responseText,"text/html");callback(html)}).then(()=>{document.querySelector(`#${targetId}`)?.focus()}).catch(error=>{error.name==="AbortError"?console.log("Fetch aborted by user"):console.error(error)})}getSelectedVariant(productInfoNode){const selectedVariant=productInfoNode.querySelector("variant-selects [data-selected-variant]")?.innerHTML;return selectedVariant?JSON.parse(selectedVariant):null}buildRequestUrlWithParams(url,optionValues,shouldFetchFullPage=!1){const params=[];return!shouldFetchFullPage&&params.push(`section_id=${this.sectionId}`),optionValues.length&&params.push(`option_values=${optionValues.join(",")}`),`${url}?${params.join("&")}`}updateOptionValues(html){const sectionId=`${this.sectionId}${this.blockId?`${this.blockId}`:""}`,variantSelects=html.getElementById(`VariantSelect-${sectionId}`);if(variantSelects)if(this.closest("complementary-products-card")||this.closest("quick-add-modal")||this.closest(".shop-look__item-wrap")){const updatedOptions=variantSelects.querySelectorAll("fieldset");this.variantSelectors.querySelectorAll('input[data-disabled="true"]').forEach(i=>
1{i.removeAttribute("data-disabled")}),updatedOptions.forEach(option=>{option.querySelectorAll('input[data-disabled="true"]').forEach(i=>{const inputId=i.dataset.optionValueId,currentNode=this.variantSelectors.querySelector(`input[data-option-value-id="${inputId}"]`);currentNode?.tagName==="INPUT"&&currentNode?.type==="radio"&&currentNode.setAttribute("data-disabled","true")})})}else HTMLUpdateUtility.viewTransition(this.variantSelectors,variantSelects,this.preProcessHtmlCallbacks)}handleUpdateProductInfo(productUrl){return html=>{const variant=this.getSelectedVariant(html),sectionId=`${this.sectionId}${this.blockId?`${this.blockId}`:""}`;if(this.pickupAvailability?.update(variant),this.updateOptionValues(html),this.updateURL(productUrl,variant?.id),this.updateVariantInputs(variant?.id),!variant){this.setUnavailable();return}this.updateMedia(variant,variant?.featured_media?.id);const updateSourceFromDestination=(id,shouldHide=source=>!1)=>{const source=html.getElementById(`${id}-${sectionId}`),destination=this.querySelector(`#${id}-${this.dataset.section}`);source&&destination&&(destination.innerHTML=source.innerHTML,destination.classList.toggle("visibility-hidden",shouldHide(source)))};updateSourceFromDestination("price"),updateSourceFromDestination("sku",({classList})=>classList.contains("visibility-hidden")),updateSourceFromDestination("StockNotification",({innerText})=>innerText===""),this.updateLimitQuantity(this.sectionId,html),this.toggleSubmitButton(html.getElementById(`ProductSubmitButton-${sectionId}`)?.hasAttribute("disabled")??!0,window.variantStrings.soldOut),publish(PUB_SUB_EVENTS.variantChange,{data:{sectionId:this.sectionId,html,variant}})}}updateLimitQuantity(sectionId,html){if(!this.quantityInput)return;const quantityFormUpdated=html.getElementById(`QuantityInput-${sectionId}`);this.quantityInput.updateLimitQuantity(quantityFormUpdated)}updateVariantInputs(variantId){const sectionId=`${this.dataset.section}`;this.querySelectorAll(`#product-form-${sectionId}, #product-form-installment-${sectionId}`).forEach(productForm=>{const input=productForm.querySelector('input[name="id"]');input.value=variantId??"",input.dispatchEvent(new Event("change",{bubbles:!0}))})}updateURL(url,variantId){this.querySelector("share-button")?.updateUrl(`${window.shopUrl}${url}${variantId?`?variant=${variantId}`:""}`),this.dataset.updateUrl!=="false"&&window.history.replaceState({},"",`${url}${variantId?`?variant=${variantId}`:""}`)}toggleSubmitButton(disable=!0,text){const productForm=this.productForm?.querySelector("form");if(!productForm)return;const addButton=productForm.querySelector("[data-add-to-cart]"),addButtonText=productForm.querySelector("[data-add-to-cart-text]");if(!addButton)return;const variantClassSoldOut="product-form--variant-sold-out",formParentElement=productForm.closest(".product-form__buy-buttons"),productMetaPrice=formParentElement?formParentElement.querySelector("[data-product-meta-price]"):null;disable?(addButton.setAttribute("aria-disabled",!0),addButton.setAttribute("disabled",!0),addButton.setAttribute("aria-label",text),text&&(addButtonText.textContent=text,productForm.classList.add(variantClassSoldOut),productMetaPrice&&productMetaPrice.classList.add("meta-price--hidden"))):(addButton.removeAttribute("aria-disabled"),addButton.removeAttribute("disabled"),addButton.setAttribute("aria-label",window.variantStrings.addToCart),addButtonText.textContent=window.variantStrings.addToCart,productForm.classList.remove(variantClassSoldOut),productMetaPrice&&productMetaPrice.classList.remove("meta-price--hidden"))}setUnavailable(){this.toggleSubmitButton(!0,window.variantStrings.unavailable);const selectors=["price","sku","StockNotification"].map(id=>`#${id}-${this.dataset.section}`).join(", ");document.querySelectorAll(selectors).forEach(({classList})=>classList.add("visibility-hidden"))}updateMedia(variant,variantFeaturedMediaId){if(!variantFeaturedMediaId)return;const sectionId=`${this.dataset.section}`,mediaGallery=this.querySelector(`#MediaGallery-${sectionId}`);mediaGallery&&mediaGallery.setActiveMedia(`${sectionId}-${variantFeaturedMediaId}`,variant)}buyToolsCalculations(){this.staticBuyTools=!1,this.productPageSection=this.parentElement,this.productInfoWrapper=this.productPageSection.querySelector(".product__info-wrapper"),this.productInfoContainerHeight=this.productInfoContainer.offsetHeight,this.negativeHeight=this.productInfoContainerHeight*-1,this.productC
1ontentSection=document.querySelector(".product-content-section");const productContentMinHeight=this.productInfoContainerHeight-this.productPageSection.offsetHeight+54;this.productContentSection.style.minHeight=`${productContentMinHeight}px`,this.resizeProductInfoObserver=new ResizeObserver(entries=>{if(!this.bpSmall&&!this.productInfoContainer.classList.contains("product__info-container--modal")){const productInfoContainerHeight=this.productInfoContainer.offsetHeight;if(productInfoContainerHeight!=this.productInfoContainerHeight){this.productInfoContainerHeight=productInfoContainerHeight;const productContentMinHeight2=productInfoContainerHeight-this.productPageSection.offsetHeight+54;this.productContentSection.style.minHeight=`${productContentMinHeight2}px`,this.negativeHeight=productInfoContainerHeight*-1}}}),this.resizeProductInfoObserver.observe(this.productInfoContainer)}onScrollBuyTools(){if(this.bpSmall||!this.buyToolsTrigger)return;const triggerTop=this.buyToolsTrigger.getBoundingClientRect().top,buyToolsModalActive=this.productInfoContainer.classList.contains("product__info-container--modal","background-modal"),bytToolsModalOut=this.productInfoContainer.classList.contains("product__info-container--modal--out");triggerTop<this.negativeHeight&&!buyToolsModalActive?requestAnimationFrame(()=>{this.productInfoContainer.classList.add("product__info-container--modal","background-modal")}):triggerTop>this.negativeHeight&&buyToolsModalActive&&!bytToolsModalOut&&requestAnimationFrame(()=>{this.productInfoContainer.classList.add("product__info-container--modal--out"),this.productInfoContainer.addEventListener("animationend",()=>{this.productInfoContainer.classList.remove("product__info-container--modal--out"),this.productInfoContainer.classList.remove("product__info-container--modal","background-modal")},{once:!0})})}get productForm(){return this.querySelector("product-form")}get productModal(){return document.querySelector(`#ProductModal-${this.sectionId}`)}get pickupAvailability(){return this.querySelector("pickup-availability")}get variantSelectors(){return this.querySelector("variant-selects")}get relatedProducts(){const relatedProductsSectionId=SectionId.getIdForSection(SectionId.parseId(this.sectionId),"related-products");return document.querySelector(`product-recommendations[data-section-id^="${relatedProductsSectionId}"]`)}get sectionId(){return this.dataset.originalSection||this.dataset.section}get blockId(){return this.dataset.block}get productId(){return this.dataset.productId}});
2//# sourceMappingURL=/cdn/shop/t/22/assets/product-information.js.map?v=182852260445572895501770170238

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.