diff options
Diffstat (limited to 'recipes/zoom/webview.js')
-rw-r--r-- | recipes/zoom/webview.js | 46 |
1 files changed, 12 insertions, 34 deletions
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) { | |||
4 | return obj && obj.__esModule ? obj : { default: obj }; | 4 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 5 | } |
6 | 6 | ||
7 | module.exports = (Ferdium, settings) => { | 7 | module.exports = Ferdium => { |
8 | const getMessages = () => { | 8 | const getMessages = () => { |
9 | let directCount = 0; | 9 | let directCount = 0; |
10 | const directCountPerServer = document.querySelectorAll( | 10 | const directCountPerServer = document.querySelectorAll( |
@@ -26,40 +26,18 @@ module.exports = (Ferdium, settings) => { | |||
26 | 26 | ||
27 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | 27 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); |
28 | 28 | ||
29 | // TODO: This whole block is duplicated between the 'discord' and 'skype' recipes - reuse | 29 | document.addEventListener('click', event => { |
30 | document.addEventListener( | 30 | const link = event.target.closest('a[href^="http"]'); |
31 | 'click', | 31 | const button = event.target.closest('button[title^="http"]'); |
32 | event => { | ||
33 | const link = event.target.closest('a[href^="http"]'); | ||
34 | const button = event.target.closest('button[title^="http"]'); | ||
35 | 32 | ||
36 | if (link || button) { | 33 | if (link || button) { |
37 | const url = link | 34 | const url = link ? link.getAttribute('href') : button.getAttribute('title'); |
38 | ? link.getAttribute('href') | ||
39 | : button.getAttribute('title'); | ||
40 | 35 | ||
41 | if (url.includes('views/imgpsh_fullsize_anim')) { | 36 | if (url.includes('views/imgpsh_fullsize_anim')) { |
42 | event.preventDefault(); | 37 | event.preventDefault(); |
43 | event.stopPropagation(); | 38 | event.stopPropagation(); |
44 | // 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) | 39 | Ferdium.openNewWindow(url); |
45 | // TODO: Can we change the slack recipe to add a clickHandler for screensharing/video calls? (https://github.com/ferdium/ferdium-app/issues/1697) | ||
46 | let win = new Ferdium.BrowserWindow({ | ||
47 | width: 800, | ||
48 | height: window.innerHeight, | ||
49 | minWidth: 600, | ||
50 | webPreferences: { | ||
51 | partition: `persist:service-${settings.id}`, | ||
52 | // TODO: Aren't these needed here? | ||
53 | // contextIsolation: false, | ||
54 | }, | ||
55 | }); | ||
56 | win.loadURL(url); | ||
57 | win.on('closed', () => { | ||
58 | win = null; | ||
59 | }); | ||
60 | } | ||
61 | } | 40 | } |
62 | }, | 41 | } |
63 | true, | 42 | }, true); |
64 | ); | ||
65 | }; | 43 | }; |