PageSourceSearch

https://vbarbershop.com/cdn/shop/t/124/assets/recently-viewed.js?v=121502877790301438841785190618

js vbarbershop.com collected 2026-09-25 18:17:48 UTC 3,724 bytes, 2 lines download raw bytes

1class BtRecentlyViewedUtil{static init(){BtRecentlyViewedUtil.key=`recently_viewed-${Shopify.shop.replace(".myshopify.com","")}`,window.currentProduct&&BtRecentlyViewedUtil.addProduct(window.currentProduct.id,window.currentProduct.url,window.currentProduct.image)}static setArray(array){BtStorageUtil.set(BtRecentlyViewedUtil.key,array)}static getArray(){return BtStorageUtil.get(BtRecentlyViewedUtil.key,!0)||[]}static addProduct(productId,productUrl,productImage){let existProduct=BtRecentlyViewedUtil.getArray().filter(e=>e.product_id!=productId);existProduct.unshift({product_id:productId,url:productUrl,image:productImage}),existProduct.length>window.recentlyViewedLimit&&existProduct.pop(),BtRecentlyViewedUtil.setArray(existProduct)}static injectScriptTag(element){element.querySelectorAll("script").forEach(oldScriptTag=>{const newScriptTag=document.createElement("script");Array.from(oldScriptTag.attributes).forEach(attribute=>{newScriptTag.setAttribute(attribute.name,attribute.value)}),newScriptTag.appendChild(document.createTextNode(oldScriptTag.innerHTML)),oldScriptTag.parentNode.replaceChild(newScriptTag,oldScriptTag)})}}BtRecentlyViewedUtil.init();class RecentlyViewed extends HTMLElement{constructor(){super(),this.isEmpty=!0,this.updatedContent=!1,this.section=this.querySelector(".recently-viewed-products__section"),this.results=this.querySelector(".recently-viewed-products__results"),this.dataset.productId&&this.addProduct(this.dataset.productId,this.dataset.productUrl,this.dataset.productImage)}connectedCallback(){this.stop=Motion.inView(this,info=>{this.updateContent()})}disconnectedCallback(){this.stop&&this.stop()}addProduct(productId,productUrl,productImage){BtRecentlyViewedUtil.addProduct(productId,productUrl,productImage),this.updatedContent=!1}updateContent(){const itemList=BtRecentlyViewedUtil.getArray();if(itemList.length>0){const newIds=[];if(itemList.forEach(item=>{item.product_id!=this.dataset.productId&&newIds.push(`id:${item.product_id}`)}),!newIds.length){this.section.classList.add("hidden"),this.updatedContent=!0;return}const idsQuery=newIds.join(" OR ");fetch(`${window.routes.search_url}?section_id=recently-viewed-products-ajax&q=${idsQuery}&type="product"`).then(response=>response.text()).then(response=>{const html=new DOMParser().parseFromString(response,"text/html");this.hasAssets||(this.hasAssets=!0,document.body.appendChild(html.querySelector(".assets")),BtRecentlyViewedUtil.injectScriptTag(document.getElementById("recently-viewed-assets")));const sliderComponent=html.querySelector("slider-component");if(sliderComponent){if(this.dataset.inheritCardColorScheme=="false"&&this.dataset.colorScheme!=this.dataset.cardColorScheme){const colorSchemeClass=`color-${this.dataset.cardColorScheme}`;sliderComponent.querySelectorAll(".card-wrapper").forEach(e=>e.classList.add(colorSchemeClass,"card-wrapper--color-scheme"))}if(sliderComponent.setAttribute("data-outside-prev-button-id",this.dataset.prevButton),sliderComponent.setAttribute("data-outside-next-button-id",this.dataset.nextButton),this.dataset.fullWidth&&(sliderComponent.classList.add("page-width--full"),sliderComponent.classList.contains("has-slider"))){sliderComponent.classList.add("slider-component-full-width");const productGrid=sliderComponent.querySelector(".product-grid");productGrid.classList.contains("slider")&&productGrid.classList.add("grid--peek")}this.section.classList.remove("hidden"),this.results.innerHTML=="",this.results.appendChild(sliderComponent)}else this.section.classList.add("hidden")})}this.updatedContent=!0}}customElements.define("recently-viewed",RecentlyViewed);
2//# sourceMappingURL=/cdn/shop/t/124/assets/recently-viewed.js.map?v=121502877790301438841785190618

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.