aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Flo <florian@sorg.tech>2024-01-05 05:32:08 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-04 21:32:08 -0700
commit8b6695135b163aad04aa9cfb65fbbcf9c7ef3f71 (patch)
tree24c0dd258803dbc67ddc7a5333e6c137a6a753ac /recipes
parentGoogle Voice Dark background for search results (#488) (diff)
downloadferdium-recipes-8b6695135b163aad04aa9cfb65fbbcf9c7ef3f71.tar.gz
ferdium-recipes-8b6695135b163aad04aa9cfb65fbbcf9c7ef3f71.tar.zst
ferdium-recipes-8b6695135b163aad04aa9cfb65fbbcf9c7ef3f71.zip
rocketchat: fix unread counter disappearing (#489)
Diffstat (limited to 'recipes')
-rw-r--r--recipes/rocketchat/package.json2
-rw-r--r--recipes/rocketchat/webview.js24
2 files changed, 13 insertions, 13 deletions
diff --git a/recipes/rocketchat/package.json b/recipes/rocketchat/package.json
index 164cd5f..92c245a 100644
--- a/recipes/rocketchat/package.json
+++ b/recipes/rocketchat/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "rocketchat", 2 "id": "rocketchat",
3 "name": "Rocket.Chat", 3 "name": "Rocket.Chat",
4 "version": "1.4.0", 4 "version": "1.5.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://{teamId}.rocket.chat", 7 "serviceURL": "https://{teamId}.rocket.chat",
diff --git a/recipes/rocketchat/webview.js b/recipes/rocketchat/webview.js
index 74556de..67f50f1 100644
--- a/recipes/rocketchat/webview.js
+++ b/recipes/rocketchat/webview.js
@@ -6,19 +6,19 @@ const _path = _interopRequireDefault(require('path'));
6 6
7module.exports = Ferdium => { 7module.exports = Ferdium => {
8 const getMessages = () => { 8 const getMessages = () => {
9 const directMessages = document.querySelectorAll('.rcx-badge'); 9 const title = document.querySelector('title');
10 10 const matches = title.textContent.match(/^\((\S*?)\)/);
11 let directMessagesCount = 0; 11
12 12 if (matches) {
13 for (const directMessage of directMessages) { 13 const count = Ferdium.safeParseInt(matches[1], 10);
14 directMessagesCount += Ferdium.safeParseInt(directMessage.textContent); 14 if (count) {
15 Ferdium.setBadge(count);
16 } else {
17 Ferdium.setBadge(0, 1);
18 }
19 } else {
20 Ferdium.setBadge(0);
15 } 21 }
16
17 const indirectMessagesCount = Math.round(
18 document.querySelectorAll('.rcx-sidebar-item--highlighted').length,
19 );
20
21 Ferdium.setBadge(directMessagesCount, indirectMessagesCount);
22 }; 22 };
23 23
24 Ferdium.loop(getMessages); 24 Ferdium.loop(getMessages);