1(function(){var isLoading=!1,observer=null;function initCollectionLoadMore(){var sentinel=document.querySelector(".collection-load-more__sentinel[data-next-url]");sentinel&&(observer&&(observer.disconnect(),observer=null),observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){!entry.isIntersecting||isLoading||loadNextPage(sentinel)})},{root:null,rootMargin:"200px 0px",threshold:0}),observer.observe(sentinel))}function loadNextPage(sentinel){var nextUrl=sentinel.getAttribute("data-next-url");!nextUrl||isLoading||(isLoading=!0,setLoadingState(!0),fetch(nextUrl,{credentials:"same-origin"}).then(function(response){if(!response.ok)throw new Error("Failed to load more products");return response.text()}).then(function(html){var parser=new DOMParser,doc=parser.parseFromString(html,"text/html");appendProducts(doc);var nextSentinel=doc.querySelector(".collection-load-more__sentinel[data-next-url]"),nextPageUrl=nextSentinel?nextSentinel.getAttribute("data-next-url"):null;if(nextPageUrl)sentinel.setAttribute("data-next-url",nextPageUrl),isLoading=!1,setLoadingState(!1);else{observer&&(observer.disconnect(),observer=null);var container=sentinel.closest("[data-collection-load-more]");container&&container.remove(),isLoading=!1}reinitializeCollectionProducts()}).catch(function(){isLoading=!1,setLoadingState(!1)}))}function setLoadingState(loading){var status=document.querySelector(".collection-load-more__status");status&&(loading?status.removeAttribute("hidden"):status.setAttribute("hidden",""))}function appendProducts(doc){var loadMoreContainer=document.querySelector(".collection-load-more-container");doc.querySelectorAll(".collection-listing-container[data-collection-section]").forEach(function(sourceSection){var sectionKey=sourceSection.getAttribute("data-collection-section"),targetSection=document.querySelector('.collection-listing-container[data-collection-section="'+sectionKey+'"]');if(!targetSection){loadMoreContainer&&loadMoreContainer.parentNode&&loadMoreContainer.parentNode.insertBefore(sourceSection.cloneNode(!0),loadMoreContainer);return}var targetListing=targetSection.querySelector(".collection-listing");targetListing&&sourceSection.querySelectorAll(".product-listing[data-product-id]").forEach(function(productNode){var productId=productNode.getAttribute("data-product-id");productId&&(targetSection.querySelector('.product-listing[data-product-id="'+productId+'"]')||targetListing.appendChild(productNode.cloneNode(!0)))})})}function reinitializeCollectionProducts(){typeof productListingRatio=="function"&&productListingRatio(),typeof quantityControl=="function"&&quantityControl(),typeof mobileQuantityModal=="function"&&mobileQuantityModal(".collection-listing .product-quantity-container"),typeof collectionTagCount=="function"&&collectionTagCount(),typeof collectionShadeImages=="function"&&collectionShadeImages(),typeof collectionHover=="function"&&collectionHover(),typeof collectionProductImage=="function"&&collectionProductImage(),typeof productSwatchCollection=="function"&&productSwatchCollection(),window.jQuery&&window.jQuery('form[action="/cart/add"]').off("submit").on("submit",function(e){e.preventDefault(),typeof submitForm=="function"&&submitForm(window.jQuery(this))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initCollectionLoadMore):initCollectionLoadMore()})(); 2//# sourceMappingURL=/cdn/shop/t/118/assets/we-collection-load-more.js.map?v=803948718620756731784805118
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.