diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-05 17:04:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 17:04:09 +0200 |
commit | d3841b766f9d37d557646003899f67525c5f755f (patch) | |
tree | 1bcab990c94f2b05678b7a83ffebe08298500f0b /recipes/infomaniak-mail/webview.js | |
parent | chore: repo maintenance (#732) (diff) | |
download | ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.tar.gz ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.tar.zst ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.zip |
chore: add eslint-plugin-unicorn (#733)
Diffstat (limited to 'recipes/infomaniak-mail/webview.js')
-rw-r--r-- | recipes/infomaniak-mail/webview.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/recipes/infomaniak-mail/webview.js b/recipes/infomaniak-mail/webview.js index 04ac42d..f4e39dc 100644 --- a/recipes/infomaniak-mail/webview.js +++ b/recipes/infomaniak-mail/webview.js | |||
@@ -1,8 +1,16 @@ | |||
1 | module.exports = Ferdi => { | 1 | module.exports = Ferdi => { |
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | const count = document.querySelector('.ws-tree-node-badge').innerText; | 3 | const count = document.querySelector('.ws-tree-node-badge'); |
4 | Ferdi.setBadge(count ? Number(count.substring(1, count.length - 1)) : 0); | 4 | if (count) { |
5 | } | 5 | const countText = count.textContent; |
6 | if (countText) { | ||
7 | Ferdi.setBadge( | ||
8 | // eslint-disable-next-line unicorn/prefer-string-slice | ||
9 | count ? Number(countText.substring(1, countText.length - 1)) : 0, | ||
10 | ); | ||
11 | } | ||
12 | } | ||
13 | }; | ||
6 | 14 | ||
7 | Ferdi.loop(getMessages); | 15 | Ferdi.loop(getMessages); |
8 | }; | 16 | }; |