aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/whatsapp/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/whatsapp/webview.js')
-rw-r--r--recipes/whatsapp/webview.js5
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) {