PageSourceSearch

https://travelpro.com/cdn/shop/t/439/compiled_assets/block-scripts.js?v=161537292147589183571789407927

js travelpro.com collected 2026-09-25 14:57:39 UTC 4,903 bytes, 2 lines download raw bytes

1(function(){var __blocks__={};(function(){for(var element=document.getElementById("blocks-script"),attribute=a=element?element.getAttribute("data-blocks"):"",blocks=a.split(",").filter(Boolean),i=0;i<blocks.length;i++)__blocks__[blocks[i]]=!0})(),(function(){if(!(!__blocks__["product-add-ons"]&&!Shopify.designMode))try{class ProductAddOns extends HTMLElement{constructor(){super(),this.modal=this.querySelector("dialog"),this.modalItems=this.querySelectorAll("[data-modal-item]"),this.modalTriggers=this.querySelectorAll(".product-add-on__modal-trigger"),this.dropdowns=this.querySelectorAll(".product-add-on__variant-dropdown"),this.atcButtons=this.querySelectorAll(".product-add-on__atc-button"),this.bindEvents()}bindEvents(){this.querySelectorAll(".product-add-on__variant-dropdown, .product-add-on__atc-button").forEach(el=>{el.addEventListener("pointerdown",e=>e.stopPropagation()),el.addEventListener("mousedown",e=>e.stopPropagation()),el.addEventListener("touchstart",e=>e.stopPropagation(),{passive:!0})}),this.modalTriggers.forEach(trigger=>{trigger.addEventListener("click",e=>{const index=e.currentTarget.dataset.modalIndex;this.openModal(index)})}),this.dropdowns.forEach(dropdown=>{dropdown.addEventListener("change",e=>{const parent=e.currentTarget.closest(".product-add-on"),atcButton=parent.querySelector(".product-add-on__atc-button"),image=parent.querySelector(".product-add-on__image img"),selectedOption=e.currentTarget.selectedOptions[0];atcButton&&(atcButton.dataset.variantId=selectedOption.value),image&&selectedOption.dataset.variantImage&&(image.src=selectedOption.dataset.variantImage,selectedOption.dataset.variantImageSrcset&&(image.srcset=selectedOption.dataset.variantImageSrcset))})}),this.atcButtons.forEach(button=>{button.dataset.autoAdd!=="true"&&button.addEventListener("click",e=>{const btn=e.currentTarget;if(btn.disabled)return;const variantId=btn.dataset.variantId;variantId&&this.addToCart(variantId,btn)})}),this.atcButtons.forEach(button=>{if(button.dataset.autoAdd==="true"){const variantId=button.dataset.variantId;variantId&&this.addToCart(variantId,button)}})}async addToCart(variantId,button){const originalText=button.textContent;button.disabled=!0,button.textContent="Adding...";try{const formData=new FormData;formData.append("id",variantId),formData.append("quantity","1");const response=await fetch(window.Theme?.routes?.cart_add_url||"/cart/add.js",{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/javascript"},body:formData});if(!response.ok)throw new Error("Failed to add to cart");const responseData=await response.json().catch(()=>({}));button.textContent="Added!",button.classList.add("product-add-on__atc-button--added"),document.dispatchEvent(new CustomEvent("cart:update",{bubbles:!0,detail:{resource:responseData,sourceId:variantId,data:{source:"product-form-component",itemCount:1,productId:button.closest(".product-add-on")?.dataset?.addonIndex,sections:responseData.sections||{}}}})),setTimeout(()=>{button.textContent=originalText,button.classList.remove("product-add-on__atc-button--added"),button.disabled=!1},2e3)}catch(error){console.error("Add-on cart error:",error),button.textContent="Try again",setTimeout(()=>{button.textContent=originalText,button.disabled=!1},2e3)}}openModal(index){this.modal&&(this.modalItems.forEach(item=>{item.hidden=item.dataset.modalItem!==index}),this.modal.showModal())}}customElements.define("product-add-ons",ProductAddOns)}catch(e){console.error(e)}})(),(function(){if(!(!__blocks__["product-size-selector"]&&!Shopify.designMode))try{class ProductSizeSelector{constructor(){this.init()}init(){document.querySelectorAll("[data-size-drawer-trigger]").forEach(trigger=>{const blockId=trigger.dataset.sizeDrawerTrigger,drawer=document.querySelector(`[data-size-drawer="${blockId}"]`);if(!drawer)return;trigger.addEventListener("click",()=>{drawer.showModal()});const closeBtn=drawer.querySelector("[data-close-size-drawer]");closeBtn&&closeBtn.addEventListener("click",()=>this.closeDrawer(drawer)),drawer.addEventListener("click",e=>{e.target===drawer&&this.closeDrawer(drawer)}),drawer.addEventListener("keydown",e=>{e.key==="Escape"&&(e.preventDefault(),this.closeDrawer(drawer))})}),document.querySelectorAll("[data-compare-drawer-trigger]").forEach(trigger=>{const blockId=trigger.dataset.compareDrawerTrigger,drawer=document.querySelector(`[data-compare-drawer="${blockId}"]`);drawer&&trigger.addEventListener("click",()=>{drawer.showModal()})})}closeDrawer(drawer){drawer.classList.add("dialog-closing"),setTimeout(()=>{drawer.close(),drawer.classList.remove("dialog-closing")},300)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>new ProductSizeSelector):new ProductSizeSelector}catch(e){console.error(e)}})()})();
2//# sourceMappingURL=/cdn/shop/t/439/compiled_assets/block-scripts.js.map?v=161537292147589183571789407927

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.