PageSourceSearch

https://r.place/cdn/shop/t/191/assets/dynamic-load-more.js?v=165281040749989196601777692260

js r.place collected 2026-10-10 01:03:43 UTC 7,859 bytes, 2 lines download raw bytes

1class DynamicLoad extends HTMLElement{constructor(){if(super(),this.itemGrid=document.querySelector("#product-grid")||document.querySelector("#collection-grid")||document.querySelector("#article-grid"),this.itemGrid)this.itemGrid.id==="collection-grid"?this.gridType="collection":this.itemGrid.id==="product-grid"?this.gridType="product":this.itemGrid.id==="article-grid"?this.gridType="article":this.gridType="unknown";else{console.error("Grid element not found.");return}this.setProperties()}setProperties(){}appendContent(newContent,prepend=!1){prepend?this.itemGrid.insertAdjacentHTML("afterbegin",newContent):this.itemGrid.insertAdjacentHTML("beforeend",newContent)}updateUrl(pageNumber){const currentUrl=new URL(window.location.href),currentUrlParams=new URLSearchParams(currentUrl.search);pageNumber===1?currentUrlParams.delete("page"):currentUrlParams.set("page",pageNumber),currentUrl.search=currentUrlParams.toString(),history.replaceState({},"",currentUrl.toString())}updateItemCount(){let selector;switch(this.gridType){case"product":selector=".product-card";break;case"collection":selector=".card-collection";break;case"article":selector=".card-article";break;default:selector=".card-item"}const itemCount=this.itemGrid.querySelectorAll(selector).length;if(this.gridType!=="product")return;const itemCountOfAll=document.querySelector(".collection-facets__product-count .product-count-of-all");itemCountOfAll&&(itemCountOfAll.innerText=itemCount)}}if(!customElements.get("dynamic-load-more")){class DynamicLoadMore extends DynamicLoad{constructor(){super(),this.btnLoadMore=this.querySelector(".js-btn-load-more"),this.observer=null,this.isInfinityScrollActive=!1,this.setProperties(),this.toggleItemsVisibility(),window.addEventListener("shopify:section:load",()=>{this.setProperties(),this.toggleItemsVisibility()}),this.updateItemCount(),this.btnLoadMore.addEventListener("click",e=>{e.preventDefault(),this.loadMoreItems()}),this.checkAndSetupInfinityScroll()}checkAndSetupInfinityScroll(){if(this.itemGrid){const containerId=this.gridType==="product"?"ProductGridContainer":this.gridType==="collection"?"CollectionGridContainer":this.gridType==="article"?"ArticleGridContainer":null;if(containerId){const parentContainer=this.itemGrid.closest(`#${containerId}`);parentContainer&&parentContainer.classList.contains("infinity-scroll-active")?(this.isInfinityScrollActive=!0,this.setupInfinityScroll()):this.isInfinityScrollActive=!1}else this.isInfinityScrollActive=!1}else this.isInfinityScrollActive=!1}setupInfinityScroll(){this.btnLoadMore&&(this.observer&&this.observer.disconnect(),this.observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&!this.btnLoadMore.hasAttribute("disabled")&&this.btnLoadMore.click()})},{root:null,rootMargin:"0px",threshold:.1}),this.observer.observe(this.btnLoadMore))}toggleItemsVisibility(){this.btnLoadMore.dataset.href?this.btnLoadMore.style.display="":this.btnLoadMore.style.display="none"}async loadMoreItems(){this.btnLoadMore.setAttribute("disabled","true");const nextPageLink=this.btnLoadMore.dataset.href;if(!nextPageLink){this.btnLoadMore.removeAttribute("disabled");return}try{const nextPageText=await(await fetch(nextPageLink)).text(),nextPageHTML=new DOMParser().parseFromString(nextPageText,"text/html");let newGridContainer;this.gridType==="product"?newGridContainer=nextPageHTML.querySelector("#ProductGridContainer"):this.gridType==="collection"?newGridContainer=nextPageHTML.querySelector("#CollectionGridContainer"):this.gridType==="article"&&(newGridContainer=nextPageHTML.querySelector("#ArticleGridContainer"));const newGrid=newGridContainer?newGridContainer.querySelector(`#${this.gridType}-grid`):null;if(newGrid?this.appendContent(newGrid.innerHTML):console.warn(`New grid element (#${this.gridType}-grid) not found in fetched page.`),this.btnLoadMore=this.querySelector(".js-btn-load-more"),!this.btnLoadMore){console.error("Load More button disappeared after content append. Cannot continue.");return}const nextButtonOnNewPage=nextPageHTML.querySelector(".js-btn-load-more");if(nextButtonOnNewPage){const nextPageLinkNew=nextButtonOnNewPage.dataset.href;this.btnLoadMore.dataset.href=nextPageLinkNew}else this.btnLoadMore.dataset.href="";const currentUrl=new URL(window.location.href),currentUrlParams=new URLSearchParams(currentUrl.search),currentPage=parseInt(currentUrlParams.get("page"),10)||1;this.updateUrl(currentPage+1),this.updateItemCount(),this.toggleItemsVisibility(),this.isInfinityScrollActive&&this.setupInfinityScroll()}catch(error){console.error("Load more error:",error);const errorMessage=document.createElement("div");errorMessage.className="error-message p-4 bg-red-100 border border-red-400 text-red-700 rounded-md mt-4",errorMessage.textContent=`An error occurred: ${error.message}`,this.btnLoadMore.after(errorMessage),setTimeout(()=>errorMessage.remove(),5e3)}finally{this.btnLoadMore.removeAttribute("disabled")}}}customElements.define("dynamic-load-more",DynamicLoadMore)}if(!customElements.get("dynamic-load-previous")){class DynamicLoadPrevious extends DynamicLoad{constructor(){super(),this.btnLoadPrevious=this.querySelector(".js-btn-load-previous"),this.setProperties(),this.checkPageParameter(),window.addEventListener("shopify:section:load",()=>{this.setProperties(),this.checkPageParameter()}),this.updateItemCount(),this.btnLoadPrevious.addEventListener("click",e=>{e.preventDefault(),this.loadPreviousItems()})}checkPageParameter(){const currentUrl=new URL(window.location.href),currentUrlParams=new URLSearchParams(currentUrl.search);(parseInt(currentUrlParams.get("page"),10)||1)<=1?this.btnLoadPrevious.style.display="none":this.btnLoadPrevious.style.display=""}async loadPreviousItems(){this.btnLoadPrevious.setAttribute("disabled","true");const prevPageLink=this.btnLoadPrevious.dataset.href;if(!prevPageLink){this.btnLoadPrevious.removeAttribute("disabled");return}try{const prevPageText=await(await fetch(prevPageLink)).text(),prevPageHTML=new DOMParser().parseFromString(prevPageText,"text/html");let newGridContainer;this.gridType==="product"?newGridContainer=prevPageHTML.querySelector("#ProductGridContainer"):this.gridType==="collection"?newGridContainer=prevPageHTML.querySelector("#CollectionGridContainer"):this.gridType==="article"&&(newGridContainer=prevPageHTML.querySelector("#ArticleGridContainer"));const newGrid=newGridContainer?newGridContainer.querySelector(`#${this.gridType}-grid`):null;if(newGrid?this.appendContent(newGrid.innerHTML,!0):console.warn(`New grid element (#${this.gridType}-grid) not found in fetched page.`),this.btnLoadPrevious=this.querySelector(".js-btn-load-previous"),!this.btnLoadPrevious){console.error("Load Previous button disappeared after content prepend. Cannot continue.");return}const prevButtonOnNewPage=prevPageHTML.querySelector(".js-btn-load-previous");if(prevButtonOnNewPage){const prevPageLinkNew=prevButtonOnNewPage.dataset.href;this.btnLoadPrevious.dataset.href=prevPageLinkNew}else this.btnLoadPrevious.dataset.href="";const currentUrl=new URL(window.location.href),currentUrlParams=new URLSearchParams(currentUrl.search),currentPage=parseInt(currentUrlParams.get("page"),10)||1;this.updateUrl(currentPage-1),this.checkPageParameter(),this.updateItemCount()}catch(error){console.error("Load previous error:",error);const errorMessage=document.createElement("div");errorMessage.className="error-message p-4 bg-red-100 border border-red-400 text-red-700 rounded-md mt-4",errorMessage.textContent=`An error occurred: ${error.message}`,this.btnLoadPrevious.after(errorMessage),setTimeout(()=>errorMessage.remove(),5e3)}finally{this.btnLoadPrevious.removeAttribute("disabled")}}}customElements.define("dynamic-load-previous",DynamicLoadPrevious)}
2//# sourceMappingURL=/cdn/shop/t/191/assets/dynamic-load-more.js.map?v=165281040749989196601777692260

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.