diff options
author | 2021-08-31 16:25:57 +0530 | |
---|---|---|
committer | 2021-08-31 16:25:57 +0530 | |
commit | dfae2d231e39c81827d08fd8834d736c5b3005b1 (patch) | |
tree | 5037b401e7de837fdd6046a3c61ac76aed240e6e /recipes/icq/webview.js | |
parent | New recipe: odoo (diff) | |
download | ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.tar.gz ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.tar.zst ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.zip |
refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes.
Diffstat (limited to 'recipes/icq/webview.js')
-rw-r--r-- | recipes/icq/webview.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/recipes/icq/webview.js b/recipes/icq/webview.js index 24271d8..653dc69 100644 --- a/recipes/icq/webview.js +++ b/recipes/icq/webview.js | |||
@@ -1,15 +1,10 @@ | |||
1 | module.exports = Ferdi => { | 1 | module.exports = Ferdi => { |
2 | const getMessages = function getMessages() { | 2 | const getMessages = function getMessages() { |
3 | let directs = 0; | 3 | let directs = 0; |
4 | 4 | const elements = document.getElementsByClassName('nwa-msg-counter icq-recent_state-read'); | |
5 | if (document.getElementsByClassName('nwa-msg-counter icq-recent_state-read').length > 0) { | 5 | for (let i = 0; i < elements.length; i++) { |
6 | const elements = document.getElementsByClassName('nwa-msg-counter icq-recent_state-read'); | 6 | if (Ferdi.safeParseInt(elements[i].innerText.replace(/[^0-9.]/g, '')) > 0) { |
7 | for (let i = 0; i < elements.length; i++) { | 7 | directs += 1; // count 1 per channel with messages |
8 | const countLine = parseInt(elements[i].innerText.replace(/[^0-9.]/g, ''), 10); | ||
9 | if (!isNaN(directs) && countLine > 0) { | ||
10 | // directs += count_line; // count every message | ||
11 | directs += 1; // count 1 per channel with messages | ||
12 | } | ||
13 | } | 8 | } |
14 | } | 9 | } |
15 | 10 | ||