PageSourceSearch

https://ecooking.dk/cdn/shop/t/62/assets/component-dropdown.js?v=101863388087346629481779266429

js ecooking.dk collected 2026-10-04 13:59:45 UTC 4,158 bytes, 2 lines download raw bytes

1if(!customElements.get("wdn-dropdown")){class WDNDropdown extends HTMLElement{constructor(){super(),this.buildConstructor(),this.autoInit&&this.init()}configureAttributes(){this.nameSpace=this.getAttribute("data-name")||"dropdown",this.selectors={trigger:"["+this.nameSpace+"-trigger]",container:"["+this.nameSpace+"-container]",content:"["+this.nameSpace+"-content]"},this.attributeList={group:"group",active:this.nameSpace+"-active",resetHeight:"data-reset-height",animation:this.nameSpace+"-animate",active_on:"active-on"}}buildConstructor(){this.configureAttributes(),this.triggers=this.querySelectorAll(this.selectors.trigger),this.container=this.querySelector(this.selectors.container),this.content=this.querySelector(this.selectors.content),this.group=this.getAttribute(this.attributeList.group),this.isActive=this.getAttribute(this.attributeList.active)==="",this.resetHeight=this.getAttribute(this.attributeList.resetHeight)==="",this.animation=parseInt(this.getAttribute(this.attributeList.animation))||0,this.autoInit=this.getAttribute("data-autoinit")!=="false",this.restrictions={is_restricted:this.hasAttribute(this.attributeList.active_on),active_on:this.getAttribute(this.attributeList.active_on),valid_list:["mobile","desktop"],vp_width:900},this.setConditionals()}setConditionals(){this.conditionals=[window.innerWidth>=this.restrictions.vp_width&&this.restrictions.active_on===this.restrictions.valid_list[0],window.innerWidth<this.restrictions.vp_width&&this.restrictions.active_on===this.restrictions.valid_list[1]]}setState(newState){this.isActive=newState}setContainerHeight(newHeight){var value=newHeight;typeof newHeight=="number"&&(value=newHeight+"px"),this.container.style.height=value}shrinkContainer(){this.setContainerHeight(this.initialHeight)}expandContainer(){var contentHeight=this.content.offsetHeight;this.setContainerHeight(contentHeight)}setInactive(){this.expandContainer(),setTimeout(function(){this.setState(!1),this.removeAttribute(this.attributeList.active),this.shrinkContainer(),typeof this.onClose=="function"&&this.onClose()}.bind(this),50)}scrollTop(){if(!this.classList.contains("scroll-top--on-active"))return;let offsetTop=100+parseInt(getComputedStyle(document.documentElement).getPropertyValue("--nav-height"));setTimeout(()=>{window.scrollTo({behaviour:"smooth",top:this.getBoundingClientRect().top+window.scrollY-offsetTop})},350)}setActive(){this.collapseGroupContainers(),this.setState(!0),this.setAttribute(this.attributeList.active,""),this.expandContainer(),this.scrollTop(),typeof this.onOpen=="function"&&this.onOpen()}fireGroupEvent(){var customEvent=new CustomEvent("dropdown:group:collapse",{detail:{initiator:this,group:this.group}});document.body.dispatchEvent(customEvent)}collapseGroupContainers(){this.group&&this.fireGroupEvent()}beforeInactive(){this.expandContainer()}afterActive(){this.animation&&setTimeout(function(){this.setContainerHeight("auto")}.bind(this),this.animation)}validateActiveOn(){var valid=!0;return!this.restrictions.is_restricted||this.restrictions.valid_list.indexOf(this.restrictions.active_on)===-1||this.conditionals.some(condition=>condition===!0)&&(valid=!1),valid}onTriggerClick(){this.validateActiveOn()&&(this.isActive?(this.beforeInactive(),this.setInactive()):(this.setActive(),this.afterActive()),typeof this.onClick=="function"&&this.onClick())}onWindowResize(){this.setConditionals(),this.isActive&&this.expandContainer()}onGroupCollapse(e){e.detail.initiator!==this&&this.group===e.detail.group&&this.isActive&&this.setInactive()}setInitialState(){this.isActive&&this.expandContainer()}storeInitialHeight(){this.initialHeight=parseInt(this.container.style.height)||0}bind(){this.triggers.forEach(trigger=>trigger.addEventListener("click",this.onTriggerClick.bind(this))),document.body.addEventListener("dropdown:group:collapse",this.onGroupCollapse.bind(this)),window.addEventListener("resize",this.onWindowResize.bind(this))}init(){this.storeInitialHeight(),this.setInitialState(),this.bind()}}customElements.define("wdn-dropdown",WDNDropdown)}
2//# sourceMappingURL=/cdn/shop/t/62/assets/component-dropdown.js.map?v=101863388087346629481779266429

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.