PageSourceSearch

https://www.sunspel.com/cdn/shop/t/532/assets/product-fixed-bar.js?v=22460210540144186871789479914

js sunspel.com collected 2026-09-24 17:57:37 UTC 3,552 bytes, 2 lines download raw bytes

1class ProductFixedBar extends window.BAO.CustomElement(){static get requiredExternalElements(){return["pdp-add-to-cart-button"]}connectedCallback(){super.connectedCallback(),this.setupObserver()}setupObserver(){const targetEl=this.externalEls["pdp-add-to-cart-button"]?.element;targetEl&&(this.isVisible=!1,this.observer=new IntersectionObserver(([entry])=>{const ctaIsAboveViewport=!entry.isIntersecting&&entry.boundingClientRect.top<0;this.isVisible=ctaIsAboveViewport},{root:null,rootMargin:"0px",threshold:0}),this.observer.observe(targetEl))}setupListeners(){super.setupListeners();const button=this.els?.button?.element;!button||!button.getAttribute("form")||(button.hasAttribute("disabled")&&button.hasAttribute("data-selection-required")&&(button.removeAttribute("disabled"),button.setAttribute("aria-disabled","true")),this.variantAvailable=!button.hasAttribute("data-selection-required")&&!button.hasAttribute("disabled"),this.onVariantChange=this.onVariantChange.bind(this),window.BAO.eventBus.addEventListener(window.BAO.EVENTS.VARIANT.CHANGE,this.onVariantChange),this.listeners.add(button,"click",e=>{if(this.variantAvailable)return;e.preventDefault(),e.stopPropagation();const variants=this.externalEls.variants?.element;if(!variants)return;const headerOffset=this.externalEls.header?.element?this.externalEls.header.element.offsetHeight:0,offsetPosition=variants.getBoundingClientRect().top+window.scrollY-headerOffset;window.scrollTo({top:offsetPosition,behavior:"smooth"})}),this.setupDrawerObserver())}setupDrawerObserver(){const fixedBarEl=this.els["fixed-bar"]?.element,cartDrawer=this.externalEls["cart-drawer"]?.element;if(!cartDrawer||!fixedBarEl)return;const syncDrawerState=()=>{const isOpen=cartDrawer.classList.contains("drw-Drawer-active");fixedBarEl.setAttribute("data-drawer-open",isOpen?"true":"false")};this.drawerObserver=new MutationObserver(syncDrawerState),this.drawerObserver.observe(cartDrawer,{attributes:!0,attributeFilter:["class"]}),syncDrawerState()}onVariantChange(e){const variant=e.detail?.variant,isAvailable=variant?.data?.available===!0,hasId=variant?.data?.id!==void 0;this.variantAvailable=isAvailable&&hasId;const button=this.els?.button?.element;button&&(isAvailable&&hasId?(button.removeAttribute("disabled"),button.removeAttribute("aria-disabled"),button.removeAttribute("data-selection-required")):hasId?(button.setAttribute("disabled",""),button.removeAttribute("aria-disabled"),button.removeAttribute("data-selection-required")):(button.removeAttribute("disabled"),button.setAttribute("aria-disabled","true"),button.setAttribute("data-selection-required","")))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&this.observer.disconnect(),this.drawerObserver&&this.drawerObserver.disconnect(),this.onVariantChange&&window.BAO.eventBus.removeEventListener(window.BAO.EVENTS.VARIANT.CHANGE,this.onVariantChange),this.isVisible=!1}get isVisible(){return document.body.classList.contains(this.visibleClass)}set isVisible(val){val?document.body.classList.add(this.visibleClass):document.body.classList.remove(this.visibleClass)}get visibleClass(){return this.dataset.visibleClass||"is-FixedBar-visible"}getScrollOffset(){if(this.dataset.scrollOffset)return parseInt(this.dataset.scrollOffset,10);const header=this.externalEls?.header?.element;return header?header.offsetHeight:0}}customElements.get("product-fixed-bar")||customElements.define("product-fixed-bar",ProductFixedBar);
2//# sourceMappingURL=/cdn/shop/t/532/assets/product-fixed-bar.js.map?v=22460210540144186871789479914

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.