aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/recipe.js
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-09 09:48:41 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-09 09:48:41 +0200
commitda9e8a3d5b11efcc8eeee325c0ac7eb7840f75af (patch)
treea189f4566c6380b86aeb04b9307aea23fc6e14d7 /src/webview/recipe.js
parentUpdate zh-HANT.json (diff)
parentUpdate CHANGELOG.md (diff)
downloadferdium-app-da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af.tar.gz
ferdium-app-da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af.tar.zst
ferdium-app-da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af.zip
Merge branch 'master' of https://github.com/meetfranz/franz into franz-5.4.0
Diffstat (limited to 'src/webview/recipe.js')
-rw-r--r--src/webview/recipe.js12
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';
19import './notifications'; 19import './notifications';
20 20
21import { DEFAULT_APP_SETTINGS } from '../config'; 21import { DEFAULT_APP_SETTINGS } from '../config';
22import { isDevMode } from '../environment';
22 23
23const debug = require('debug')('Ferdi:Plugin'); 24const 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
196const originalWindowOpen = window.open; 197const originalWindowOpen = window.open;
197 198
199
198window.open = (url, frameName, features) => { 200window.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
235if (isDevMode) {
236 window.log = console.log;
237}