diff options
Diffstat (limited to 'recipes/proton-mail')
-rw-r--r-- | recipes/proton-mail/package.json | 2 | ||||
-rw-r--r-- | recipes/proton-mail/webview.js | 18 |
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 @@ | |||
1 | module.exports = Ferdi => { | 1 | module.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); |