PageSourceSearch

https://www.historiskmuseum.no/vrtx/dist/resources/js/dropdown.js

js historiskmuseum.no collected 2026-10-02 06:57:27 UTC 2,393 bytes, 2 lines download raw bytes

1class Dropdown{constructor(){}setup(){"undefined"==typeof viewDropdown&&document.addEventListener("DOMContentLoaded",t=>{this.addDropdowns(".vrtx-dropdown-wrapper"),this.setupCloseDropdownListeners(),this.dropdownForms()})}addDropdowns(t){t=document.querySelectorAll(t);if(t.length){let n=this;t.forEach(t=>{var e=t.previousElementSibling,o=this.addMissingId(t,"vrtx-dropdown-wrapper-"),o=(this.addMissingId(e,"vrtx-dropdown-link-"),e.setAttribute("aria-controls",o),e.setAttribute("aria-haspopup","true"),this.ariaDropdownState(e,t,!1,!1),e.addEventListener("click",function(t){n.toggledOpenClosable(this,n,t)}),t.querySelector("a.vrtx-dropdown-close-link"));o&&o.addEventListener("click",function(t){n.toggledOpenClosable(this,n,t)})})}}setupCloseDropdownListeners(){document.addEventListener("click",t=>{t.target.closest(".vrtx-dropdown-component")||document.querySelectorAll(".vrtx-dropdown-wrapper").forEach(t=>{this.hide(t)})}),document.addEventListener("keydown",t=>{"Escape"==t.key&&document.querySelectorAll(".vrtx-dropdown-wrapper").forEach(t=>{this.hide(t)})})}dropdownForms(){document.querySelectorAll(".vrtx-dropdown-form").forEach(t=>{t.classList.add("hidden");var e=t.querySelector(".vrtx-dropdown-form-link");e&&e.classList.add("visible"),t.parentElement.querySelector(".vrtx-dropdown-form-link").addEventListener("click",function(t){this.previousElementSibling.submit(),t.stopPropagation(),t.preventDefault()})})}ariaDropdownState(t,e,o,n){o&&(e=e.querySelectorAll("a, input[type='button'], input[type='submit'], button")).length&&n&&e[0].focus(),t.setAttribute("aria-expanded",o)}toggledOpenClosable(t,e,o){var n,r,s="Enter"===o.key;"click"!==o.type&&!s||((n=t.parentElement).classList.contains("vrtx-dropdown-component-toggled")&&t.classList.toggle("active"),r=t.classList.contains("vrtx-dropdown-close-link")?t.closest(".vrtx-dropdown-wrapper"):t.nextElementSibling,n.classList.contains("vrtx-dropdown-component-toggle")?r.classList.toggle("activated"):e.toggleShowHide(r),e.ariaDropdownState(t,r,t.classList.contains("active"),s),o.stopPropagation(),o.preventDefault())}toggleShowHide(t){t.classList.contains("open")?t.classList.remove("open"):t.classList.add("open")}hide(t){t.classList.remove("open")}addMissingId(t,e){return t.id||(e=e+Math.round((+new Date+1)*Math.random()),t.setAttribute("id",e),e)}}export default new Dropdown;
2//# sourceMappingURL=dropdown.js.map

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.