summaryrefslogtreecommitdiffstats
path: root/public/js/bootstrap.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/bootstrap.js')
-rw-r--r--public/js/bootstrap.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/public/js/bootstrap.js b/public/js/bootstrap.js
new file mode 100644
index 0000000..425c8ab
--- /dev/null
+++ b/public/js/bootstrap.js
@@ -0,0 +1,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);
+ }
+ }
+ }
+})();