diff options
Diffstat (limited to 'ext/js/pages/settings/settings-display-controller.js')
-rw-r--r-- | ext/js/pages/settings/settings-display-controller.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/js/pages/settings/settings-display-controller.js b/ext/js/pages/settings/settings-display-controller.js index 49f7192c..e179b835 100644 --- a/ext/js/pages/settings/settings-display-controller.js +++ b/ext/js/pages/settings/settings-display-controller.js @@ -42,11 +42,12 @@ export class SettingsDisplayController { this._onMenuButtonClickBind = this._onMenuButtonClick.bind(this); /** @type {ThemeController} */ this._themeController = new ThemeController(document.documentElement); + /** @type {HTMLSelectElement | null}*/ + this._themeDropdown = document.querySelector('[data-setting="general.popupTheme"]'); } /** */ prepare() { - this._themeController.siteTheme = 'light'; this._themeController.prepare(); void this._updateTheme(); @@ -92,16 +93,18 @@ export class SettingsDisplayController { window.addEventListener('popstate', this._onPopState.bind(this), false); this._updateScrollTarget(); - const themeDropdown = document.querySelector('[data-setting="general.popupTheme"]'); - if (themeDropdown) { - themeDropdown.addEventListener('change', this._updateTheme.bind(this), false); + if (this._themeDropdown) { + this._themeDropdown.addEventListener('change', this._updateTheme.bind(this), false); } } /** */ async _updateTheme() { - const options = await this._settingsController.getOptions(); - this._themeController.theme = options.general.popupTheme; + const theme = this._themeDropdown?.value; + if (theme === 'site' || theme === 'light' || theme === 'dark' || theme === 'browser') { + this._themeController.theme = theme; + } + this._themeController.siteOverride = true; this._themeController.updateTheme(); } |