From d3841b766f9d37d557646003899f67525c5f755f Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 5 Oct 2021 17:04:09 +0200 Subject: chore: add eslint-plugin-unicorn (#733) --- recipes/whatsapp/webview.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'recipes/whatsapp') 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) => { let count = 0; let indirectCount = 0; - const parentChatElem = Array.from(document.querySelectorAll('div[aria-label]')) + const parentChatElem = [...document.querySelectorAll('div[aria-label]')] .sort((a, b) => (a.offsetHeight < b.offsetHeight) ? 1 : -1)[0]; if (!parentChatElem) { return; } const unreadSpans = parentChatElem.querySelectorAll('span[aria-label]'); - for (let i = 0; i < unreadSpans.length; i++) { - const unreadElem = unreadSpans[i]; + for (const unreadElem of unreadSpans) { const countValue = Ferdi.safeParseInt(unreadElem.textContent); if (countValue > 0) { if (!unreadElem.parentNode.previousSibling || unreadElem.parentNode.previousSibling.querySelectorAll('[data-icon=muted]').length === 0) { -- cgit v1.2.3-54-g00ecf