aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar pesader <65264536+pesader@users.noreply.github.com>2022-02-16 08:31:29 -0300
committerLibravatar GitHub <noreply@github.com>2022-02-16 12:31:29 +0100
commit1d23d2b2c9ad0e815b40220559aef82048ff7fda (patch)
tree9d44bcdcd866776578e6ad16bba3e1aa86eab87d /recipes
parentdocs: add pesader as a contributor for code (#832) (diff)
downloadferdium-recipes-1d23d2b2c9ad0e815b40220559aef82048ff7fda.tar.gz
ferdium-recipes-1d23d2b2c9ad0e815b40220559aef82048ff7fda.tar.zst
ferdium-recipes-1d23d2b2c9ad0e815b40220559aef82048ff7fda.zip
Add Zoom recipe (#827)
Diffstat (limited to 'recipes')
-rw-r--r--recipes/zoom/icon.svg1
-rw-r--r--recipes/zoom/index.js2
-rw-r--r--recipes/zoom/package.json10
-rw-r--r--recipes/zoom/service.css3
-rw-r--r--recipes/zoom/webview.js67
5 files changed, 83 insertions, 0 deletions
diff --git a/recipes/zoom/icon.svg b/recipes/zoom/icon.svg
new file mode 100644
index 0000000..f859f62
--- /dev/null
+++ b/recipes/zoom/icon.svg
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 65 65" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round"><use xlink:href="#A" x=".5" y=".5"/><symbol id="A" overflow="visible"><g stroke="none" fill-rule="nonzero"><path d="M0 32C0 14.272 14.272 0 32 0s32 14.272 32 32-14.272 32-32 32S0 49.728 0 32z"/><path d="M3.137 32A28.8 28.8 0 0 1 32 3.137 28.8 28.8 0 0 1 60.862 32 28.8 28.8 0 0 1 32 60.862 28.8 28.8 0 0 1 3.137 32z" fill="#4a8cff"/><path d="M40.784 28.254l8.157-5.961c.712-.58 1.255-.445 1.255.627v18.177c0 1.205-.678 1.067-1.255.627l-8.157-5.961zm-27.608-5.289v13.553a5.55 5.55 0 0 0 5.575 5.522h19.765a1.01 1.01 0 0 0 1.013-1.004V27.483a5.55 5.55 0 0 0-5.575-5.522H14.189a1.01 1.01 0 0 0-1.013 1.004z"/></g></symbol></svg> \ No newline at end of file
diff --git a/recipes/zoom/index.js b/recipes/zoom/index.js
new file mode 100644
index 0000000..fcaa5c9
--- /dev/null
+++ b/recipes/zoom/index.js
@@ -0,0 +1,2 @@
1"use strict";
2module.exports = Ferdi => Ferdi
diff --git a/recipes/zoom/package.json b/recipes/zoom/package.json
new file mode 100644
index 0000000..ecaf20c
--- /dev/null
+++ b/recipes/zoom/package.json
@@ -0,0 +1,10 @@
1{
2 "id": "zoom",
3 "name": "Zoom",
4 "version": "1.0.0",
5 "license": "MIT",
6 "config": {
7 "serviceURL": "https://zoom.us/join",
8 "hasNotificationSound": true
9 }
10}
diff --git a/recipes/zoom/service.css b/recipes/zoom/service.css
new file mode 100644
index 0000000..a16a615
--- /dev/null
+++ b/recipes/zoom/service.css
@@ -0,0 +1,3 @@
1.notice {
2 display: none;
3}
diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js
new file mode 100644
index 0000000..9ad54e8
--- /dev/null
+++ b/recipes/zoom/webview.js
@@ -0,0 +1,67 @@
1const _path = _interopRequireDefault(require('path'));
2
3function _interopRequireDefault(obj) {
4 return obj && obj.__esModule ? obj : { default: obj };
5}
6
7module.exports = (Ferdi, settings) => {
8 const getMessages = () => {
9 let directCount = 0;
10 const directCountPerServer = document.querySelectorAll(
11 '[class*="lowerBadge-"] [class*="numberBadge-"]',
12 );
13
14 for (const directCountBadge of directCountPerServer) {
15 directCount += Ferdi.safeParseInt(directCountBadge.textContent);
16 }
17
18 const indirectCountPerServer = document.querySelectorAll(
19 '[class*="modeUnread-"]',
20 ).length;
21
22 Ferdi.setBadge(directCount, indirectCountPerServer);
23 };
24
25 Ferdi.loop(getMessages);
26
27 Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
28
29 // TODO: This whole block is duplicated between the 'discord' and 'skype' recipes - reuse
30 document.addEventListener(
31 'click',
32 event => {
33 const link = event.target.closest('a[href^="http"]');
34 const button = event.target.closest('button[title^="http"]');
35
36 if (link || button) {
37 const url = link
38 ? link.getAttribute('href')
39 : button.getAttribute('title');
40
41 if (url.includes('views/imgpsh_fullsize_anim')) {
42 event.preventDefault();
43 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)
45 // TODO: Can we change the slack recipe to add a clickHandler for screensharing/video calls? (https://github.com/getferdi/ferdi/issues/1697)
46 let win = new Ferdi.BrowserWindow({
47 width: 800,
48 height: window.innerHeight,
49 minWidth: 600,
50 webPreferences: {
51 partition: `persist:service-${settings.id}`,
52 nativeWindowOpen: true,
53 // TODO: Aren't these needed here?
54 // contextIsolation: false,
55 // enableRemoteModule: true,
56 },
57 });
58 win.loadURL(url);
59 win.on('closed', () => {
60 win = null;
61 });
62 }
63 }
64 },
65 true,
66 );
67};