diff options
Diffstat (limited to 'recipes/element/webview.js')
-rw-r--r-- | recipes/element/webview.js | 11 |
1 files changed, 5 insertions, 6 deletions
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 | } |