aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/icq
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-31 16:25:57 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-31 16:25:57 +0530
commitdfae2d231e39c81827d08fd8834d736c5b3005b1 (patch)
tree5037b401e7de837fdd6046a3c61ac76aed240e6e /recipes/icq
parentNew recipe: odoo (diff)
downloadferdium-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')
-rw-r--r--recipes/icq/package.json2
-rw-r--r--recipes/icq/webview.js13
2 files changed, 5 insertions, 10 deletions
diff --git a/recipes/icq/package.json b/recipes/icq/package.json
index 1ce61eb..35de4bb 100644
--- a/recipes/icq/package.json
+++ b/recipes/icq/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "icq", 2 "id": "icq",
3 "name": "ICQ", 3 "name": "ICQ",
4 "version": "1.1.0", 4 "version": "1.1.1",
5 "license": "MIT", 5 "license": "MIT",
6 "repository": "https://github.com/meetfranz/recipe-icq", 6 "repository": "https://github.com/meetfranz/recipe-icq",
7 "config": { 7 "config": {
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 @@
1module.exports = Ferdi => { 1module.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