aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Cknight70 <cknight200@gmail.com>2023-11-09 22:33:21 -0700
committerLibravatar GitHub <noreply@github.com>2023-11-10 05:33:21 +0000
commit48ec989b3d8be0af8e1d62789fb24a19fa0e948e (patch)
treef16ea1e657ce4f306c3c39dcc8c98a923385adf5
parentUpdate notification selectors for TikTok (#454) (diff)
downloadferdium-recipes-48ec989b3d8be0af8e1d62789fb24a19fa0e948e.tar.gz
ferdium-recipes-48ec989b3d8be0af8e1d62789fb24a19fa0e948e.tar.zst
ferdium-recipes-48ec989b3d8be0af8e1d62789fb24a19fa0e948e.zip
Fix Discord badge counts (#461)
Fixes `directCountPerServer`, as well as `indirectCountPerServer`.
-rw-r--r--recipes/discord/package.json2
-rw-r--r--recipes/discord/webview.js6
2 files changed, 3 insertions, 5 deletions
diff --git a/recipes/discord/package.json b/recipes/discord/package.json
index 4371c3c..d169ab9 100644
--- a/recipes/discord/package.json
+++ b/recipes/discord/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "discord", 2 "id": "discord",
3 "name": "Discord", 3 "name": "Discord",
4 "version": "1.8.1", 4 "version": "1.8.2",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://discord.com/login", 7 "serviceURL": "https://discord.com/login",
diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js
index 052ddac..938b3a1 100644
--- a/recipes/discord/webview.js
+++ b/recipes/discord/webview.js
@@ -8,16 +8,14 @@ module.exports = (Ferdium, settings) => {
8 const getMessages = () => { 8 const getMessages = () => {
9 let directCount = 0; 9 let directCount = 0;
10 const directCountPerServer = document.querySelectorAll( 10 const directCountPerServer = document.querySelectorAll(
11 '[class*="lowerBadge-"] [class*="numberBadge-"]', 11 '[class*="lowerBadge_"] [class*="numberBadge_"]',
12 ); 12 );
13 13
14 for (const directCountBadge of directCountPerServer) { 14 for (const directCountBadge of directCountPerServer) {
15 directCount += Ferdium.safeParseInt(directCountBadge.textContent); 15 directCount += Ferdium.safeParseInt(directCountBadge.textContent);
16 } 16 }
17 17
18 const indirectCountPerServer = document.querySelectorAll( 18 const indirectCountPerServer = document.title.search('• Discord') === -1 ? 0 : 1;
19 '[class*="modeUnread-"]',
20 ).length;
21 19
22 Ferdium.setBadge(directCount, indirectCountPerServer); 20 Ferdium.setBadge(directCount, indirectCountPerServer);
23 }; 21 };