diff options
author | 2020-03-06 11:31:19 +0100 | |
---|---|---|
committer | 2020-03-06 11:31:19 +0100 | |
commit | 332bfc4139371f489a34326ebdf48ce5d4bf0b8b (patch) | |
tree | ea6d6cdaf6984a4c9d9099f545840202007d9e7d /uncompressed/Google Meet/webview.js | |
parent | #34 Switch Office 365 Outlook recipe (diff) | |
parent | Remove discountinued Google services (Allo/Inbox) #49 #50 (diff) | |
download | ferdium-recipes-332bfc4139371f489a34326ebdf48ce5d4bf0b8b.tar.gz ferdium-recipes-332bfc4139371f489a34326ebdf48ce5d4bf0b8b.tar.zst ferdium-recipes-332bfc4139371f489a34326ebdf48ce5d4bf0b8b.zip |
Merge branch 'master' of https://github.com/getferdi/recipes
Diffstat (limited to 'uncompressed/Google Meet/webview.js')
-rw-r--r-- | uncompressed/Google Meet/webview.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/uncompressed/Google Meet/webview.js b/uncompressed/Google Meet/webview.js new file mode 100644 index 0000000..8e91418 --- /dev/null +++ b/uncompressed/Google Meet/webview.js | |||
@@ -0,0 +1,43 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | const { | ||
4 | remote | ||
5 | } = require('electron'); | ||
6 | |||
7 | const path = require('path'); | ||
8 | |||
9 | const webContents = remote.getCurrentWebContents(); | ||
10 | const { | ||
11 | session | ||
12 | } = webContents; | ||
13 | |||
14 | window.onload = () => { | ||
15 | const title = document.querySelector('.window-title').innerHTML; | ||
16 | |||
17 | if (title && title.includes('Google Chrome 36+')) { | ||
18 | window.location.reload(); | ||
19 | } | ||
20 | }; | ||
21 | |||
22 | module.exports = Franz => { | ||
23 | session.flushStorageData(); | ||
24 | session.clearStorageData({ | ||
25 | storages: ['serviceworkers'] | ||
26 | }); | ||
27 | |||
28 | const getMessages = function getMessages() { | ||
29 | const elements = document.querySelectorAll('.CxUIE, .unread'); | ||
30 | let count = 0; | ||
31 | |||
32 | for (let i = 0; i < elements.length; i += 1) { | ||
33 | if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { | ||
34 | count += 1; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | Franz.setBadge(count); | ||
39 | }; | ||
40 | |||
41 | Franz.injectCSS(path.join(__dirname, 'service.css')); | ||
42 | Franz.loop(getMessages); | ||
43 | }; | ||