diff options
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/recipe.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index b30199f03..3f2338b68 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -19,6 +19,7 @@ import contextMenu from './contextMenu'; | |||
19 | import './notifications'; | 19 | import './notifications'; |
20 | 20 | ||
21 | import { DEFAULT_APP_SETTINGS } from '../config'; | 21 | import { DEFAULT_APP_SETTINGS } from '../config'; |
22 | import { isDevMode } from '../environment'; | ||
22 | 23 | ||
23 | const debug = require('debug')('Ferdi:Plugin'); | 24 | const debug = require('debug')('Ferdi:Plugin'); |
24 | 25 | ||
@@ -39,7 +40,7 @@ class RecipeController { | |||
39 | 'settings-update': 'updateAppSettings', | 40 | 'settings-update': 'updateAppSettings', |
40 | 'service-settings-update': 'updateServiceSettings', | 41 | 'service-settings-update': 'updateServiceSettings', |
41 | 'get-service-id': 'serviceIdEcho', | 42 | 'get-service-id': 'serviceIdEcho', |
42 | } | 43 | }; |
43 | 44 | ||
44 | constructor() { | 45 | constructor() { |
45 | this.initialize(); | 46 | this.initialize(); |
@@ -195,6 +196,7 @@ new RecipeController(); | |||
195 | // Patching window.open | 196 | // Patching window.open |
196 | const originalWindowOpen = window.open; | 197 | const originalWindowOpen = window.open; |
197 | 198 | ||
199 | |||
198 | window.open = (url, frameName, features) => { | 200 | window.open = (url, frameName, features) => { |
199 | if (!url && !frameName && !features) { | 201 | if (!url && !frameName && !features) { |
200 | // The service hasn't yet supplied a URL (as used in Skype). | 202 | // The service hasn't yet supplied a URL (as used in Skype). |
@@ -209,7 +211,7 @@ window.open = (url, frameName, features) => { | |||
209 | // Has the service changed the URL yet? | 211 | // Has the service changed the URL yet? |
210 | if (newWindow.location.href !== '') { | 212 | if (newWindow.location.href !== '') { |
211 | // Open the new URL | 213 | // Open the new URL |
212 | window.open(newWindow.location.href); | 214 | ipcRenderer.sendToHost('new-window', newWindow.location.href); |
213 | clearInterval(checkInterval); | 215 | clearInterval(checkInterval); |
214 | } | 216 | } |
215 | }, 0); | 217 | }, 0); |
@@ -223,9 +225,13 @@ window.open = (url, frameName, features) => { | |||
223 | } | 225 | } |
224 | 226 | ||
225 | // We need to differentiate if the link should be opened in a popup or in the systems default browser | 227 | // We need to differentiate if the link should be opened in a popup or in the systems default browser |
226 | if (!frameName && !features) { | 228 | if (!frameName && !features && typeof features !== 'string') { |
227 | return ipcRenderer.sendToHost('new-window', url); | 229 | return ipcRenderer.sendToHost('new-window', url); |
228 | } | 230 | } |
229 | 231 | ||
230 | return originalWindowOpen(url, frameName, features); | 232 | return originalWindowOpen(url, frameName, features); |
231 | }; | 233 | }; |
234 | |||
235 | if (isDevMode) { | ||
236 | window.log = console.log; | ||
237 | } | ||