From fcc9a951dd9712da3f2c18c0987606b0c8d6cb05 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Mon, 11 Jul 2022 04:13:52 +0300 Subject: js: fix dark theme switching in dev mode --- htdocs/js/common/30-static-manager.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/js/common/30-static-manager.js b/htdocs/js/common/30-static-manager.js index 772df32..4406ddd 100644 --- a/htdocs/js/common/30-static-manager.js +++ b/htdocs/js/common/30-static-manager.js @@ -8,13 +8,15 @@ var StaticManager = { }, loadStyle: function(name, theme, callback) { - var url; + var url, id; if (!window.appConfig.devMode) { if (theme === 'dark') name += '_dark'; url = '/css/'+name+'.css?'+this.versions.css[name]; + id = 'style_'+name; } else { url = '/sass.php?name='+name+'&theme='+theme+'&v='+timestamp(); + id = 'style_'+name+(theme === 'dark' ? '_dark' : ''); } var el = document.createElement('link'); @@ -22,7 +24,7 @@ var StaticManager = { el.onload = callback; el.setAttribute('rel', 'stylesheet'); el.setAttribute('type', 'text/css'); - el.setAttribute('id', 'style_'+name); + el.setAttribute('id', id); el.setAttribute('href', url); document.getElementsByTagName('head')[0].appendChild(el); -- cgit v1.2.3