summaryrefslogtreecommitdiff
path: root/web/kbn_assets/app.js
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-02-19 02:09:27 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-02-19 02:09:29 +0300
commit838b01c548939158f99529a714fe105249d70675 (patch)
treee4295c9711481d917a897514e1ac153dac18e9bb /web/kbn_assets/app.js
parent3741f7cf78a288e967415ccb6736c888a21c211b (diff)
web_kbn: update bootstrap to 5.3, add auto-dark-mode support
Diffstat (limited to 'web/kbn_assets/app.js')
-rw-r--r--web/kbn_assets/app.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/web/kbn_assets/app.js b/web/kbn_assets/app.js
index 82b2db1..86504cd 100644
--- a/web/kbn_assets/app.js
+++ b/web/kbn_assets/app.js
@@ -102,7 +102,7 @@ function removeClass(el, name) {
}
function indexInit() {
- var blocks = ['zones', 'all'];
+ var blocks = ['zones', 'list'];
for (var i = 0; i < blocks.length; i++) {
var button = ge('cam_'+blocks[i]+'_btn');
button.addEventListener('click', function(e) {
@@ -260,4 +260,17 @@ var Inverter = {
}
});
}
-}; \ No newline at end of file
+};
+
+(function () {
+ var htmlElement = document.querySelector("html")
+ if (htmlElement.getAttribute("data-bs-theme") === 'auto') {
+ function updateTheme() {
+ document.querySelector("html").setAttribute("data-bs-theme", window.matchMedia("(prefers-color-scheme: dark)").matches
+ ? "dark"
+ : "light")
+ }
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme);
+ updateTheme();
+ }
+})()