diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-10-03 17:15:46 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-10-03 17:15:46 +0200 |
commit | 6e5bf64ef3ef858a5cc40025f61f3b1cf550d4fe (patch) | |
tree | 0429f9b7af2ff312dfbdb4b184a6cbeec28969ca /src/webview/recipe.js | |
parent | Automatic i18n update (i18n.meetfranz.com) (diff) | |
parent | update strings (diff) | |
download | ferdium-app-6e5bf64ef3ef858a5cc40025f61f3b1cf550d4fe.tar.gz ferdium-app-6e5bf64ef3ef858a5cc40025f61f3b1cf550d4fe.tar.zst ferdium-app-6e5bf64ef3ef858a5cc40025f61f3b1cf550d4fe.zip |
Merge branch 'release/5.4.0' into i18n
Diffstat (limited to 'src/webview/recipe.js')
-rw-r--r-- | src/webview/recipe.js | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index c223b73de..e3e13b726 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -12,6 +12,7 @@ import contextMenu from './contextMenu'; | |||
12 | import './notifications'; | 12 | import './notifications'; |
13 | 13 | ||
14 | import { DEFAULT_APP_SETTINGS } from '../config'; | 14 | import { DEFAULT_APP_SETTINGS } from '../config'; |
15 | import { isDevMode } from '../environment'; | ||
15 | 16 | ||
16 | const debug = require('debug')('Franz:Plugin'); | 17 | const debug = require('debug')('Franz:Plugin'); |
17 | 18 | ||
@@ -32,7 +33,7 @@ class RecipeController { | |||
32 | 'settings-update': 'updateAppSettings', | 33 | 'settings-update': 'updateAppSettings', |
33 | 'service-settings-update': 'updateServiceSettings', | 34 | 'service-settings-update': 'updateServiceSettings', |
34 | 'get-service-id': 'serviceIdEcho', | 35 | 'get-service-id': 'serviceIdEcho', |
35 | } | 36 | }; |
36 | 37 | ||
37 | constructor() { | 38 | constructor() { |
38 | this.initialize(); | 39 | this.initialize(); |
@@ -173,11 +174,42 @@ new RecipeController(); | |||
173 | // Patching window.open | 174 | // Patching window.open |
174 | const originalWindowOpen = window.open; | 175 | const originalWindowOpen = window.open; |
175 | 176 | ||
177 | |||
176 | window.open = (url, frameName, features) => { | 178 | window.open = (url, frameName, features) => { |
179 | if (!url && !frameName && !features) { | ||
180 | // The service hasn't yet supplied a URL (as used in Skype). | ||
181 | // Return a new dummy window object and wait for the service to change the properties | ||
182 | const newWindow = { | ||
183 | location: { | ||
184 | href: '', | ||
185 | }, | ||
186 | }; | ||
187 | |||
188 | const checkInterval = setInterval(() => { | ||
189 | // Has the service changed the URL yet? | ||
190 | if (newWindow.location.href !== '') { | ||
191 | // Open the new URL | ||
192 | ipcRenderer.sendToHost('new-window', newWindow.location.href); | ||
193 | clearInterval(checkInterval); | ||
194 | } | ||
195 | }, 0); | ||
196 | |||
197 | setTimeout(() => { | ||
198 | // Stop checking for location changes after 1 second | ||
199 | clearInterval(checkInterval); | ||
200 | }, 1000); | ||
201 | |||
202 | return newWindow; | ||
203 | } | ||
204 | |||
177 | // We need to differentiate if the link should be opened in a popup or in the systems default browser | 205 | // We need to differentiate if the link should be opened in a popup or in the systems default browser |
178 | if (!frameName && !features) { | 206 | if (!frameName && !features && typeof features !== 'string') { |
179 | return ipcRenderer.sendToHost('new-window', url); | 207 | return ipcRenderer.sendToHost('new-window', url); |
180 | } | 208 | } |
181 | 209 | ||
182 | return originalWindowOpen(url, frameName, features); | 210 | return originalWindowOpen(url, frameName, features); |
183 | }; | 211 | }; |
212 | |||
213 | if (isDevMode) { | ||
214 | window.log = console.log; | ||
215 | } | ||