summaryrefslogtreecommitdiff
path: root/ext/js/display/display.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/display/display.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/display/display.js')
-rw-r--r--ext/js/display/display.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index e9fdfd9f..386f456b 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -304,7 +304,6 @@ export class Display extends EventDispatcher {
/** */
async prepare() {
// Theme
- this._themeController.siteTheme = 'light';
this._themeController.prepare();
// State setup
@@ -488,6 +487,10 @@ export class Display extends EventDispatcher {
this._history.pushState(state, content, url);
break;
}
+
+ if (this._options) {
+ this._setTheme(this._options);
+ }
}
/**
@@ -1149,8 +1152,16 @@ export class Display extends EventDispatcher {
_setTheme(options) {
const {general} = options;
const {popupTheme} = general;
+ try {
+ // eslint-disable-next-line no-underscore-dangle
+ const pageTheme = this._history._current.state?.pageTheme;
+ this._themeController.siteTheme = pageTheme ?? null;
+ } catch (e) {
+ log.error(e);
+ }
this._themeController.theme = popupTheme;
this._themeController.outerTheme = general.popupOuterTheme;
+ this._themeController.siteOverride = this._pageType === 'search';
this._themeController.updateTheme();
this.setCustomCss(general.customPopupCss);
}
@@ -1933,6 +1944,7 @@ export class Display extends EventDispatcher {
url,
sentence: sentence !== null ? sentence : void 0,
documentTitle,
+ pageTheme: 'light',
},
content: {
dictionaryEntries: dictionaryEntries !== null ? dictionaryEntries : void 0,