diff options
author | 2019-10-17 21:48:38 +0200 | |
---|---|---|
committer | 2019-10-17 21:48:38 +0200 | |
commit | c44cb8dc2203262b4ad52210adf40e0d022671eb (patch) | |
tree | 8a3a15a161a048f06203b9ee66763df63ab3c3ba /src/webview | |
parent | Merge pull request #124 from getferdi/l10n_develop (diff) | |
download | ferdium-app-c44cb8dc2203262b4ad52210adf40e0d022671eb.tar.gz ferdium-app-c44cb8dc2203262b4ad52210adf40e0d022671eb.tar.zst ferdium-app-c44cb8dc2203262b4ad52210adf40e0d022671eb.zip |
Add toggle to disable universal dark mode
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/recipe.js | 12 | ||||
-rw-r--r-- | src/webview/spellchecker.js | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 6068e6c4a..d18d16082 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -43,6 +43,8 @@ class RecipeController { | |||
43 | 'get-service-id': 'serviceIdEcho', | 43 | 'get-service-id': 'serviceIdEcho', |
44 | }; | 44 | }; |
45 | 45 | ||
46 | universalDarkModeInjected = false; | ||
47 | |||
46 | constructor() { | 48 | constructor() { |
47 | this.initialize(); | 49 | this.initialize(); |
48 | } | 50 | } |
@@ -127,11 +129,12 @@ class RecipeController { | |||
127 | 129 | ||
128 | if (darkModeExists) { | 130 | if (darkModeExists) { |
129 | injectDarkModeStyle(this.settings.service.recipe.path); | 131 | injectDarkModeStyle(this.settings.service.recipe.path); |
130 | } else if (!ignoreList.includes(window.location.host)) { | 132 | } else if (this.settings.app.universalDarkMode && !ignoreList.includes(window.location.host)) { |
131 | // Use darkreader instead | 133 | // Use darkreader instead |
132 | enableDarkMode({}, { | 134 | enableDarkMode({}, { |
133 | css: customDarkModeCss[window.location.host] || '', | 135 | css: customDarkModeCss[window.location.host] || '', |
134 | }); | 136 | }); |
137 | this.universalDarkModeInjected = true; | ||
135 | } | 138 | } |
136 | } else { | 139 | } else { |
137 | debug('Remove dark mode'); | 140 | debug('Remove dark mode'); |
@@ -140,8 +143,15 @@ class RecipeController { | |||
140 | removeDarkModeStyle(); | 143 | removeDarkModeStyle(); |
141 | } else { | 144 | } else { |
142 | disableDarkMode(); | 145 | disableDarkMode(); |
146 | this.universalDarkModeInjected = false; | ||
143 | } | 147 | } |
144 | } | 148 | } |
149 | |||
150 | // Remove dark reader if (universal) dark mode was just disabled | ||
151 | if (this.universalDarkModeInjected && (!this.settings.app.darkMode || !this.settings.app.universalDarkMode)) { | ||
152 | disableDarkMode(); | ||
153 | this.universalDarkModeInjected = false; | ||
154 | } | ||
145 | } | 155 | } |
146 | 156 | ||
147 | updateAppSettings(event, data) { | 157 | updateAppSettings(event, data) { |
diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js index 27380676d..1cb449110 100644 --- a/src/webview/spellchecker.js +++ b/src/webview/spellchecker.js | |||
@@ -96,7 +96,7 @@ export function isEnabled() { | |||
96 | 96 | ||
97 | export function disable() { | 97 | export function disable() { |
98 | if (isEnabled()) { | 98 | if (isEnabled()) { |
99 | webFrame.setSpellCheckProvider(currentDict, true, { spellCheck: () => true }); | 99 | webFrame.setSpellCheckProvider(currentDict, { spellCheck: () => true }); |
100 | _isEnabled = false; | 100 | _isEnabled = false; |
101 | currentDict = null; | 101 | currentDict = null; |
102 | } | 102 | } |