diff options
author | 2021-02-02 21:46:05 +0100 | |
---|---|---|
committer | 2021-02-02 21:46:05 +0100 | |
commit | 88f70a8355b5eb7e7041ba4690d9709a1a5e5d75 (patch) | |
tree | b17b4c15e2863f917bcea2722e81faec5052798d | |
parent | Synchronize Outlook services and correct message count (#398) (diff) | |
download | ferdium-recipes-88f70a8355b5eb7e7041ba4690d9709a1a5e5d75.tar.gz ferdium-recipes-88f70a8355b5eb7e7041ba4690d9709a1a5e5d75.tar.zst ferdium-recipes-88f70a8355b5eb7e7041ba4690d9709a1a5e5d75.zip |
Fix null element for proton-mail (#432)
-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 | } |