diff options
Diffstat (limited to 'uncompressed/element/webview.js')
-rw-r--r-- | uncompressed/element/webview.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/uncompressed/element/webview.js b/uncompressed/element/webview.js new file mode 100644 index 0000000..6201f27 --- /dev/null +++ b/uncompressed/element/webview.js | |||
@@ -0,0 +1,22 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | function getMessages() { | ||
5 | const indirect_badge = document.getElementsByClassName('mx_RoomSubList_badge'); | ||
6 | let indirect_count = 0; | ||
7 | if (indirect_badge.length !== 0) { | ||
8 | indirect_count = indirect_badge.length; | ||
9 | } | ||
10 | |||
11 | const direct_badge = document.getElementsByClassName('mx_RoomSubList_badgeHighlight'); | ||
12 | let direct_count = 0; | ||
13 | if (direct_badge.length !== 0) { | ||
14 | direct_count = direct_badge.length; | ||
15 | } | ||
16 | // set Franz badge | ||
17 | Franz.setBadge(direct_count, indirect_count); | ||
18 | } | ||
19 | |||
20 | // check for new messages every second and update Franz badge | ||
21 | Franz.loop(getMessages); | ||
22 | }; | ||