diff options
author | Achim Leitner <git@fjl.de> | 2020-07-27 11:27:17 +0200 |
---|---|---|
committer | Achim Leitner <git@fjl.de> | 2020-07-27 12:29:03 +0200 |
commit | b39072308fa114beaf15a1948be48aaac882ffc6 (patch) | |
tree | f95e9ecf25b193e7d461b965ccdd00a94aacc5dd /uncompressed | |
parent | Merge pull request #236 from ruippeixotog/patch-1 (diff) | |
download | ferdium-recipes-b39072308fa114beaf15a1948be48aaac882ffc6.tar.gz ferdium-recipes-b39072308fa114beaf15a1948be48aaac882ffc6.tar.zst ferdium-recipes-b39072308fa114beaf15a1948be48aaac882ffc6.zip |
Update recipe for element
- Update unread messages counter
- Re-add original author
Diffstat (limited to 'uncompressed')
-rw-r--r-- | uncompressed/element/README.md | 4 | ||||
-rw-r--r-- | uncompressed/element/package.json | 4 | ||||
-rw-r--r-- | uncompressed/element/webview.js | 19 |
3 files changed, 15 insertions, 12 deletions
diff --git a/uncompressed/element/README.md b/uncompressed/element/README.md index affdf4b..221864f 100644 --- a/uncompressed/element/README.md +++ b/uncompressed/element/README.md | |||
@@ -1,2 +1,2 @@ | |||
1 | # Element for Franz | 1 | # Element for Franz and Ferdi |
2 | This is a Franz recipe/plugin for Element | 2 | This is a Franz and Ferdi recipe/plugin for Element |
diff --git a/uncompressed/element/package.json b/uncompressed/element/package.json index 6774ce3..68cd16e 100644 --- a/uncompressed/element/package.json +++ b/uncompressed/element/package.json | |||
@@ -1,10 +1,10 @@ | |||
1 | { | 1 | { |
2 | "id": "element", | 2 | "id": "element", |
3 | "name": "Element", | 3 | "name": "Element", |
4 | "version": "1.0.0", | 4 | "version": "1.0.1", |
5 | "description": "Decentralized, encrypted chat & collaboration powered by [matrix]", | 5 | "description": "Decentralized, encrypted chat & collaboration powered by [matrix]", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Omove <61330514+omove@users.noreply.github.com>", | 7 | "author": "Sylvain Cecchetto <cecchetto.sylvain@me.com>, Omove <61330514+omove@users.noreply.github.com>, Achim Leitner <1033549+fjl5@users.noreply.github.com>", |
8 | "license": "MIT", | 8 | "license": "MIT", |
9 | "config": { | 9 | "config": { |
10 | "serviceURL": "https://app.element.io", | 10 | "serviceURL": "https://app.element.io", |
diff --git a/uncompressed/element/webview.js b/uncompressed/element/webview.js index 6201f27..58d18bb 100644 --- a/uncompressed/element/webview.js +++ b/uncompressed/element/webview.js | |||
@@ -2,17 +2,20 @@ | |||
2 | 2 | ||
3 | module.exports = Franz => { | 3 | module.exports = Franz => { |
4 | function getMessages() { | 4 | function getMessages() { |
5 | const indirect_badge = document.getElementsByClassName('mx_RoomSubList_badge'); | 5 | const badges = document.getElementsByClassName('mx_RoomSublist2_badgeContainer'); |
6 | let indirect_count = 0; | ||
7 | if (indirect_badge.length !== 0) { | ||
8 | indirect_count = indirect_badge.length; | ||
9 | } | ||
10 | 6 | ||
11 | const direct_badge = document.getElementsByClassName('mx_RoomSubList_badgeHighlight'); | 7 | // Number of messages from People |
12 | let direct_count = 0; | 8 | let direct_count = 0; |
13 | if (direct_badge.length !== 0) { | 9 | if (badges.length > 0 && badges[0].children.length > 0) { |
14 | direct_count = direct_badge.length; | 10 | direct_count = parseInt(badges[0].textContent) |
11 | } | ||
12 | |||
13 | // Number of messages from Rooms | ||
14 | let indirect_count = 0; | ||
15 | if (badges.length > 1 && badges[1].children.length > 0) { | ||
16 | indirect_count = parseInt(badges[1].textContent) | ||
15 | } | 17 | } |
18 | |||
16 | // set Franz badge | 19 | // set Franz badge |
17 | Franz.setBadge(direct_count, indirect_count); | 20 | Franz.setBadge(direct_count, indirect_count); |
18 | } | 21 | } |