PageSourceSearch

https://museumstore.hmns.org/cdn/shop/t/40/assets/section-recently-viewed.js?v=55908193119123770971789141459

js hmns.org collected 2026-10-01 10:25:16 UTC 1,758 bytes, 2 lines download raw bytes

1import{hasLocalStorage}from"@archetype-themes/utils/storage";let recentlyViewedIds=[];if(hasLocalStorage()){const recentIds=localStorage.getItem("recently-viewed");recentIds&&typeof recentIds!==void 0&&(recentlyViewedIds=JSON.parse(recentIds))}class RecentlyViewed extends HTMLElement{constructor(){super(),this.initialized=!1,this.sectionId=this.getAttribute("data-section-id"),this.maxProducts=this.getAttribute("data-max-products"),this.init()}addIdToRecentlyViewed(id){id&&(recentlyViewedIds.includes(id)&&recentlyViewedIds.splice(recentlyViewedIds.indexOf(id),1),recentlyViewedIds.unshift(id),hasLocalStorage()&&localStorage.setItem("recently-viewed",JSON.stringify(recentlyViewedIds)))}init(){if(this.addIdToRecentlyViewed(this.dataset.productId),this.initialized)return;if(this.initialized=!0,!recentlyViewedIds.length){this.classList.add("hide");return}this.outputContainer=this.querySelector(`#RecentlyViewed-${this.sectionId}`);const currentId=this.getAttribute("data-product-id");let url=`${window.Shopify.routes.root}search?view=recently-viewed&type=product&q=`,products="",i=0;recentlyViewedIds.forEach(val=>{val!==currentId&&(i>=this.maxProducts||(products+=`id:${val} OR `,i++))}),url=url+encodeURIComponent(products),fetch(url).then(response=>response.text()).then(text=>{const html=document.createElement("div");if(html.innerHTML=text,html.querySelectorAll(".grid-product").length>0){const results=html.querySelector(".product-grid");this.outputContainer.append(results)}else this.classList.add("hide")}).catch(e=>{console.error(e)})}disconnectedCallback(){this.initialized=!1}}customElements.define("recently-viewed",RecentlyViewed);
2//# sourceMappingURL=/cdn/shop/t/40/assets/section-recently-viewed.js.map?v=55908193119123770971789141459

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.