aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Edgars <Edgars+GitHub@gaitenis.id.lv>2022-12-28 09:58:46 +0200
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2023-01-02 13:23:19 +0530
commit7606f872a0728bbfa85db600e2aa7af84ae9fce6 (patch)
tree2917e6fe90ae1bb2160ca349836f3a17900ca8ba /recipes
parentUpdate pnpm to 7.21.0 (diff)
downloadferdium-recipes-7606f872a0728bbfa85db600e2aa7af84ae9fce6.tar.gz
ferdium-recipes-7606f872a0728bbfa85db600e2aa7af84ae9fce6.tar.zst
ferdium-recipes-7606f872a0728bbfa85db600e2aa7af84ae9fce6.zip
Use unread rooms count like Element app does
This change uses unread rooms instead of messages count like Element (web)app does Unread rooms count is extracted from the `title` tag.
Diffstat (limited to 'recipes')
-rw-r--r--recipes/element/package.json2
-rw-r--r--recipes/element/webview.js11
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 @@
1module.exports = Ferdium => { 1module.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 }