diff options
Diffstat (limited to 'src/webview/recipe.js')
-rw-r--r-- | src/webview/recipe.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index bad5a93b2..7b762af17 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -21,6 +21,7 @@ import ignoreList from './darkmode/ignore'; | |||
21 | import customDarkModeCss from './darkmode/custom'; | 21 | import customDarkModeCss from './darkmode/custom'; |
22 | 22 | ||
23 | import RecipeWebview from './lib/RecipeWebview'; | 23 | import RecipeWebview from './lib/RecipeWebview'; |
24 | import Userscript from './lib/Userscript'; | ||
24 | 25 | ||
25 | import spellchecker, { switchDict, disable as disableSpellchecker, getSpellcheckerLocaleByFuzzyIdentifier } from './spellchecker'; | 26 | import spellchecker, { switchDict, disable as disableSpellchecker, getSpellcheckerLocaleByFuzzyIdentifier } from './spellchecker'; |
26 | import { injectDarkModeStyle, isDarkModeStyleInjected, removeDarkModeStyle } from './darkmode'; | 27 | import { injectDarkModeStyle, isDarkModeStyleInjected, removeDarkModeStyle } from './darkmode'; |
@@ -55,6 +56,8 @@ class RecipeController { | |||
55 | 56 | ||
56 | recipe = null; | 57 | recipe = null; |
57 | 58 | ||
59 | userscript = null; | ||
60 | |||
58 | hasUpdatedBeforeRecipeLoaded = false; | 61 | hasUpdatedBeforeRecipeLoaded = false; |
59 | 62 | ||
60 | constructor() { | 63 | constructor() { |
@@ -130,7 +133,8 @@ class RecipeController { | |||
130 | const userJsModule = require(userJs); | 133 | const userJsModule = require(userJs); |
131 | 134 | ||
132 | if (typeof userJsModule === 'function') { | 135 | if (typeof userJsModule === 'function') { |
133 | userJsModule(config); | 136 | this.userscript = new Userscript(this.recipe, this, config); |
137 | userJsModule(config, this.userscript); | ||
134 | } | 138 | } |
135 | }; | 139 | }; |
136 | 140 | ||
@@ -154,6 +158,10 @@ class RecipeController { | |||
154 | debug('System spellcheckerLanguage', this.settings.app.spellcheckerLanguage); | 158 | debug('System spellcheckerLanguage', this.settings.app.spellcheckerLanguage); |
155 | debug('Service spellcheckerLanguage', this.settings.service.spellcheckerLanguage); | 159 | debug('Service spellcheckerLanguage', this.settings.service.spellcheckerLanguage); |
156 | 160 | ||
161 | if (this.userscript && this.userscript.internal_setSettings) { | ||
162 | this.userscript.internal_setSettings(this.settings); | ||
163 | } | ||
164 | |||
157 | if (this.settings.app.enableSpellchecking) { | 165 | if (this.settings.app.enableSpellchecking) { |
158 | debug('Setting spellchecker language to', this.spellcheckerLanguage); | 166 | debug('Setting spellchecker language to', this.spellcheckerLanguage); |
159 | let { spellcheckerLanguage } = this; | 167 | let { spellcheckerLanguage } = this; |
@@ -322,7 +330,6 @@ new RecipeController(); | |||
322 | // Patching window.open | 330 | // Patching window.open |
323 | const originalWindowOpen = window.open; | 331 | const originalWindowOpen = window.open; |
324 | 332 | ||
325 | |||
326 | window.open = (url, frameName, features) => { | 333 | window.open = (url, frameName, features) => { |
327 | if (!url && !frameName && !features) { | 334 | if (!url && !frameName && !features) { |
328 | // The service hasn't yet supplied a URL (as used in Skype). | 335 | // The service hasn't yet supplied a URL (as used in Skype). |