PageSourceSearch

https://lyofood.com/cdn/shop/t/104/assets/section-main-product.js?v=98328728661013603961787139897

js lyofood.com collected 2026-10-05 02:17:43 UTC 8,310 bytes, 2 lines download raw bytes

1if(typeof ProductPage!="function"){class ProductPage2 extends HTMLElement{constructor(){if(super(),!this.hasAttribute("data-empty-product")){this.productGallery=this.querySelector(".product-gallery"),this.productSlider=this.querySelector("css-slider"),this.querySelector(".product-gallery__thumbnails .thumbnail")&&(this.querySelectorAll(".product-gallery__thumbnails .thumbnail").forEach((elm,i)=>{i==0&&elm.classList.add("active"),elm.addEventListener("click",e=>{this.productSlider.sliderEnabled?this.productSlider.changeSlide(e.currentTarget.dataset.index):(window.scrollTo({top:this.productGallery.querySelector(`.product-gallery-item[data-faux-index="${e.currentTarget.hasAttribute("data-faux-index")?e.currentTarget.dataset.fauxIndex:e.currentTarget.dataset.index}"]`).offsetTop+this.offsetTop,behavior:"smooth"}),this.thumbnailNavigationHelper(e.currentTarget.dataset.fauxIndex)),this._pauseAllMedia()})}),this.productSlider&&this.productSlider.addEventListener("change",e=>{this.thumbnailNavigationHelper(e.target.index)})),this.productSlider&&this.productSlider.addEventListener("change",e=>{this.productGallery.querySelector(`.product-gallery-item[data-index="${e.target.index}"]`).dataset.productMediaType=="model"&&this.xrButton&&this.xrButton.setAttribute("data-shopify-model3d-id",this.productGallery.querySelector(`.product-gallery-item[data-index="${e.target.index}"]`).dataset.mediaId),this._pauseAllMedia(),this.thumbnailNavigationHelper(e.target.index)});const productVariants=this.querySelector("product-variants");if(productVariants&&(productVariants.addEventListener("VARIANT_CHANGE",this.onVariantChangeHandler.bind(this)),this.onVariantChangeHandler({target:productVariants})),!document.body.classList.contains("template-cart")&&KROWN.settings.cart_action=="overlay"){let addToCartEnter=!1;this.querySelector(".product--add-to-cart-button")&&this.querySelector(".product--add-to-cart-button").addEventListener("keyup",e=>{e.keyCode==window.KEYCODES.RETURN&&(addToCartEnter=!0)}),this.querySelector(".product--add-to-cart-form")&&this.querySelector(".product--add-to-cart-form").addEventListener("add-to-cart",()=>{document.getElementById("site-cart").show(),document.getElementById("cart-recommendations")&&document.getElementById("cart-recommendations").generateRecommendations(),addToCartEnter&&setTimeout(()=>{document.querySelector("#site-cart .sidebar__cart-close").focus()},200)})}if(this.productGallery.dataset.style=="scroll"){this.productGalleryNavigation=this.querySelector(".product-gallery__thumbnails"),this.productGalleryNavigationItem=this.querySelectorAll(".product-gallery__thumbnails .thumbnail");const reversedGallerySlides=[...this.productGallery.querySelectorAll(".product-gallery-item")].reverse(),checkIfProductIsFirst=this.parentNode==document.querySelector("#main .mount-product-page:first-child")?document.querySelector("#main .mount-product-page:first-child .product-gallery__thumbnails"):!1;this.GALLERY_NAVIGATION_SCROLL=()=>{if(!this.productGallery.querySelector("css-slider").sliderEnabled&&window.innerWidth>768){for(const slide of reversedGallerySlides){const slideTop=slide.getBoundingClientRect().top;if(slideTop<window.innerHeight/2&&slideTop>-window.innerHeight/2){this.productGalleryNavigationItem.forEach(elm=>elm.classList.remove("active")),this.productGalleryNavigationItem[slide.dataset.fauxIndex].classList.add("active");break}}const productGalleryTop=this.productGallery.getBoundingClientRect().top;(productGalleryTop-window.innerHeight)*-1>this.productGallery.offsetHeight?(this.productGalleryNavigation.classList.add("scroll"),this.productGalleryNavigation.classList.remove("scroll-up")):productGalleryTop>0?(this.productGalleryNavigation.classList.add("scroll-up"),this.productGalleryNavigation.classList.add("scroll"),checkIfProductIsFirst&&(checkIfProductIsFirst.style.height=`calc( var(--window-height) + ${window.scrollY}px )`)):(productGalleryTop-window.innerHeight)*-1<this.productGallery.offsetHeight&&(this.productGalleryNavigation.classList.remove("scroll"),this.productGalleryNavigation.classList.remove("scroll-up"))}},window.addEventListener("scroll",this.GALLERY_NAVIGATION_SCROLL,{passive:!0}),this.GALLERY_NAVIGATION_SCROLL()}this.querySelectorAll("product-model").length>0&&(window.ProductModel.loadShopifyXR(),this.xrButton=this.querySelector(".product__view-in-space"));
1const productContentBox=this.querySelector(".box__product-content"),productGalleryBox=this.querySelector(".box__product-gallery");if(this.CONTENT_STICKY_RESIZE=()=>{productContentBox.style.top=`calc(100vh - ${productContentBox.offsetHeight+1}px)`,productGalleryBox.style.top=`calc(100vh - ${productGalleryBox.offsetHeight+1}px)`},window.addEventListener("resize",this.CONTENT_STICKY_RESIZE,{passive:!0}),this.CONTENT_STICKY_RESIZE(),new MutationObserver(mutations=>{for(const mutation of mutations)this.CONTENT_STICKY_RESIZE()}).observe(productContentBox,{attributes:!0,childList:!0,subtree:!0}),this.productGallery.querySelector("video-popup")){const productVideoObserver=new MutationObserver(mutations=>{for(const mutation of mutations)mutation.target.classList.contains("video-opened")?this.productGallery.classList.add("remove-navigation"):this.productGallery.classList.remove("remove-navigation")});this.productGallery.querySelectorAll("video-popup").forEach(elm=>{productVideoObserver.observe(elm,{attributes:!0,childList:!1,subtree:!1})})}}}thumbnailNavigationHelper(index=0){this.querySelectorAll(".product-gallery__thumbnails .thumbnail").forEach((elm,i)=>{i==index?elm.classList.add("active"):elm.classList.remove("active")})}onVariantChangeHandler(e){const variant=e.target.currentVariant;if(variant&&variant.featured_media!=null){const variantImg=this.productGallery.querySelector('.product-gallery-item[data-media-id="'+variant.featured_media.id+'"]');if(variantImg)if(this.productGallery.dataset.style=="slider"||this.productGallery.dataset.style=="scroll"&&this.productGallery.querySelector("css-slider").sliderEnabled)this.productGallery.querySelector("css-slider").changeSlide(variantImg.dataset.index);else{const originalOrder=[...this.productGallery.querySelectorAll(".product-gallery-item")].sort((a,b)=>a.dataset.index-b.dataset.index);Math.abs(this.productGallery.getBoundingClientRect().y)>window.innerHeight/2&&window.scrollTo({top:this.productGallery.offsetTop,behavior:"smooth"}),originalOrder.forEach(elm=>{this.productGallery.querySelector("css-slider").append(elm)}),this.productGallery.querySelector("css-slider").prepend(variantImg),this.reorderThumbnailNavigation()}}}reorderThumbnailNavigation(index){const reversedGallerySlidesForThumbnails=[...this.productGallery.querySelectorAll(".product-gallery-item")].reverse(),galleryThumbnailsHolder=this.querySelector(".product-gallery__thumbnails .thumbnails-holder .thumbnails");
1reversedGallerySlidesForThumbnails.forEach(slide=>{galleryThumbnailsHolder.prepend(this.querySelector(`.product-gallery__thumbnails .thumbnail[data-faux-index="${slide.dataset.index}"]`))}),this.querySelectorAll(".product-gallery__thumbnails .thumbnails-holder .thumbnail").forEach((elm,i)=>{elm.setAttribute("data-index",i)}),this.thumbnailNavigationHelper(0),setTimeout(()=>{this.thumbnailNavigationHelper(0)},10)}_pauseAllMedia(){document.querySelectorAll(".product .js-youtube").forEach(video=>{video.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),document.querySelectorAll(".product .js-vimeo").forEach(video=>{video.contentWindow.postMessage('{"method":"pause"}',"*")}),document.querySelectorAll(".product video").forEach(video=>video.pause()),document.querySelectorAll(".product product-model").forEach(model=>{model.modelViewerUI&&model.modelViewerUI.pause()})}_playMedia(media){switch(media.dataset.productMediaType){case"video":media.querySelector("video").play();break;case"external_video-youtube":media.querySelector(".js-youtube").contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*");break;case"external_video-vimeo":media.querySelector(".js-vimeo").contentWindow.postMessage('{"method":"play"}',"*");break}}}typeof customElements.get("product-page")>"u"&&customElements.define("product-page",ProductPage2)}
2//# sourceMappingURL=/cdn/shop/t/104/assets/section-main-product.js.map?v=98328728661013603961787139897

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.