aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/mysms
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-05 17:04:09 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-05 17:04:09 +0200
commitd3841b766f9d37d557646003899f67525c5f755f (patch)
tree1bcab990c94f2b05678b7a83ffebe08298500f0b /recipes/mysms
parentchore: repo maintenance (#732) (diff)
downloadferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.tar.gz
ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.tar.zst
ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.zip
chore: add eslint-plugin-unicorn (#733)
Diffstat (limited to 'recipes/mysms')
-rw-r--r--recipes/mysms/webview.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/recipes/mysms/webview.js b/recipes/mysms/webview.js
index 3f3415a..1878120 100644
--- a/recipes/mysms/webview.js
+++ b/recipes/mysms/webview.js
@@ -1,10 +1,14 @@
1module.exports = Ferdi => { 1module.exports = Ferdi => {
2 const getMessages = () => { 2 const getMessages = () => {
3 const elements = document.getElementsByClassName('unread'); 3 const elements = document.querySelectorAll('.unread');
4 4
5 let count = 0; 5 let count = 0;
6 for (let i = 0; i < elements.length; i++) { 6 for (const element of elements) {
7 if (Ferdi.safeParseInt(elements[i].innerText.replace(/[^0-9.]/g, '')) > 0) { 7 if (
8 Ferdi.safeParseInt(
9 element.textContent && element.textContent.replace(/[^\d.]/g, ''),
10 ) > 0
11 ) {
8 count++; // count 1 per channel with messages 12 count++; // count 1 per channel with messages
9 } 13 }
10 } 14 }