From f61690ea2c4b5142c470dbe288446afadae11dbc Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 3 Apr 2022 16:20:55 -0400 Subject: Theme updates (#2105) * Change siteColor to siteTheme * Fix potential null exception * Simplify * Update display theme assignment * Add a data-browser-theme attribute * Add "browser" option for theme * Create ThemeController * Add theme-controller.js to relevant pages * Use ThemeController * Simplify * Fix 'light' being used instead of 'default' * Update the settings values to more accurately reflect their usage * Change default site theme in display.js * Remove async * Restore async for consistency --- ext/js/data/options-util.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'ext/js/data') diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index 1a7f661f..3422b773 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -466,7 +466,8 @@ class OptionsUtil { {async: false, update: this._updateVersion14.bind(this)}, {async: false, update: this._updateVersion15.bind(this)}, {async: false, update: this._updateVersion16.bind(this)}, - {async: false, update: this._updateVersion17.bind(this)} + {async: false, update: this._updateVersion17.bind(this)}, + {async: false, update: this._updateVersion18.bind(this)} ]; if (typeof targetVersion === 'number' && targetVersion < result.length) { result.splice(targetVersion); @@ -924,4 +925,22 @@ class OptionsUtil { } return options; } + + _updateVersion18(options) { + // Version 18 changes: + // general.popupTheme's 'default' value changed to 'light' + // general.popupOuterTheme's 'default' value changed to 'light' + // general.popupOuterTheme's 'auto' value changed to 'site' + for (const profile of options.profiles) { + const {general} = profile.options; + if (general.popupTheme === 'default') { + general.popupTheme = 'light'; + } + switch (general.popupOuterTheme) { + case 'default': general.popupOuterTheme = 'light'; break; + case 'auto': general.popupOuterTheme = 'site'; break; + } + } + return options; + } } -- cgit v1.2.3