PageSourceSearch

https://hjerteforeningen.dk/wp-content/themes/hjerteforeningen-chi…/scripts/dropdown-selector.js?ver=1.09929

js hjerteforeningen.dk collected 2026-10-02 05:53:23 UTC 1,540 bytes, 61 lines download raw bytes

1
2let currentOpenDropDown = null;
3
4function hfInitializeDropwDown (id) {     
5    const wrapper = document.getElementById(id);
6    const selector = wrapper.getElementsByClassName("filter")[0];
7    const dropdownElement = wrapper.getElementsByClassName("dropdown")[0];
8    const input = wrapper.getElementsByClassName("hidden-input")[0];
9    const dropdown = {
10        dropdownElement,
11        wrapper,
12        selector,
13        input,
14    }
15
16    
17    wrapper.addEventListener("click",(e) => {
18        e.stopPropagation();
19    })
20
21
22    selector.addEventListener("click",(e) => {
23        hfDropDowClickHandler(dropdown);
24    })
25}
26
27document.addEventListener("click",(e) => {
28    if (currentOpenDropDown){
29        hfCloseDropDown(currentOpenDropDown);
30    }
31})
32
33function hfDropDowClickHandler(dropdown) {
34    if (currentOpenDropDown == dropdown) {
35        hfCloseDropDown(dropdown);
36    } else {
37        if (currentOpenDropDown) {
38            hfCloseDropDown(currentOpenDropDown);
39        }
40        hfOpenDropDown(dropdown)
41    }
42
43}
44
45function hfOpenDropDown (dropdown) {
46    dropdown.dropdownElement.style.maxHeight = dropdown.dropdownElement.scrollHeight + "px";
47    dropdown.wrapper.classList.add("selected");
48    currentOpenDropDown = dropdown;
49
50}
51
52function hfCloseDropDown(dropdown) {
53    dropdown.wrapper.classList.remove("selected");
54    dropdown.dropdownElement.style.maxHeight = 0;
55    currentOpenDropDown = null;
56}
57
58function openCloseSimple (id) {
59    const element = document.getElementById(id);
60    element.classList.toggle("open");
61}

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.