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/zoom/package.json | 2 +- recipes/zoom/webview.js | 46 ++++++++++++---------------------------------- 2 files changed, 13 insertions(+), 35 deletions(-) (limited to 'recipes/zoom') diff --git a/recipes/zoom/package.json b/recipes/zoom/package.json index ce12ff9..82117f7 100644 --- a/recipes/zoom/package.json +++ b/recipes/zoom/package.json @@ -1,7 +1,7 @@ { "id": "zoom", "name": "Zoom", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "config": { "serviceURL": "https://zoom.us/join", diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js index 16a3a1a..0dd0e38 100644 --- a/recipes/zoom/webview.js +++ b/recipes/zoom/webview.js @@ -4,7 +4,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = (Ferdium, settings) => { +module.exports = Ferdium => { const getMessages = () => { let directCount = 0; const directCountPerServer = document.querySelectorAll( @@ -26,40 +26,18 @@ module.exports = (Ferdium, settings) => { Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); - // 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"]'); + document.addEventListener('click', event => { + const link = event.target.closest('a[href^="http"]'); + const button = event.target.closest('button[title^="http"]'); - if (link || button) { - const url = link - ? link.getAttribute('href') - : button.getAttribute('title'); + if (link || button) { + const url = link ? link.getAttribute('href') : button.getAttribute('title'); - 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; - }); - } + if (url.includes('views/imgpsh_fullsize_anim')) { + event.preventDefault(); + event.stopPropagation(); + Ferdium.openNewWindow(url); } - }, - true, - ); + } + }, true); }; -- cgit v1.2.3-70-g09d2