PageSourceSearch

https://www.skinnydiplondon.com/cdn/shop/t/914/assets/collection-g…?v=176141445877731693521787651064

js skinnydiplondon.com collected 2026-09-24 08:44:21 UTC 2,676 bytes, 2 lines download raw bytes

1class GridSwitcher extends window.BAO.CustomElement(){connectedCallback(){super.connectedCallback(),this.buttonSelector="button[data-grid-switcher-el][data-grid-view]",this.activeClass="clc-ProductGrid_GridButton-active",this.gridClasses={single:"prd-List_Items-single",small:"prd-List_Items-small",medium:"prd-List_Items-medium",large:"prd-List_Items-large"},this.applyInitialFromActiveButton(),this.watchForRerenders()}disconnectedCallback(){super.disconnectedCallback(),this.observer?.disconnect()}get productListEl(){return this.cachedProductListEl?.isConnected?this.cachedProductListEl:(this.cachedProductListEl=this.externalEls?.productList?.element||this.closest("[data-collection-root]")?.querySelector(".prd-List_Items")||document.querySelector(".prd-List_Items"),this.cachedProductListEl)}watchForRerenders(){const target=this.closest(".clc-ProductGrid")||document.body;this.observer=new MutationObserver(()=>{if(!this.currentLayout)return;const productListEl=this.productListEl;if(!productListEl)return;const cls=this.gridClasses[this.currentLayout];!cls||productListEl.classList.contains(cls)||this.updateGridClass(this.currentLayout)}),this.observer.observe(target,{childList:!0,subtree:!0})}setupListeners(){super.setupListeners(),this.listeners.add(this,"click",evt=>{const trigger=evt.target.closest(this.buttonSelector);!trigger||!this.contains(trigger)||(trigger.tagName==="BUTTON"&&!trigger.getAttribute("type")&&trigger.setAttribute("type","button"),evt.preventDefault(),this.handleGridSwitch(trigger))})}applyInitialFromActiveButton(){const activeBtn=this.querySelector(`${this.buttonSelector}.${this.activeClass}`),fallbackBtn=this.querySelector(this.buttonSelector),btn=activeBtn||fallbackBtn;if(!btn)return;const layout=btn.dataset.gridView;layout&&this.updateGridClass(layout)}async handleGridSwitch(btn){const layout=btn?.dataset?.gridView;if(layout){this.toggleActiveButton(btn),this.updateGridClass(layout);try{await window.BAO.Cart.updateCartAttributes({"grid-layout":layout})}catch(e){console.warn("Failed to update cart attributes:",e)}}}toggleActiveButton(activeBtn){this.querySelectorAll(this.buttonSelector).forEach(b=>b.classList.toggle(this.activeClass,b===activeBtn))}updateGridClass(layout){this.currentLayout=layout;const productListEl=this.productListEl;if(!productListEl)return;Object.values(this.gridClasses).forEach(cls2=>productListEl.classList.remove(cls2));const cls=this.gridClasses[layout];cls&&productListEl.classList.add(cls)}}customElements.get("grid-switcher")||customElements.define("grid-switcher",GridSwitcher);
2//# sourceMappingURL=/cdn/shop/t/914/assets/collection-grid-switcher.js.map?v=176141445877731693521787651064

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.