diff options
author | 2021-10-05 17:04:09 +0200 | |
---|---|---|
committer | 2021-10-05 17:04:09 +0200 | |
commit | d3841b766f9d37d557646003899f67525c5f755f (patch) | |
tree | 1bcab990c94f2b05678b7a83ffebe08298500f0b /recipes/threema/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/threema/webview.js')
-rw-r--r-- | recipes/threema/webview.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/recipes/threema/webview.js b/recipes/threema/webview.js index 40f5203..cf7d1e1 100644 --- a/recipes/threema/webview.js +++ b/recipes/threema/webview.js | |||
@@ -1,17 +1,21 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | 1 | const _path = _interopRequireDefault(require('path')); |
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
4 | 6 | ||
5 | module.exports = Ferdi => { | 7 | module.exports = Ferdi => { |
6 | const getMessages = () => { | 8 | const getMessages = () => { |
7 | const elements = document.querySelectorAll('.badge.unread-count:not(.ng-hide)'); | 9 | const elements = document.querySelectorAll( |
10 | '.badge.unread-count:not(.ng-hide)', | ||
11 | ); | ||
8 | let count = 0; | 12 | let count = 0; |
9 | 13 | ||
10 | for (let i = 0; i < elements.length; i += 1) { | 14 | for (const element of elements) { |
11 | try { | 15 | try { |
12 | count += Ferdi.safeParseInt(elements[i].innerHTML); | 16 | count += Ferdi.safeParseInt(element.textContent); |
13 | } catch (e) { | 17 | } catch (error) { |
14 | console.error(e); | 18 | console.error(error); |
15 | } | 19 | } |
16 | } | 20 | } |
17 | 21 | ||