PageSourceSearch

https://www.blaklader.com/cdn/shop/t/464/assets/sticky-add-to-cart.js?v=67392995230466322911786644649

js blaklader.com collected 2026-09-25 04:49:14 UTC 5,602 bytes, 2 lines download raw bytes

1import{t as e}from"./classPrivateMethodInitSpec-BPYNANpg.js";import{n as t,t as n}from"./classPrivateFieldGet2-CFIOuXdl.js";import{t as r}from"./assertClassBrand-Dh7UAh7K.js";import{t as i}from"./classPrivateFieldSet2-DNfdh3So.js";import{t as a}from"./defineProperty-CDrfZGhu.js";import{Component as o}from"@theme/component";import{onAnimationEnd as s}from"@theme/utilities";import{ThemeEvents as c}from"@theme/events";import{morph as l}from"@theme/morph";var u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakSet,b=new WeakMap,x=new WeakMap,S=new WeakMap,C=new WeakMap,w=new WeakMap,T=class extends o{constructor(...o){super(...o),e(this,y),a(this,`requiredRefs`,[`stickyBar`,`addToCartButton`,`quantityDisplay`,`quantityNumber`]),t(this,u,null),t(this,d,null),t(this,f,void 0),t(this,p,!1),t(this,m,null),t(this,h,new AbortController),t(this,g,null),t(this,_,1),t(this,v,!1),a(this,`handleAddToCartClick`,async()=>{var e;if(!n(g,this))return;let t=r(y,this,k).call(this),a=(t==null||(e=t.refs)==null?void 0:e.quantitySelector)??(t==null?void 0:t.querySelector(`quantity-selector-component`));if(a!=null&&a.canAddToCart&&!a.canAddToCart().canAdd){n(g,this).dataset.puppet=`true`,n(g,this).click(),requestAnimationFrame(()=>{n(g,this)&&(n(g,this).dataset.puppet=`false`)});return}n(g,this).dataset.puppet=`true`,n(g,this).click();let o=document.querySelector(`.header-actions__cart-icon`);if(this.refs.addToCartButton.dataset.added!==`true`&&(this.refs.addToCartButton.dataset.added=`true`),!o||!this.refs.addToCartButton||!this.refs.productImage)return;n(f,this)&&clearTimeout(n(f,this));let c=document.createElement(`fly-to-cart`);c.classList.add(`fly-to-cart--sticky`),c.style.setProperty(`background-image`,`url(${this.refs.productImage.src})`),c.useSourceSize=`true`,c.source=this.refs.productImage,c.destination=o,document.body.appendChild(c),await s([this.refs.addToCartButton,c]),i(f,this,setTimeout(()=>{this.refs.addToCartButton.removeAttribute(`data-added`)},800))}),t(this,b,e=>{if(e.detail.data.productId!==this.dataset.productId)return;let t=e.detail.resource,a=e.detail.data.html.querySelector(`sticky-add-to-cart`);if(!a)return;let o=a.querySelector(`[ref="stickyBar"]`);if(!o)return;let s=this.refs.stickyBar.getAttribute(`data-stuck`)||`false`,c=a.dataset.variantAvailable;l(this.refs.stickyBar,o,{childrenOnly:!0}),this.refs.stickyBar.setAttribute(`data-stuck`,s),this.dataset.variantAvailable=c,t&&t.id&&(this.dataset.currentVariantId=t.id);let u=r(y,this,k).call(this);u&&i(g,this,u.querySelector(`[ref="addToCartButton"]`)),t??n(S,this).call(this),r(y,this,j).call(this)}),t(this,x,e=>{var t;let n=(t=e.detail.resource)==null?void 0:t.id;n&&(this.dataset.currentVariantId=n)}),t(this,S,()=>{this.dataset.currentVariantId=``;let e=this.querySelector(`.sticky-add-to-cart__variant`),t=this.dataset.productId,n=document.querySelector(`variant-picker[data-product-id="${t}"]`);if(!e||!n)return;let r=Array.from(n.querySelectorAll(`input:checked`)).map(e=>e.value).filter(e=>e!==``).join(` / `);r&&(e.textContent=r)}),t(this,C,()=>{n(g,this)&&(n(g,this).dataset.puppet=`false`)}),t(this,w,e=>{e.detail.cartLine||(i(_,this,e.detail.quantity),r(y,this,j).call(this))})}connectedCallback(){super.connectedCallback(),r(y,this,E).call(this);let{signal:e}=n(h,this),t=this.closest(`.shopify-section`);t==null||t.addEventListener(c.variantUpdate,n(b,this),{signal:e}),t==null||t.addEventListener(c.variantSelected,n(x,this),{signal:e}),document.addEventListener(c.cartUpdate,n(C,this),{signal:e}),document.addEventListener(c.cartError,n(C,this),{signal:e}),document.addEventListener(c.quantitySelectorUpdate,n(w,this),{signal:e}),r(y,this,A).call(this)}disconnectedCallback(){var e,t;super.disconnectedCallback(),(e=n(u,this))==null||e.disconnect(),(t=n(d,this))==null||t.disconnect(),n(h,this).abort(),n(m,this)&&clearTimeout(n(m,this))}};function E(){let e=r(y,this,k).call(this);if(!e)return;let t=e.closest(`.buy-buttons-block`);if(!t)return;let a=document.querySelector(`footer`)??document.querySelector(`[class*="footer-group"]`);a&&(i(u,this,new IntersectionObserver(e=>{let[t]=e;if(t)if(!t.isIntersecting&&!n(p,this)){let e=t.target.getBoundingClientRect();(e.bottom<0||e.top<0)&&r(y,this,D).call(this)}else t.isIntersecting&&n(p,this)&&(i(v,this,!1),r(y,this,O).call(this))})),i(d,this,new IntersectionObserver(e=>{let[a]=e;if(a){if(a.isIntersecting&&n(p,this))i(v,this,!0),r(y,this,O).call(this);else if(!a.isIntersecting&&n(v,this)){let e=t.getBoundingClientRect();(e.bottom<0||e.top<0)&&(i(v,this,!1),r(y,this,D).call(this))}}},{rootMargin:`200px 0px 0px 0px`})),n(u,this).observe(t),n(d,this).observe(a),i(g,this,e.querySelector(`[ref="addToCartButton"]`)))}function D(){let{stickyBar:e}=this.refs;i(p,this,!0),e.dataset.stuck=`true`}function O(){let{stickyBar:e}=this.refs;i(p,this,!1),e.dataset.stuck=`false`}function k(){let e=this.dataset.productId;if(!e)return null;let t=this.closest(`.shopify-section`);if(!t)return null;let n=t.id.replace(`shopify-section-`,``);return document.querySelector(`#shopify-section-${n} product-form-component[data-product-id="${e}"]`)}function A(){i(_,this,parseInt(this.dataset.initialQuantity||`1`)||1),r(y,this,j).call(this)}function j(){let{addToCartButton:e,quantityDisplay:t,quantityNumber:r}=this.refs,i=!e.disabled;r.textContent=n(_,this).toString(),i&&n(_,this)>1?t.style.display=`inline`:t.style.display=`none`}customElements.get(`sticky-add-to-cart`)||customElements.define(`sticky-add-to-cart`,T);
2//# sourceMappingURL=sticky-add-to-cart.js.map

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.