PageSourceSearch

https://northspore.com/cdn/shop/t/221/assets/product-card-BtPTkcB8.js

js northspore.com collected 2026-09-25 18:20:52 UTC 4,959 bytes, 1 lines download raw bytes

1document.addEventListener("alpine:init",()=>{const f=n=>`/products/${n}?view=ajax&sections[]=product-ajax`,h=()=>{typeof window.jdgm?.batchRenderBadges=="function"&&window.requestAnimationFrame(()=>{window.jdgm.batchRenderBadges()})};Alpine.data("productCard",n=>{const m=n,p=window.Collection?.handle,s=window.Products[n];if(!s)return console.error(`Product data not found for handle: ${n}`),{};const u=s.product||s,g=s?.metafields||{},v=s?.coupon||{};if(!u.variants||u.variants.length===0)return console.error(`No variants found for product: ${n}`),{};const P=u.variants[0],d=(t,o)=>{const e=new URLSearchParams;o&&e.set("variant",o);const r=e.toString();return`${p?`/collections/${p}`:""}/products/${t}${r?`?${r}`:""}`};return{originalHandle:m,currentProductHandle:n,currentProduct:u,metafields:g,coupon:v,selectedVariantId:P.id,productUrl:d(u.handle,P.id),currentImage:"",reviewsCount:0,reviewsAverage:0,reviewsPercentage:0,formattedPrice:"",formattedComparePrice:"",isOnSale:!1,currentComparePrice:0,couponEligible:!1,couponSavingsText:"",couponPercentText:"",couponAppliedText:"",couponBadgeTemplateHandle:"pdf_default",couponSource:"",couponMatchedCollectionHandle:"",couponMatchedProductHandle:"",selectedVariantHasPreorder:!1,init(){this.updateProductDisplay(),h()},updateProductDisplay(){const t=this.currentProduct.variants.find(l=>l.id==this.selectedVariantId),o=t?.featured_image||this.currentProduct.featured_image;this.currentImage=o?`${o.src||o}?width=648&height=648`:"";const e=this.metafields?.reviews;this.reviewsCount=parseInt(e?.count||0),this.reviewsAverage=parseFloat(e?.rating||0),this.reviewsPercentage=this.reviewsAverage/5*100;const r=t?.price||this.currentProduct.price,a=t?.compare_at_price||this.currentProduct.compare_at_price,i=Number(this.coupon?.discountPercentage||0),c=Math.floor(r*i/100);this.isOnSale=!!(a&&a>r),this.couponEligible=!!(this.coupon?.eligible&&i>0&&c>0),this.couponBadgeTemplateHandle=this.coupon?.badgeTemplateHandle||"pdf_default",this.couponSource=this.coupon?.source||"",this.couponMatchedCollectionHandle=this.coupon?.matchedCollectionHandle||"",this.couponMatchedProductHandle=this.coupon?.matchedProductHandle||"",this.couponBadgeText=this.coupon?.badgeText||"",this.couponEligible?(this.currentComparePrice=r,this.formattedPrice=this.formatPrice(r-c),this.formattedComparePrice=this.formatPrice(r),this.couponSavingsText=`Save ${this.formatPrice(c)}`,this.couponPercentText=`${i}% OFF`,this.couponAppliedText=this.coupon?.appliedCheckoutText||`${i}% coupon applied to order at checkout`):(this.currentComparePrice=this.isOnSale?a:0,this.formattedPrice=this.formatPrice(r),this.formattedComparePrice=this.currentComparePrice>0?this.formatPrice(this.currentComparePrice):"",this.couponSavingsText="",this.couponPercentText="",this.couponAppliedText="",this.couponBadgeText=""),this.selectedVariantHasPreorder=this.checkVariantPreorder(this.selectedVariantId),this.productUrl=d(this.currentProduct.handle,this.selectedVariantId),h()},getVariantImage(t){const o=this.currentProduct.variants.find(r=>r.id==t);return(o?.featured_image?o.featured_image:this.currentProduct.featured_image)?.src},getVariantUrl(t){return this.currentProduct.variants.find(e=>e.id==t)?d(this.currentProduct.handle,t):d(this.currentProduct.handle)},getVariantName(t){return this.currentProduct.variants.find(e=>e.id==t)?.title?.trim()??""},getVariantTitle(t){return!t||this.currentProduct.variants.length<=1?null:this.currentProduct.variants.find(e=>e.id==t)?.title||this.currentProduct.title},getVariantPrice(t){return this.currentProduct.variants.find(e=>e.id==t)?.price||this.currentProduct.price},formatPrice(t){return t==null?"":window.NSMoney?window.NSMoney.format(t):`$${(t/100).toFixed(2)}`},updateVariant(t){this.selectedVariantId=t,this.updateProductDisplay()},checkVariantPreorder(t){const e=this.currentProduct.variants.find(i=>i.id==t)?.selling_plan_allocations;if(!e||e.length===0)return!1;const r=this.currentProduct.selling_plan_groups;if(!r||r.length===0)return!1;const a=new Set(e.map(i=>String(i.selling_plan_group_id)));return r.some(i=>a.has(String(i.id))&&i.app_id==="timesact")},swapProduct(t,o=null){const e=window.Products[t];if(!e){fetch(f(t)).then(r=>{if(!r.ok)throw new Error("Network response was not ok");return r.json()}).then(r=>{const c=new DOMParser().parseFromString(r["product-ajax"],"text/html").querySelector('script[type="application/json"]');if(!c)throw new Error("Product JSON data not found in fetched section");const l=JSON.parse(c.textContent);window.Products[t]=l,this.swapProduct(t,o)}).catch(r=>{console.error(`Failed to fetch product data for handle: ${t}`,r)});return}this.currentProduct=e.product||e,this.currentProductHandle=t,this.metafields=e.metafields||{},this.coupon=e.coupon||{},o?this.selectedVariantId=o:this.currentProduct.variants&&this.currentProduct.variants.length>0&&(this.selectedVariantId=this.currentProduct.variants[0].id),this.updateProductDisplay()}}})});

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.