diff options
Diffstat (limited to 'ext/js/pages/settings')
-rw-r--r-- | ext/js/pages/settings/popup-preview-frame.js | 2 | ||||
-rw-r--r-- | ext/js/pages/settings/settings-display-controller.js | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/ext/js/pages/settings/popup-preview-frame.js b/ext/js/pages/settings/popup-preview-frame.js index 7abcfe2a..dc00d091 100644 --- a/ext/js/pages/settings/popup-preview-frame.js +++ b/ext/js/pages/settings/popup-preview-frame.js @@ -77,7 +77,6 @@ export class PopupPreviewFrame { async prepare() { window.addEventListener('message', this._onMessage.bind(this), false); - this._themeController.siteTheme = 'light'; this._themeController.prepare(); // Setup events @@ -141,6 +140,7 @@ export class PopupPreviewFrame { options.general.popupVerticalTextPosition = 'before'; options.scanning.selectText = false; this._themeController.theme = options.general.popupTheme; + this._themeController.siteOverride = true; this._themeController.updateTheme(); return options; } 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(); } |