aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/static/js/menu_handler.js
blob: 0907a912faceb195637e041834eefd8fb9635ad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class MenuHandler {
    clickMenuListItem(event) {
        let element = event.target;

        if (element.tagName === "A") {
            window.location.href = element.getAttribute("href");
        } else {
            window.location.href = element.querySelector("a").getAttribute("href");
        }
    }

    toggleMainMenu() {
        let menu = document.querySelector(".header nav ul");
        if (DomHelper.isVisible(menu)) {
            menu.style.display = "none";
        } else {
            menu.style.display = "block";
        }

        let searchElement = document.querySelector(".header .search");
        if (DomHelper.isVisible(searchElement)) {
            searchElement.style.display = "none";
        } else {
            searchElement.style.display = "block";
        }
    }
}