diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-02-19 02:09:27 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-02-19 02:09:29 +0300 |
commit | 838b01c548939158f99529a714fe105249d70675 (patch) | |
tree | e4295c9711481d917a897514e1ac153dac18e9bb /web/kbn_assets/app.js | |
parent | 3741f7cf78a288e967415ccb6736c888a21c211b (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.js | 17 |
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(); + } +})() |