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/whatsapp/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/whatsapp/webview.js')
-rw-r--r-- | recipes/whatsapp/webview.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js index dea7b6a..a908637 100644 --- a/recipes/whatsapp/webview.js +++ b/recipes/whatsapp/webview.js | |||
@@ -7,15 +7,14 @@ module.exports = (Ferdi, settings) => { | |||
7 | let count = 0; | 7 | let count = 0; |
8 | let indirectCount = 0; | 8 | let indirectCount = 0; |
9 | 9 | ||
10 | const parentChatElem = Array.from(document.querySelectorAll('div[aria-label]')) | 10 | const parentChatElem = [...document.querySelectorAll('div[aria-label]')] |
11 | .sort((a, b) => (a.offsetHeight < b.offsetHeight) ? 1 : -1)[0]; | 11 | .sort((a, b) => (a.offsetHeight < b.offsetHeight) ? 1 : -1)[0]; |
12 | if (!parentChatElem) { | 12 | if (!parentChatElem) { |
13 | return; | 13 | return; |
14 | } | 14 | } |
15 | 15 | ||
16 | const unreadSpans = parentChatElem.querySelectorAll('span[aria-label]'); | 16 | const unreadSpans = parentChatElem.querySelectorAll('span[aria-label]'); |
17 | for (let i = 0; i < unreadSpans.length; i++) { | 17 | for (const unreadElem of unreadSpans) { |
18 | const unreadElem = unreadSpans[i]; | ||
19 | const countValue = Ferdi.safeParseInt(unreadElem.textContent); | 18 | const countValue = Ferdi.safeParseInt(unreadElem.textContent); |
20 | if (countValue > 0) { | 19 | if (countValue > 0) { |
21 | if (!unreadElem.parentNode.previousSibling || unreadElem.parentNode.previousSibling.querySelectorAll('[data-icon=muted]').length === 0) { | 20 | if (!unreadElem.parentNode.previousSibling || unreadElem.parentNode.previousSibling.querySelectorAll('[data-icon=muted]').length === 0) { |