diff options
author | 2020-07-15 09:41:56 -0400 | |
---|---|---|
committer | 2020-07-15 09:41:56 -0400 | |
commit | 0957b3a8dbb7ece9b401808dc556520d8e5e7337 (patch) | |
tree | b92fa616fdd3bdde7a0a5b1487e4224581365fa5 /uncompressed/element/webview.js | |
parent | Update repository (diff) | |
download | ferdium-recipes-0957b3a8dbb7ece9b401808dc556520d8e5e7337.tar.gz ferdium-recipes-0957b3a8dbb7ece9b401808dc556520d8e5e7337.tar.zst ferdium-recipes-0957b3a8dbb7ece9b401808dc556520d8e5e7337.zip |
Update Riot.im to Element.io
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 | }; | ||