diff options
-rw-r--r-- | all.json | 2 | ||||
-rw-r--r-- | archives/whatsapp.tar.gz | bin | 183369 -> 183419 bytes | |||
-rw-r--r-- | uncompressed/whatsapp/package.json | 4 | ||||
-rw-r--r-- | uncompressed/whatsapp/webview.js | 20 |
4 files changed, 17 insertions, 9 deletions
@@ -972,7 +972,7 @@ | |||
972 | "featured": false, | 972 | "featured": false, |
973 | "id": "whatsapp", | 973 | "id": "whatsapp", |
974 | "name": "WhatsApp", | 974 | "name": "WhatsApp", |
975 | "version": "2.0.0", | 975 | "version": "2.0.1", |
976 | "icons": { | 976 | "icons": { |
977 | "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/whatsapp/icon.png", | 977 | "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/whatsapp/icon.png", |
978 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/whatsapp/icon.svg" | 978 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/whatsapp/icon.svg" |
diff --git a/archives/whatsapp.tar.gz b/archives/whatsapp.tar.gz index 1c45a71..c8c859d 100644 --- a/archives/whatsapp.tar.gz +++ b/archives/whatsapp.tar.gz | |||
Binary files differ | |||
diff --git a/uncompressed/whatsapp/package.json b/uncompressed/whatsapp/package.json index 210e8d1..49afab1 100644 --- a/uncompressed/whatsapp/package.json +++ b/uncompressed/whatsapp/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "whatsapp", | 2 | "id": "whatsapp", |
3 | "name": "WhatsApp", | 3 | "name": "WhatsApp", |
4 | "version": "2.0.0", | 4 | "version": "2.0.1", |
5 | "description": "WhatsApp", | 5 | "description": "WhatsApp", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Stefan Malzner <stefan@adlk.io>", | 7 | "author": "Stefan Malzner <stefan@adlk.io>", |
@@ -9,6 +9,8 @@ | |||
9 | "config": { | 9 | "config": { |
10 | "serviceURL": "https://web.whatsapp.com", | 10 | "serviceURL": "https://web.whatsapp.com", |
11 | "hasNotificationSound": true, | 11 | "hasNotificationSound": true, |
12 | "hasDirectMessages": true, | ||
13 | "hasIndirectMessages": true, | ||
12 | "disablewebsecurity": true | 14 | "disablewebsecurity": true |
13 | } | 15 | } |
14 | } | 16 | } |
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')); |