diff options
-rw-r--r-- | recipes/proton-mail/webview.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/recipes/proton-mail/webview.js b/recipes/proton-mail/webview.js index 8d85afd..3d8a30e 100644 --- a/recipes/proton-mail/webview.js +++ b/recipes/proton-mail/webview.js | |||
@@ -1,7 +1,16 @@ | |||
1 | module.exports = Franz => { | 1 | module.exports = Franz => { |
2 | function getMessages() { | 2 | function getMessages() { |
3 | const count = document.querySelector('.navigationItem-counter').innerText | 3 | const element = document.querySelector('.navigationItem-counter') |
4 | Franz.setBadge(count ? Number(count.substring(1, count.length - 1)) : 0) | 4 | if (!element) { |
5 | return | ||
6 | } | ||
7 | const text = element.innerText | ||
8 | const count = Number(text.substring(1, text.length - 1)) | ||
9 | if (Number.isNaN(count)) { | ||
10 | return | ||
11 | } | ||
12 | Franz.setBadge(count) | ||
5 | } | 13 | } |
14 | |||
6 | Franz.loop(getMessages) | 15 | Franz.loop(getMessages) |
7 | } | 16 | } |