From 5259da41f217560fb21d95289c67a5763bfc1fe9 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 1 Feb 2023 11:09:18 +0100 Subject: [PATCH] Details for #188 --- dev/Stores/Theme.js | 23 +++++++++++-------- .../0.0.0/app/libraries/RainLoop/Service.php | 8 +++---- snappymail/v/0.0.0/app/templates/Index.html | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/dev/Stores/Theme.js b/dev/Stores/Theme.js index e725eedcf..36883c251 100644 --- a/dev/Stores/Theme.js +++ b/dev/Stores/Theme.js @@ -43,18 +43,21 @@ export const }, url = cssLink(value); - clearTimeout(__themeTimer); + if (themeStyle.dataset.name != value) { + clearTimeout(__themeTimer); - themeTrigger(SaveSettingStatus.Saving); + themeTrigger(SaveSettingStatus.Saving); - rl.app.Remote.abort('theme').get('theme', url) - .then(data => { - if (2 === arrayLength(data)) { - themeStyle.textContent = data[1]; - themeTrigger(SaveSettingStatus.Success); - } - clearTimer(); - }, clearTimer); + rl.app.Remote.abort('theme').get('theme', url) + .then(data => { + if (2 === arrayLength(data)) { + themeStyle.textContent = data[1]; + themeStyle.dataset.name = value; + themeTrigger(SaveSettingStatus.Success); + } + clearTimer(); + }, clearTimer); + } }, convertThemeName = theme => theme.replace(/@[a-z]+$/, '').replace(/([A-Z])/g, ' $1').trim(); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php index fcf426208..3b52d6e92 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php @@ -184,13 +184,11 @@ abstract class Service if ($sResult) { $sResult .= ''; } else { + $sThemeName = $oActions->GetTheme($bAdmin); $aTemplateParameters['{{BaseAppBootCss}}'] = \file_get_contents(APP_VERSION_ROOT_PATH.'static/css/boot'.$sAppCssMin.'.css'); $aTemplateParameters['{{BaseAppBootScript}}'] = \file_get_contents(APP_VERSION_ROOT_PATH.'static/js'.($sAppJsMin ? '/min' : '').'/boot'.$sAppJsMin.'.js'); - $aTemplateParameters['{{BaseAppThemeCss}}'] = \preg_replace( - '/\\s*([:;{},]+)\\s*/s', - '$1', - $oActions->compileCss($oActions->GetTheme($bAdmin), $bAdmin) - ); + $aTemplateParameters['{{BaseAppThemeName}}'] = $sThemeName; + $aTemplateParameters['{{BaseAppThemeCss}}'] = \preg_replace('/\\s*([:;{},]+)\\s*/s', '$1', $oActions->compileCss($sThemeName, $bAdmin)); $aTemplateParameters['{{BaseLanguage}}'] = $oActions->compileLanguage($sLanguage, $bAdmin); $aTemplateParameters['{{BaseTemplates}}'] = Utils::ClearHtmlOutput($oServiceActions->compileTemplates($bAdmin)); $sResult = Utils::ClearHtmlOutput(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Index.html')); diff --git a/snappymail/v/0.0.0/app/templates/Index.html b/snappymail/v/0.0.0/app/templates/Index.html index 73e787573..bd5c60d07 100644 --- a/snappymail/v/0.0.0/app/templates/Index.html +++ b/snappymail/v/0.0.0/app/templates/Index.html @@ -12,7 +12,7 @@ - + {{BaseAppFaviconPngLinkTag}} {{BaseAppFaviconTouchLinkTag}}