diff options
author | 2019-09-28 12:10:25 +0200 | |
---|---|---|
committer | 2019-09-28 12:10:25 +0200 | |
commit | 728d339739b63e9bb59e457e4a84fe9a65b93fc9 (patch) | |
tree | a0fc6180ea26fa9ef397458e8eb6491031d6437d /uncompressed/riot/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/riot/webview.js')
-rw-r--r-- | uncompressed/riot/webview.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/uncompressed/riot/webview.js b/uncompressed/riot/webview.js new file mode 100644 index 0000000..f46f46c --- /dev/null +++ b/uncompressed/riot/webview.js | |||
@@ -0,0 +1,23 @@ | |||
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 | }; | ||
23 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJpb3Qvd2Vidmlldy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiLCJnZXRNZXNzYWdlcyIsImluZGlyZWN0X2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