aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/settings-display-controller.js
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-06-18 20:18:43 -0400
committerGitHub <noreply@github.com>2024-06-19 00:18:43 +0000
commit451bcab01fd591ec54b63af0fc7084dc9f37928b (patch)
tree5b7ae78d7187c77f4b12bf377524e837e9b24606 /ext/js/pages/settings/settings-display-controller.js
parentc002e585fcbfc89b2c345a10c0663336f31442af (diff)
Add auto option to body theme (#1086)
* Add auto option to body theme * Fix firefox bug where themes do not set correctly in settings due to getOptions failing
Diffstat (limited to 'ext/js/pages/settings/settings-display-controller.js')
-rw-r--r--ext/js/pages/settings/settings-display-controller.js15
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();
}