diff options
author | 2020-02-23 21:27:24 +0100 | |
---|---|---|
committer | 2020-02-23 21:27:24 +0100 | |
commit | a71833cd1e0764d1626d886baed756efe1fa4bad (patch) | |
tree | 37813338b32269185ca5c8c15838a87689833f0c /uncompressed/Google Meet/webview.js | |
parent | Review Custom Website URL validation (#47) (diff) | |
parent | repackaging (diff) | |
download | ferdium-recipes-a71833cd1e0764d1626d886baed756efe1fa4bad.tar.gz ferdium-recipes-a71833cd1e0764d1626d886baed756efe1fa4bad.tar.zst ferdium-recipes-a71833cd1e0764d1626d886baed756efe1fa4bad.zip |
Merge pull request #46 from n-xlkt/feat/gmeet
Feat/gmeet
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 | }; | ||