diff options
author | 2020-02-21 12:44:04 -0500 | |
---|---|---|
committer | 2020-02-21 12:44:04 -0500 | |
commit | e4766969beaa2efb605df0a6da72e96722e9c73c (patch) | |
tree | be3b36269b8a8f7ac552d070e69317a3c6b3f19a /uncompressed/Google Meet/webview.js | |
parent | adding google meet recipe (diff) | |
download | ferdium-recipes-e4766969beaa2efb605df0a6da72e96722e9c73c.tar.gz ferdium-recipes-e4766969beaa2efb605df0a6da72e96722e9c73c.tar.zst ferdium-recipes-e4766969beaa2efb605df0a6da72e96722e9c73c.zip |
adding google meet recipe
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..ee00e66 --- /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 | }; \ No newline at end of file | ||