diff options
Diffstat (limited to 'uncompressed/whatsapp/webview.js')
-rw-r--r-- | uncompressed/whatsapp/webview.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/uncompressed/whatsapp/webview.js b/uncompressed/whatsapp/webview.js index 989680a..6cc173a 100644 --- a/uncompressed/whatsapp/webview.js +++ b/uncompressed/whatsapp/webview.js | |||
@@ -28,16 +28,22 @@ window.addEventListener('beforeunload', async () => { | |||
28 | 28 | ||
29 | module.exports = Franz => { | 29 | module.exports = Franz => { |
30 | const getMessages = function getMessages() { | 30 | const getMessages = function getMessages() { |
31 | const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); | 31 | const elements = document.querySelectorAll("[class=OUeyt]"); |
32 | let count = 0; | 32 | var count = 0; |
33 | var indirectCount = 0; | ||
33 | 34 | ||
34 | for (let i = 0; i < elements.length; i += 1) { | 35 | for (var i = 0; i < elements.length; i += 1) { |
35 | if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { | 36 | var countValue = parseInt(elements[i].textContent, 10); |
36 | count += 1; | 37 | |
37 | } | 38 | if (elements[i].parentNode.previousElementSibling === null || elements[i].parentNode.previousElementSibling.querySelectorAll("[data-icon=muted]").length === 0) { |
39 | count += countValue; | ||
40 | } | ||
41 | else { | ||
42 | indirectCount += countValue; | ||
43 | } | ||
38 | } | 44 | } |
39 | 45 | ||
40 | Franz.setBadge(count); | 46 | Franz.setBadge(count, indirectCount); |
41 | }; | 47 | }; |
42 | 48 | ||
43 | Franz.injectCSS(path.join(__dirname, 'service.css')); | 49 | Franz.injectCSS(path.join(__dirname, 'service.css')); |