PageSourceSearch

https://glitchproductions.store/cdn/shop/t/21/assets/cart-drawer.js?v=151509402542135656781759754464

js glitchproductions.store collected 2026-10-02 17:58:40 UTC 4,594 bytes, 2 lines download raw bytes

1class CartDrawer extends HTMLElement{constructor(){super(),this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.close()),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.setHeaderCartIconAccessibility()}setHeaderCartIconAccessibility(){const cartLink=document.querySelector("#cart-icon-bubble");cartLink&&(cartLink.setAttribute("role","button"),cartLink.setAttribute("aria-haspopup","dialog"),cartLink.addEventListener("click",event=>{event.preventDefault(),this.classList.contains("active")?this.close():this.open(cartLink)}),cartLink.addEventListener("keydown",event=>{event.code.toUpperCase()==="SPACE"&&(event.preventDefault(),this.classList.contains("active")?this.close():this.open(cartLink))}))}open(triggeredBy){triggeredBy&&this.setActiveElement(triggeredBy);const cartDrawerNote=this.querySelector('[id^="Details-"] summary');cartDrawerNote&&!cartDrawerNote.hasAttribute("role")&&this.setSummaryAccessibility(cartDrawerNote),setTimeout(()=>{this.classList.add("animate","active")}),this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.classList.contains("is-empty")?this.querySelector(".drawer__inner-empty"):document.getElementById("CartDrawer"),focusElement=this.querySelector(".drawer__inner")||this.querySelector(".drawer__close");trapFocus(containerToTrapFocusOn,focusElement)},{once:!0}),document.body.classList.add("overflow-hidden")}close(){this.classList.remove("active"),removeTrapFocus(this.activeElement),document.body.classList.remove("overflow-hidden")}setSummaryAccessibility(cartDrawerNote){cartDrawerNote.setAttribute("role","button"),cartDrawerNote.setAttribute("aria-expanded","false"),cartDrawerNote.nextElementSibling.getAttribute("id")&&cartDrawerNote.setAttribute("aria-controls",cartDrawerNote.nextElementSibling.id),cartDrawerNote.addEventListener("click",event=>{event.currentTarget.setAttribute("aria-expanded",!event.currentTarget.closest("details").hasAttribute("open"))}),cartDrawerNote.parentElement.addEventListener("keyup",onKeyUpEscape)}renderContents(parsedState){this.querySelector(".drawer__inner").classList.contains("is-empty")&&this.querySelector(".drawer__inner").classList.remove("is-empty"),this.productId=parsedState.id,this.getSectionsToRender().forEach(section=>{const sectionElement=section.selector?document.querySelector(section.selector):document.getElementById(section.id);sectionElement&&(sectionElement.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector))}),document.querySelector("nav[data-section-id]")&&(parsedState.item_count!==void 0?this.updateNavbarCartCount(parsedState.item_count):fetch("/cart.js").then(response=>response.json()).then(cart=>this.updateNavbarCartCount(cart.item_count)).catch(e=>console.error("Failed to fetch cart count:",e))),setTimeout(()=>{this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.open()})}getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}getSectionsToRender(){const sections=[{id:"cart-drawer",selector:"#CartDrawer"}];return document.querySelector("nav[data-section-id]")||sections.push({id:"cart-icon-bubble"}),sections}getSectionDOM(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector)}updateNavbarCartCount(itemCount){const navbarCart=document.querySelector("nav[data-section-id] #cart-icon-bubble")?.closest(".relative");if(!navbarCart)return;let badge=navbarCart.querySelector(".bg-\\[\\#ff4e4e\\]");itemCount>0?(badge||(badge=document.createElement("div"),badge.className="absolute -top-1 -right-1 bg-[#ff4e4e] rounded-full w-[18px] h-[18px] flex items-center justify-center",badge.innerHTML='<span class="font-bold text-white text-[11px] leading-[1.5]"></span>',navbarCart.appendChild(badge)),badge.querySelector("span").textContent=itemCount,badge.style.display="flex"):badge&&(badge.style.display="none")}setActiveElement(element){this.activeElement=element}}customElements.define("cart-drawer",CartDrawer);class CartDrawerItems extends CartItems{getSectionsToRender(){const sections=[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"}];return document.querySelector("nav[data-section-id]")||sections.push({id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"}),sections}}customElements.define("cart-drawer-items",CartDrawerItems);
2//# sourceMappingURL=/cdn/shop/t/21/assets/cart-drawer.js.map?v=151509402542135656781759754464

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.