PageSourceSearch

https://scrappyboy.com/cdn/shop/t/89/assets/component-recently-vie…?v=61162105486204269611766408402

js scrappyboy.com collected 2026-10-03 21:38:13 UTC 2,608 bytes, 2 lines download raw bytes

1(()=>{if(!customElements.get("recently-viewed-products")){class RecentlyViewedProducts extends HTMLElement{constructor(){super(),this.cacheDOMElements(),this.bindEventHandlers()}connectedCallback(){this.addEventListeners(),this.debouncedRenderRecentlyViewedProducts()}cacheDOMElements(){this.sectionId=this.getAttribute("data-wetheme-section-id"),this.isPreviewMode=this.getAttribute("data-is-preview-mode")=="true",this.wrapper=this.closest("data-recently-viewed-wrapper"),!this.sectionId||this.wrapper}bindEventHandlers(){this.debouncedRenderRecentlyViewedProductsBound=this.debouncedRenderRecentlyViewedProducts.bind(this)}addEventListeners(){window.Shopify.designMode&&document.addEventListener("shopify:section:load",this.debouncedRenderRecentlyViewedProductsBound)}debouncedRenderRecentlyViewedProducts(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>this.renderRecentlyViewedProducts(),100)}async renderRecentlyViewedProducts(){try{const recentlyViewedProducts=JSON.parse(localStorage.getItem("theme:recently-viewed-products")||"[]");if(!recentlyViewedProducts.length&&!this.isPreviewMode){this.wrapper.style.display="none";return}const items=new Set(recentlyViewedProducts);if(this.hasAttribute("exclude-id")&&items.delete(parseInt(this.getAttribute("exclude-id"))),!items.size&&!this.isPreviewMode){this.wrapper.style.display="none";return}const queryString=Array.from(items.values(),item=>`id:${item}`).slice(0,parseInt(this.getAttribute("data-products-to-show"))).join(" OR "),url=`${window.Shopify.routes.root}search?type=product&q=${queryString}&section_id=${this.sectionId}`,responseText=await(await fetch(url)).text(),tempDiv=document.createElement("div");tempDiv.innerHTML=responseText;const recentlyViewedProductsElement=tempDiv.querySelector("recently-viewed-products");recentlyViewedProductsElement&&recentlyViewedProductsElement.childElementCount>0?(this.replaceChildren(...recentlyViewedProductsElement.childNodes),window.eventBus.emit("recentlyViewed:updated")):this.isPreviewMode||(this.wrapper.style.display="none")}catch(e){console.error("Error fetching recently viewed products:",e),this.isPreviewMode||(this.wrapper.style.display="none")}}disconnectedCallback(){this.renderTimeout&&clearTimeout(this.renderTimeout),window.Shopify.designMode&&document.removeEventListener("shopify:section:load",this.debouncedRenderRecentlyViewedProductsBound)}}customElements.define("recently-viewed-products",RecentlyViewedProducts)}})();
2//# sourceMappingURL=/cdn/shop/t/89/assets/component-recently-viewed-products.js.map?v=61162105486204269611766408402

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.