PageSourceSearch

https://drinkhappyviking.com/cdn/shop/t/222/assets/nss-cart-drawer.js?v=133194837871624435801786644262

js drinkhappyviking.com collected 2026-09-28 10:06:44 UTC 8,327 bytes, 2 lines download raw bytes

1(function(modules,entry,mainEntry,parcelRequireName,globalName){var globalObject=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},previousRequire=typeof globalObject[parcelRequireName]=="function"&&globalObject[parcelRequireName],cache=previousRequire.cache||{},nodeRequire=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);function newRequire(name,jumped){if(!cache[name]){if(!modules[name]){var currentRequire=typeof globalObject[parcelRequireName]=="function"&&globalObject[parcelRequireName];if(!jumped&&currentRequire)return currentRequire(name,!0);if(previousRequire)return previousRequire(name,!0);if(nodeRequire&&typeof name=="string")return nodeRequire(name);var err=new Error("Cannot find module '"+name+"'");throw err.code="MODULE_NOT_FOUND",err}localRequire.resolve=resolve,localRequire.cache={};var module2=cache[name]=new newRequire.Module(name);modules[name][0].call(module2.exports,localRequire,module2,module2.exports,this)}return cache[name].exports;function localRequire(x){var res=localRequire.resolve(x);return res===!1?{}:newRequire(res)}function resolve(x){var id=modules[name][1][x];return id??x}}function Module(moduleName){this.id=moduleName,this.bundle=newRequire,this.exports={}}newRequire.isParcelRequire=!0,newRequire.Module=Module,newRequire.modules=modules,newRequire.cache=cache,newRequire.parent=previousRequire,newRequire.register=function(id,exports2){modules[id]=[function(require,module2){module2.exports=exports2},{}]},Object.defineProperty(newRequire,"root",{get:function(){return globalObject[parcelRequireName]}}),globalObject[parcelRequireName]=newRequire;for(var i=0;i<entry.length;i++)newRequire(entry[i]);if(mainEntry){var mainExports=newRequire(mainEntry);typeof exports=="object"&&typeof module<"u"?module.exports=mainExports:typeof define=="function"&&define.amd?define(function(){return mainExports}):globalName&&(this[globalName]=mainExports)}})({"7X3qK":[function(require,module2,exports2){class NSSCartDrawer extends HTMLElement{constructor(){super(),this.debug=!1,this.initialized=!1,this.lastActiveTrigger=null,this.focusTrapActive=!1,this.focusableSelector=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(","),this.handleTrapKeydown=this.handleTrapKeydown.bind(this)}connectedCallback(){if(this.debug&&console.log("[NSS] Cart Drawer connected."),this.initialized){this.debug&&console.log("[NSS] Cart Drawer already initialized, skipping.");return}this.initialized=!0,this.initCartDrawer(),this.syncDialogLabel(),this.setDialogOpenState(!1),this.sectionSelectHandler=e=>{const targetChildEl=e.target.querySelector("nss-cart-drawer"),popUpStatus=document.documentElement.getAttribute("nss-pop-up-open");targetChildEl===this?(this.debug&&console.log("[NSS] Editing cart drawer!"),this.openCart(),setTimeout(()=>{window.scrollTo(0,0)},500)):(this.closeCart(!1),popUpStatus==="false"&&document.documentElement.setAttribute("nss-overlay-open",!1))},document.addEventListener("shopify:section:select",this.sectionSelectHandler),window.NSS_OPEN_CART_DRAWER=()=>{this.openCart()},window.NSS_CLOSE_CART_DRAWER=()=>{this.closeCart()}}disconnectedCallback(){if(this.sectionSelectHandler&&document.removeEventListener("shopify:section:select",this.sectionSelectHandler),this.overlayClickHandler){const overlayEl=document.querySelector("nss-overlay");overlayEl&&overlayEl.removeEventListener("click",this.overlayClickHandler)}this.deactivateFocusTrap(!1),this.cartToggleHandlers&&this.cartToggleHandlers.forEach(({element,handler})=>{element.removeEventListener("click",handler)}),this.initialized=!1,this.debug&&console.log("[NSS] Cart Drawer disconnected and cleaned up.")}async openCart(triggerElement=null){document.documentElement.setAttribute("nss-cart-drawer-open",!0),document.documentElement.setAttribute("nss-overlay-open",!0),this.setDialogOpenState(!0),this.activateFocusTrap(triggerElement);const cart=await(await fetch("/cart.js")).json();this.announceCartOpened(cart.item_count||0),Shopify.analytics.publish("custom_cart_viewed",{data:cart}),this.debug&&console.log("[NSS] Cart Drawer opened.")}closeCart(restoreFocus=!0){document.documentElement.setAttribute("nss-cart-drawer-open",!1),document.documentElement.setAttribute("nss-overlay-open",!1),this.setDialogOpenState(!1),this.deactivateFocusTrap(restoreFocus),this.debug&&console.log("[NSS] Cart Drawer closed.")}setDialogOpenState(isOpen){this.setAttribute("aria-hidden",isOpen?"false":"true")}syncDialogLabel(){const titleId=this.querySelector("nss-cart-template")?.getAttribute("nss-cart-dialog-title-id");titleId&&(this.setAttribute("aria-labelledby",titleId),this.removeAttribute("aria-label"))}announceCartOpened(itemCount){const statusEl=this.querySelector("[nss-cart-status]");if(!statusEl)return;const noun=itemCount===1?"item":"items",message=`${window.NSS_CART_OPEN_ANNOUNCEMENT||""} Cart opened. ${itemCount} ${noun} in your cart.`.trim();statusEl.textContent=message,window.NSS_CART_OPEN_ANNOUNCEMENT=""}async toggleCart(triggerElement=null){document.documentElement.getAttribute("nss-cart-drawer-open")==="true"?this.closeCart():await this.openCart(triggerElement)}getFocusableElements(){return[...this.querySelectorAll(this.focusableSelector)].filter(el=>
1{if(el.hasAttribute("disabled")||el.getAttribute("aria-hidden")==="true")return!1;const style=window.getComputedStyle(el);return!(style.display==="none"||style.visibility==="hidden")})}focusInitialElement(){const closeButton=this.querySelector(".nss-cart__header button[nss-open-cart-drawer]");if(closeButton){closeButton.focus({preventScroll:!0});return}const focusableEls=this.getFocusableElements();if(focusableEls.length>0){focusableEls[0].focus({preventScroll:!0});return}this.setAttribute("tabindex","-1"),this.focus({preventScroll:!0})}activateFocusTrap(triggerElement=null){triggerElement&&!this.contains(triggerElement)?this.lastActiveTrigger=triggerElement:!this.lastActiveTrigger&&document.activeElement&&!this.contains(document.activeElement)&&(this.lastActiveTrigger=document.activeElement),this.focusTrapActive||(document.addEventListener("keydown",this.handleTrapKeydown),this.focusTrapActive=!0),requestAnimationFrame(()=>{this.focusInitialElement()})}deactivateFocusTrap(restoreFocus=!0){this.focusTrapActive&&(document.removeEventListener("keydown",this.handleTrapKeydown),this.focusTrapActive=!1),restoreFocus&&this.lastActiveTrigger&&this.lastActiveTrigger.isConnected&&this.lastActiveTrigger.focus({preventScroll:!0}),this.lastActiveTrigger=null}handleTrapKeydown(e){if(!(document.documentElement.getAttribute("nss-cart-drawer-open")==="true"))return;if(e.key==="Escape"){e.preventDefault(),this.closeCart();return}if(e.key!=="Tab")return;const focusableEls=this.getFocusableElements();if(focusableEls.length===0){e.preventDefault();return}const firstEl=focusableEls[0],lastEl=focusableEls[focusableEls.length-1],activeEl=document.activeElement;if(e.shiftKey&&(activeEl===firstEl||!this.contains(activeEl))){e.preventDefault(),lastEl.focus({preventScroll:!0});return}!e.shiftKey&&(activeEl===lastEl||!this.contains(activeEl))&&(e.preventDefault(),firstEl.focus({preventScroll:!0}))}initCartDrawer(){const cartToggleBtnEls=document.querySelectorAll("[nss-open-cart-drawer]");this.cartToggleHandlers=[],cartToggleBtnEls.forEach(cartToggleBtnEl=>{const handler=e=>{e.preventDefault(),this.toggleCart(e.currentTarget)};cartToggleBtnEl.addEventListener("click",handler),this.cartToggleHandlers.push({element:cartToggleBtnEl,handler})}),(window.location.href.indexOf("#cart")>-1||window.location.href.indexOf("?viewcart=true")>-1)&&(typeof window.NSS_REFRESH_AND_OPEN_CART=="function"?window.NSS_REFRESH_AND_OPEN_CART():this.toggleCart());const overlayEl=document.querySelector("nss-overlay");this.overlayClickHandler=e=>{document.documentElement.getAttribute("nss-cart-drawer-open")==="true"&&this.closeCart()},overlayEl.addEventListener("click",this.overlayClickHandler)}}customElements.define("nss-cart-drawer",NSSCartDrawer)},{}]},["7X3qK"],"7X3qK","parcelRequire83e8");
2//# sourceMappingURL=/cdn/shop/t/222/assets/nss-cart-drawer.js.map?v=133194837871624435801786644262

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.