From 97697e3d069972844b2912a93022f4a4904a40d6 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sat, 31 Jul 2021 15:28:23 +0530 Subject: Fixed eslintrc as root for this folder; Reformatted all files. --- recipes/wire/webview.js | 61 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) (limited to 'recipes/wire/webview.js') diff --git a/recipes/wire/webview.js b/recipes/wire/webview.js index 57baadc..efd37f3 100644 --- a/recipes/wire/webview.js +++ b/recipes/wire/webview.js @@ -1,38 +1,37 @@ module.exports = (Ferdi) => { - function getMessages() { - let direct = 0; - let indirect = 0; + function getMessages() { + let direct = 0; + let indirect = 0; - // Count how many people/groups have texted you - const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); - if (conversationElems) { - for (const conversationElem of conversationElems) { - const count = parseInt(conversationElem.innerText); - if (count) { - direct += count; - } - } - } + // Count how many people/groups have texted you + const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); + if (conversationElems) { + for (const conversationElem of conversationElems) { + const count = parseInt(conversationElem.innerText); + if (count) { + direct += count; + } + } + } - // Count unread pending user requests - const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); - if (pendingElem) { - const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); - if (matches && matches.length > 0) { - indirect += parseInt(matches[1]); - } - } + // Count unread pending user requests + const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); + if (pendingElem) { + const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); + if (matches && matches.length > 0) { + indirect += parseInt(matches[1]); + } + } - // Alternative would be to count all messages (unread conversation count + pending) from the header - // const titleElem = document.querySelector('head title'); - // const matches = titleElem.innerText.match(/^\(([1-9][0-9]*)\)/); - // if (matches) { - // direct = matches[1]; - // } + // Alternative would be to count all messages (unread conversation count + pending) from the header + // const titleElem = document.querySelector('head title'); + // const matches = titleElem.innerText.match(/^\(([1-9][0-9]*)\)/); + // if (matches) { + // direct = matches[1]; + // } - Ferdi.setBadge(direct, indirect); - } - - Ferdi.loop(getMessages); + Ferdi.setBadge(direct, indirect); + } + Ferdi.loop(getMessages); }; -- cgit v1.2.3-54-g00ecf