aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Mattia Panzeri <1754457+panz3r@users.noreply.github.com>2021-11-25 14:26:58 +0100
committerLibravatar GitHub <noreply@github.com>2021-11-25 18:56:58 +0530
commit5283be9f0bcd77dd24920219deabe8e3b72463a2 (patch)
treecd2045a56f1ec5f4374717c49d523aff2150a8a3 /recipes
parentdocs: Update the 'updating recipe' docs [skip ci] (diff)
downloadferdium-recipes-5283be9f0bcd77dd24920219deabe8e3b72463a2.tar.gz
ferdium-recipes-5283be9f0bcd77dd24920219deabe8e3b72463a2.tar.zst
ferdium-recipes-5283be9f0bcd77dd24920219deabe8e3b72463a2.zip
Fix Protonmail unread counter (#773)
Diffstat (limited to 'recipes')
-rw-r--r--recipes/proton-mail/package.json2
-rw-r--r--recipes/proton-mail/webview.js18
2 files changed, 9 insertions, 11 deletions
diff --git a/recipes/proton-mail/package.json b/recipes/proton-mail/package.json
index ab09207..4e89567 100644
--- a/recipes/proton-mail/package.json
+++ b/recipes/proton-mail/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "proton-mail", 2 "id": "proton-mail",
3 "name": "ProtonMail", 3 "name": "ProtonMail",
4 "version": "1.3.1", 4 "version": "1.3.2",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://mail.protonmail.com/login" 7 "serviceURL": "https://mail.protonmail.com/login"
diff --git a/recipes/proton-mail/webview.js b/recipes/proton-mail/webview.js
index 395b779..89e5dab 100644
--- a/recipes/proton-mail/webview.js
+++ b/recipes/proton-mail/webview.js
@@ -1,15 +1,13 @@
1module.exports = Ferdi => { 1module.exports = Ferdi => {
2 const getMessages = () => { 2 const getMessages = () => {
3 const element = document.querySelector('.navigationItem-counter'); 3 let unreadCount = 0;
4 if (!element) { 4 // Loop over all displayed counters and take the highest one (from the "All Mail" folder)
5 return; 5 document.querySelectorAll('.navigation-counter-item').forEach(counterElement => {
6 } 6 const unreadCounter = Ferdi.safeParseInt(counterElement.textContent);
7 const text = element.textContent; 7 unreadCount = Math.max(unreadCount, unreadCounter);
8 if (text) { 8 });
9 // eslint-disable-next-line unicorn/prefer-string-slice 9
10 const count = Ferdi.safeParseInt(text.substring(1, text.length - 1)); 10 Ferdi.setBadge(unreadCount);
11 Ferdi.setBadge(count);
12 }
13 }; 11 };
14 12
15 Ferdi.loop(getMessages); 13 Ferdi.loop(getMessages);