aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Daniel Peukert <daniel@peukert.cc>2021-12-16 11:52:34 +0100
committerLibravatar GitHub <noreply@github.com>2021-12-16 11:52:34 +0100
commit1391bd57d041e91b53c09cd297d7774762699d88 (patch)
tree70663001e390b510cb1968dbf4178bfc6ba79c46 /recipes
parentIndirect badge if title page starts with a star (#787) (diff)
downloadferdium-recipes-1391bd57d041e91b53c09cd297d7774762699d88.tar.gz
ferdium-recipes-1391bd57d041e91b53c09cd297d7774762699d88.tar.zst
ferdium-recipes-1391bd57d041e91b53c09cd297d7774762699d88.zip
Fix Rainloop unread counter (#788)
Diffstat (limited to 'recipes')
-rw-r--r--recipes/rainloop/package.json2
-rw-r--r--recipes/rainloop/webview.js27
2 files changed, 15 insertions, 14 deletions
diff --git a/recipes/rainloop/package.json b/recipes/rainloop/package.json
index 04b6674..79deb2d 100644
--- a/recipes/rainloop/package.json
+++ b/recipes/rainloop/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "rainloop", 2 "id": "rainloop",
3 "name": "RainLoop", 3 "name": "RainLoop",
4 "version": "1.1.1", 4 "version": "1.1.2",
5 "repository": "https://github.com/promarcel/franz-recipe-rainloop", 5 "repository": "https://github.com/promarcel/franz-recipe-rainloop",
6 "license": "MIT", 6 "license": "MIT",
7 "config": { 7 "config": {
diff --git a/recipes/rainloop/webview.js b/recipes/rainloop/webview.js
index 346e51f..0a29849 100644
--- a/recipes/rainloop/webview.js
+++ b/recipes/rainloop/webview.js
@@ -1,24 +1,25 @@
1module.exports = Ferdi => { 1module.exports = Ferdi => {
2 const getMessages = () => { 2 const getMessages = () => {
3 let updates = 0; 3 let messages = 0;
4 let inbox = 0;
5 let full = 0;
6 4
7 $('.b-folders-user .ui-droppable').each((i, obj) => { 5 // Let's only loop through user folders, as all system folders are duplicated there
8 const countText = $(obj).find('.count').first().html(); 6 for (const obj of document.querySelectorAll('.b-folders-user .ui-droppable')) {
9 if (typeof countText === 'string' && countText !== '') { 7 const countEl = obj.querySelector('.count');
10 if ($(obj).hasClass('system')) { 8 const countText = countEl ? countEl.innerHTML : '';
11 if ($(obj).hasClass('i-am-inbox')) { 9
12 inbox += Ferdi.safeParseInt(countText); 10 if (countText != '') {
11 if (obj.classList.contains('system')) {
12 // Only count the Inbox system folder and ignore Archive, Trash, Drafts, Spam, Sent
13 if (obj.classList.contains('i-am-inbox')) {
14 messages += Ferdi.safeParseInt(countText);
13 } 15 }
14 } else { 16 } else {
15 updates += Ferdi.safeParseInt(countText); 17 messages += Ferdi.safeParseInt(countText);
16 } 18 }
17 } 19 }
18 }); 20 }
19 21
20 full = inbox + updates; 22 Ferdi.setBadge(messages);
21 Ferdi.setBadge(full);
22 }; 23 };
23 24
24 Ferdi.loop(getMessages); 25 Ferdi.loop(getMessages);