From f0786bcdd62a3933f1c6d21b87122d9de4fb139b Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Wed, 8 Sep 2021 10:40:36 +0300 Subject: [PATCH 1/2] [desktop] extend themes initialization --- apps/common/main/lib/util/htmlutils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js index 5b511ce8f..a37b948bc 100644 --- a/apps/common/main/lib/util/htmlutils.js +++ b/apps/common/main/lib/util/htmlutils.js @@ -52,6 +52,11 @@ var checkLocalStorage = (function () { } })(); +if ( window.desktop && window.desktop.theme && (window.desktop.theme.id || window.desktop.theme.type)) { + // params.uitheme = undefined; + localStorage.setItem("ui-theme-id", window.desktop.theme.id); +} + if ( !!params.uitheme && checkLocalStorage && !localStorage.getItem("ui-theme-id") ) { // const _t = params.uitheme.match(/([\w-]+)/g); From a6df1332b81211e317724e80046adf9a9a4c6401 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Mon, 20 Sep 2021 18:33:39 +0300 Subject: [PATCH 2/2] [desktop] apply theme's type if available --- apps/common/main/lib/util/htmlutils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js index a37b948bc..43f3d64f0 100644 --- a/apps/common/main/lib/util/htmlutils.js +++ b/apps/common/main/lib/util/htmlutils.js @@ -52,9 +52,15 @@ var checkLocalStorage = (function () { } })(); -if ( window.desktop && window.desktop.theme && (window.desktop.theme.id || window.desktop.theme.type)) { - // params.uitheme = undefined; - localStorage.setItem("ui-theme-id", window.desktop.theme.id); +if ( window.desktop && window.desktop.theme ) { + if ( window.desktop.theme.id ) { + // params.uitheme = undefined; + localStorage.setItem("ui-theme-id", window.desktop.theme.id); + } else + if ( window.desktop.theme.type ) { + if ( window.desktop.theme.type == 'dark' ) params.uitheme == 'default-dark'; else + if ( window.desktop.theme.type == 'light' ) params.uitheme == 'default-light'; + } } if ( !!params.uitheme && checkLocalStorage && !localStorage.getItem("ui-theme-id") ) {