summaryrefslogtreecommitdiffstats
path: root/public/js/bootstrap.js
blob: 425c8abcb8e5d64ce95c370bf747d2e4ff3f15d5 (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
28
;(function () {
    let html = document.documentElement;
    window.name = html.dataset.icingaWindowName;
    window.icinga = new Icinga({
        baseUrl: html.dataset.icingaBaseUrl,
        locale: html.lang,
        timezone: html.dataset.icingaTimezone
    });

    if (! ('icingaIsIframe' in document.documentElement.dataset)) {
        html.classList.replace('no-js', 'js');
    }

    if (window.getComputedStyle) {
        let matched;
        let element = document.getElementById('layout');
        let name = window
            .getComputedStyle(html)['font-family']
            .replace(/['",]/g, '');

        if (null !== (matched = name.match(/^([a-z]+)-layout$/))) {
            element.classList.replace('default-layout', name);
            if ('object' === typeof window.console) {
                window.console.log('Icinga Web 2: setting initial layout to ' + name);
            }
        }
    }
})();