diff options
-rw-r--r-- | recipes/messenger/package.json | 2 | ||||
-rw-r--r-- | recipes/messenger/webview.js | 33 |
2 files changed, 8 insertions, 27 deletions
diff --git a/recipes/messenger/package.json b/recipes/messenger/package.json index 09c7793..e3a0b90 100644 --- a/recipes/messenger/package.json +++ b/recipes/messenger/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "messenger", | 2 | "id": "messenger", |
3 | "name": "Messenger", | 3 | "name": "Messenger", |
4 | "version": "1.5.0", | 4 | "version": "1.5.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://messenger.com", | 7 | "serviceURL": "https://messenger.com", |
diff --git a/recipes/messenger/webview.js b/recipes/messenger/webview.js index c90f4ad..1f1d39f 100644 --- a/recipes/messenger/webview.js +++ b/recipes/messenger/webview.js | |||
@@ -1,34 +1,15 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.exports = Ferdium => { |
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | let count = 0; | 3 | let count = Array.from(document.querySelectorAll('.bp9cbjyn.j83agx80.owycx6da:not(.btwxx1t3)')) |
4 | .map(elem => { | ||
5 | const hasPing = !!elem.querySelector('.pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa'); | ||
6 | const isMuted = !!elem.querySelector('.a8c37x1j.ms05siws.l3qrxjdp.b7h9ocf4.trssfv1o'); | ||
4 | 7 | ||
5 | const isNotification = /^\((\d+)\)/.test(document.title); | 8 | return hasPing && !isMuted; |
9 | }) | ||
10 | .reduce((prev, curr) => prev + curr, 0); | ||
6 | 11 | ||
7 | /* | 12 | /* |
8 | * Notification case for group chats, workaround by tamas646 | ||
9 | * see https://github.com/ferdium/ferdium-app/issues/1113#issuecomment-783409154 | ||
10 | */ | ||
11 | if (isNotification) { | ||
12 | count = Ferdium.safeParseInt(/^\((\d+)\)/.exec(document.title)[1]); | ||
13 | } else { | ||
14 | /* | ||
15 | * Notification case for direct messages, workaround by manavortex | ||
16 | * see https://github.com/ferdium/ferdium-app/issues/1113#issuecomment-846611765 | ||
17 | */ | ||
18 | count = document.querySelectorAll( | ||
19 | '._5fx8:not(._569x),._1ht3:not(._569x)', | ||
20 | ).length; | ||
21 | if (count === 0) { | ||
22 | count = document.querySelectorAll( | ||
23 | '.pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa', | ||
24 | ).length; | ||
25 | } | ||
26 | if (count === 0) { | ||
27 | // might be obsolete, not sure - never ran into this case | ||
28 | count = document.querySelectorAll('[aria-label="Mark as read"]').length; | ||
29 | } | ||
30 | } | ||
31 | /* | ||
32 | * add count of message requests on top of notification counter | 13 | * add count of message requests on top of notification counter |
33 | */ | 14 | */ |
34 | const messageRequestsElement = document.querySelector('._5nxf'); | 15 | const messageRequestsElement = document.querySelector('._5nxf'); |