diff options
author | 2019-09-28 12:10:25 +0200 | |
---|---|---|
committer | 2019-09-28 12:10:25 +0200 | |
commit | 728d339739b63e9bb59e457e4a84fe9a65b93fc9 (patch) | |
tree | a0fc6180ea26fa9ef397458e8eb6491031d6437d /uncompressed/hangoutschat/webview.js | |
parent | Add list of recipes (diff) | |
download | ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.gz ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.tar.zst ferdium-recipes-728d339739b63e9bb59e457e4a84fe9a65b93fc9.zip |
Add uncompressed recipes
Diffstat (limited to 'uncompressed/hangoutschat/webview.js')
-rw-r--r-- | uncompressed/hangoutschat/webview.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/uncompressed/hangoutschat/webview.js b/uncompressed/hangoutschat/webview.js new file mode 100644 index 0000000..2af9e03 --- /dev/null +++ b/uncompressed/hangoutschat/webview.js | |||
@@ -0,0 +1,30 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | const getMessages = function getMessages() { | ||
5 | const muteSelector = '.DQy0Rb'; | ||
6 | |||
7 | // get unread messages | ||
8 | let directCount = 0; | ||
9 | document.querySelectorAll('.eM5l9e.FVKzAb').forEach(node => { | ||
10 | // Hangouts Chat overrides the muted indicator when there is a direct mention | ||
11 | if (!node.closest('content[role="listitem"]').querySelector(muteSelector)) { | ||
12 | directCount += 1; | ||
13 | } | ||
14 | }); | ||
15 | let indirectCount = 0; | ||
16 | document.querySelectorAll('.PL5Wwe.H7du2 .t5F5nf').forEach(node => { | ||
17 | if (!node.closest('content[role="listitem"]').querySelector(muteSelector)) { | ||
18 | indirectCount = +1; | ||
19 | } | ||
20 | }); | ||
21 | indirectCount -= directCount; | ||
22 | |||
23 | // set Franz badge | ||
24 | Franz.setBadge(directCount, indirectCount); | ||
25 | }; | ||
26 | |||
27 | // check for new messages every second and update Franz badge | ||
28 | Franz.loop(getMessages); | ||
29 | }; | ||
30 |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