PageSourceSearch

https://scrappyboy.com/cdn/shop/t/89/assets/component-product-reco…?v=37435132274450696911766408402

js scrappyboy.com collected 2026-10-03 21:38:12 UTC 5,108 bytes, 2 lines download raw bytes

1(()=>{"use strict";class Component{constructor(theme,element){this.theme=theme,this.element=element,theme.registerComponent(this)}onWindowResizeRaw=({width})=>{};onWindowResize=({width,oldWidth,breakpoint})=>{};onWindowResizeBreakpoint=({width,breakpoint,oldBreakpoint})=>{};onWindowScroll=()=>{}}class QuickAdd extends Component{constructor(theme,element){super(theme,element),this.theme=theme,this.element=element,this.onSubmit=this.onSubmit.bind(this),this.cartAction=document.getElementById("PageContainer").dataset.cartAction,this.cartType=document.getElementById("PageContainer").dataset.cartType,this.languageUrl=document.getElementById("PageContainer").dataset.languageUrl,this.formWrappers=this.element.querySelectorAll(".quick-add-wrapper.is-singular"),this.wethemeGlobal=document.querySelector("script#wetheme-global"),this.translationsObject=JSON.parse(this.wethemeGlobal.textContent),this.formWrappers.length&&this.formWrappers.forEach(wrapper=>{const form=wrapper.querySelector(".shopify-product-form");form&&form.addEventListener("submit",this.onSubmit)})}async onSubmit(e){if(this.cartType=="page"&&this.cartAction!="show_added_message")return;e.preventDefault();const currentForm=e.currentTarget,currentButton=currentForm.querySelector(".quick-add-button"),productWrapper=currentForm.closest(".quick-add-wrapper.is-singular");if(!productWrapper)return console.error("Product wrapper not found."),!1;const liveRegion=currentForm.querySelector('.sr-only[aria-live="polite"]');this.isDesktopQuickAdd=currentButton.classList.contains("quick-add-button-desktop"),this.isDesktopQuickAdd&&(currentButton.classList.add("is-loading"),currentButton.innerHTML=`<svg viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg" width="1.6em" height="1.6em" class="spin flex-full"><g clip-path="url(#clip0_3605_47041)"><path d="M12.5 23C6.42487 23 1.5 18.0751 1.5 12C1.5 5.92487 6.42487 1 12.5 1C18.5751 1 23.5 5.92487 23.5 12C23.5 15.1767 22.1534 18.0388 20 20.0468" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></g><defs><clipPath id="clip0_3605_47041"><rect width="24" height="24" fill="none" transform="translate(0.5)"/></clipPath></defs>${this.translationsObject.translations.loading}</svg>`);try{const formData=new FormData(currentForm),data=new URLSearchParams(formData).toString(),response=await window.fetch("/cart/add.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:data});if(!response.ok)return!1;if(this.cartType=="drawer"){const responseJson=await response.json();window.eventBus.emit("update:cart:drawer",responseJson)}const languageParam=!this.languageUrl||this.languageUrl=="/"?"":this.languageUrl,response2=await window.fetch(`${languageParam}/cart?view=compare`);if(!response2.ok)return!1;const cart=await response2.json();if(this.cartType=="drawer"&&this.cartAction=="go_to_or_open_cart"?window.eventBus.emit("open:cart:drawer",{scrollToTop:!0}):this.isDesktopQuickAdd&&(currentButton.classList.remove("is-loading"),currentButton.innerHTML=this.translationsObject.translations.productAdded),this.cartType=="drawer"){const successMessage=productWrapper.getAttribute("data-product-added");liveRegion&&successMessage&&(liveRegion.textContent=successMessage)}this.theme.updateCartCount(cart),this.isDesktopQuickAdd&&setTimeout(()=>{const translationKey=currentButton.dataset.addToCartTranslationKey||"addToCart";currentButton.classList.remove("is-loading"),currentButton.innerHTML=this.translationsObject.translations[translationKey]},2e3)}catch(e2){console.error("Unable to add to cart: ",e2)}return!1}}class productRecommendations extends HTMLElement{constructor(){super(),this.isAlreadyLoaded=this.querySelector(".product-page-related-products")}connectedCallback(){this.init()}init(){this.isAlreadyLoaded&&this.isAlreadyLoaded.remove(),window.wetheme.webcomponentRegistry.register({key:"product-recommendations"});const handleIntersection=(entries,observer)=>{entries[0].isIntersecting&&(observer.unobserve(this),fetch(this.dataset.recommendationsUrl).then(response=>response.text()).then(text=>{var container=document.createElement("div");container.innerHTML=text;const recommendations=container.querySelector("product-recommendations");
1if(recommendations&&recommendations.innerHTML.trim().length){this.innerHTML=recommendations.innerHTML,window.wetheme.addBadges(this,1e3),this.quickAddButtons=new QuickAdd(window.wetheme,this);const sectionLoadedEvent=new CustomEvent("theme:section:load",{detail:{sectionId:this.dataset.sectionId}});document.dispatchEvent(sectionLoadedEvent);const recommendationsLoadedEvent=new CustomEvent("recommendations:loaded");document.dispatchEvent(recommendationsLoadedEvent)}}).catch(e=>{console.error(e)}))};new IntersectionObserver(handleIntersection.bind(this),{rootMargin:"0px 0px 0px 0px"}).observe(this)}isMobile=()=>window.matchMedia("(max-width: 1023px)").matches}customElements.define("product-recommendations",productRecommendations)})();
2//# sourceMappingURL=/cdn/shop/t/89/assets/component-product-recommendations.js.map?v=37435132274450696911766408402

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.