From 8477741d82e4ebac9ffb7ff90dde1dec063eaed0 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Wed, 20 Apr 2022 00:51:03 -0500 Subject: Remove duplicate code and reuse 'Ferdium.openNewWindow()' --- recipes/skype/webview.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'recipes/skype/webview.js') diff --git a/recipes/skype/webview.js b/recipes/skype/webview.js index ca0befb..47b6f27 100644 --- a/recipes/skype/webview.js +++ b/recipes/skype/webview.js @@ -2,7 +2,7 @@ const _path = _interopRequireDefault(require('path')); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = (Ferdium, settings) => { +module.exports = Ferdium => { const getMessages = () => { let count = 0; const container = document.querySelector('[role="tablist"] > button > div'); @@ -30,7 +30,6 @@ module.exports = (Ferdium, settings) => { Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); - // TODO: This whole block is duplicated between the 'discord' and 'skype' recipes - reuse document.addEventListener('click', event => { const link = event.target.closest('a[href^="http"]'); const button = event.target.closest('button[title^="http"]'); @@ -41,22 +40,7 @@ module.exports = (Ferdium, settings) => { if (url.includes('views/imgpsh_fullsize_anim')) { event.preventDefault(); event.stopPropagation(); - // TODO: Can we send an ipc event 'open-browser-window' to open the child window? (see the slack recipe for how to send an ipc message) - // TODO: Can we change the slack recipe to add a clickHandler for screensharing/video calls? (https://github.com/ferdium/ferdium-app/issues/1697) - let win = new Ferdium.BrowserWindow({ - width: 800, - height: window.innerHeight, - minWidth: 600, - webPreferences: { - partition: `persist:service-${settings.id}`, - // TODO: Aren't these needed here? - // contextIsolation: false, - } - }); - win.loadURL(url); - win.on('closed', () => { - win = null; - }); + Ferdium.openNewWindow(url); } } }, true); -- cgit v1.2.3-70-g09d2