diff options
author | 2022-05-15 02:24:25 -0500 | |
---|---|---|
committer | 2022-05-15 02:24:25 -0500 | |
commit | 811a30974ca10aed701312f54155d4efb7a90a02 (patch) | |
tree | 97f9488485bfc284cb44ab2bf49eacde259b51b1 /recipes | |
parent | Auto-corrected code with version bump for messenger and telegram recipes (diff) | |
download | ferdium-recipes-811a30974ca10aed701312f54155d4efb7a90a02.tar.gz ferdium-recipes-811a30974ca10aed701312f54155d4efb7a90a02.tar.zst ferdium-recipes-811a30974ca10aed701312f54155d4efb7a90a02.zip |
Fix unread message count for groupme and hostnet recipes
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/groupme/package.json | 2 | ||||
-rw-r--r-- | recipes/groupme/webview.js | 12 | ||||
-rw-r--r-- | recipes/hostnet/package.json | 2 | ||||
-rw-r--r-- | recipes/hostnet/webview.js | 2 |
4 files changed, 13 insertions, 5 deletions
diff --git a/recipes/groupme/package.json b/recipes/groupme/package.json index 983c679..0fa12ad 100644 --- a/recipes/groupme/package.json +++ b/recipes/groupme/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "groupme", | 2 | "id": "groupme", |
3 | "name": "GroupMe", | 3 | "name": "GroupMe", |
4 | "version": "1.2.0", | 4 | "version": "1.2.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://web.groupme.com", | 7 | "serviceURL": "https://web.groupme.com", |
diff --git a/recipes/groupme/webview.js b/recipes/groupme/webview.js index e2d6954..0d5afc3 100644 --- a/recipes/groupme/webview.js +++ b/recipes/groupme/webview.js | |||
@@ -1,9 +1,17 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.exports = Ferdium => { |
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | const directMessages = document.querySelectorAll('.badge-count:not(.ng-hide)').length; | 3 | |
4 | // array-ify the list of conversations | ||
5 | const allConversations = [...document.querySelectorAll('#tray .tray-list .list-item')] | ||
6 | // for each conversation on the list... | ||
7 | const filteredConversations = allConversations.filter(e => { | ||
8 | // keep it on the list if [1] it has unread messages (not .ng-hide), and [2] it isn't muted (not .overlay) | ||
9 | return (!e.innerHTML.includes('ng-hide') && !e.innerHTML.includes('overlay')) | ||
10 | }); | ||
11 | const unreadConversations = filteredConversations.length; | ||
4 | 12 | ||
5 | // set Ferdium badge | 13 | // set Ferdium badge |
6 | Ferdium.setBadge(directMessages); | 14 | Ferdium.setBadge(unreadConversations); |
7 | }; | 15 | }; |
8 | 16 | ||
9 | Ferdium.loop(getMessages); | 17 | Ferdium.loop(getMessages); |
diff --git a/recipes/hostnet/package.json b/recipes/hostnet/package.json index f7bd962..24487b8 100644 --- a/recipes/hostnet/package.json +++ b/recipes/hostnet/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "hostnet", | 2 | "id": "hostnet", |
3 | "name": "Hostnet", | 3 | "name": "Hostnet", |
4 | "version": "1.2.0", | 4 | "version": "1.2.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://appsuite.hostnet.nl/appsuite/" | 7 | "serviceURL": "https://appsuite.hostnet.nl/appsuite/" |
diff --git a/recipes/hostnet/webview.js b/recipes/hostnet/webview.js index 0f0b809..9a1266f 100644 --- a/recipes/hostnet/webview.js +++ b/recipes/hostnet/webview.js | |||
@@ -1,6 +1,6 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.exports = Ferdium => { |
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | Ferdium.setBadge(Number.parseInt(document.querySelectorAll('.badge.topbar-launcherbadge')[0].firstChild.data)); | 3 | Ferdium.setBadge(Ferdium.safeParseInt(document.querySelectorAll('.badge.topbar-launcherbadge')[0].firstChild.data)); |
4 | }; | 4 | }; |
5 | 5 | ||
6 | Ferdium.loop(getMessages); | 6 | Ferdium.loop(getMessages); |