PageSourceSearch

https://piratecampco.com.au/cdn/shop/t/81/assets/cart-drawer.js?v=96670681833512806041790796297

js piratecampco.com.au collected 2026-10-04 05:10:35 UTC 4,606 bytes, 2 lines download raw bytes

1if(!customElements.get("cart-drawer")){class CartDrawer extends HTMLElement{constructor(){super(),this.isInitialized=!1,this.setHeaderCartIconAccessibility()}init(){this.isInitialized||(window.loadTemplateContent(this),requestAnimationFrame(()=>{this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.close()),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.moveCssLinks(),this.isInitialized=!0}))}reload(){const sections=this.getSectionsToRender().map(section=>section.id);fetch(`?sections=${sections}`).then(response=>response.json()).then(response=>{this.renderContents({sections:{...response}},!0)}).catch(e=>{console.error(e)})}moveCssLinks(){this.querySelectorAll('link[rel="stylesheet"][href*=".css"]').forEach(link=>{const href=link.href;if(!document.head.querySelector(`link[href="${href}"]`)){const newLink=link.cloneNode(!0);document.head.appendChild(newLink)}})}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.open(cartLink)}),cartLink.addEventListener("keydown",event=>{event.code.toUpperCase()==="SPACE"&&(event.preventDefault(),this.open(cartLink))}))}open(triggeredBy){this.init(),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.removeDeleteTabIndex(),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),publish(PUB_SUB_EVENTS.cartOpen)},{once:!0}),document.body.classList.add("overflow-hidden")}close(){this.classList.remove("active"),removeTrapFocus(this.activeElement),document.body.classList.remove("overflow-hidden"),publish(PUB_SUB_EVENTS.cartClose)}removeDeleteTabIndex(){this.querySelectorAll(".cart-remove-button").forEach(button=>{button.removeAttribute("tabindex")})}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,preventOpen=!1){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))}),setTimeout(()=>{window.loadTemplateContent(this),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this))}),this.removeDeleteTabIndex(),theme.settings.cartDrawer.atcAction==="drawer"&&!preventOpen&&setTimeout(()=>{this.open()})}getSectionInnerHTML(html,selector=".shopify-section"){return html=html.replace(/<template\b[^>]*>|<\/template>/g,""),new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}getSectionsToRender(){return[{id:"cart-drawer",selector:"#CartDrawer"},{id:"cart-icon-bubble"}]}getSectionDOM(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector)}setActiveElement(element){this.activeElement=element}}customElements.define("cart-drawer",CartDrawer)}customElements.get("cart-drawer-items")||customElements.whenDefined("cart-items").then(()=>{class CartDrawerItems extends CartItems{getSectionsToRender(){return[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"}]}}customElements.define("cart-drawer-items",CartDrawerItems)});
2//# sourceMappingURL=/cdn/shop/t/81/assets/cart-drawer.js.map?v=96670681833512806041790796297

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.