diff options
-rw-r--r-- | recipes/element/package.json | 2 | ||||
-rw-r--r-- | recipes/element/webview.js | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/recipes/element/package.json b/recipes/element/package.json index d694444..3564eef 100644 --- a/recipes/element/package.json +++ b/recipes/element/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "element", | 2 | "id": "element", |
3 | "name": "Element", | 3 | "name": "Element", |
4 | "version": "1.3.2", | 4 | "version": "1.3.3", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "aliases": [ | 6 | "aliases": [ |
7 | "Riot.im", | 7 | "Riot.im", |
diff --git a/recipes/element/webview.js b/recipes/element/webview.js index 6ff8664..f88baac 100644 --- a/recipes/element/webview.js +++ b/recipes/element/webview.js | |||
@@ -1,11 +1,10 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.exports = Ferdium => { |
2 | function getMessages() { | 2 | function getMessages() { |
3 | let directCount = 0; | 3 | const matches = document.querySelector('title').textContent |
4 | const spacesBar = document.querySelector('.mx_SpaceTreeLevel'); | 4 | .match('(?<=\\[)\\d+(?=])'); |
5 | for (const badge of spacesBar.querySelectorAll('.mx_NotificationBadge_count')) { | 5 | const directCount = Ferdium.safeParseInt(matches !== null ? matches[0] : 0); |
6 | directCount += Ferdium.safeParseInt(badge.textContent); | 6 | const indirectCount = document.querySelector('.mx_SpaceTreeLevel') |
7 | } | 7 | .querySelectorAll('.mx_NotificationBadge_dot') |
8 | const indirectCount = spacesBar.querySelectorAll('.mx_NotificationBadge_dot') | ||
9 | .length; | 8 | .length; |
10 | Ferdium.setBadge(directCount, indirectCount); | 9 | Ferdium.setBadge(directCount, indirectCount); |
11 | } | 10 | } |