aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Andres <shiruken@gmail.com>2023-12-14 18:45:12 -0600
committerLibravatar GitHub <noreply@github.com>2023-12-14 17:45:12 -0700
commit647b506874e55b8ba5df43f87eca08d11f1cbb9f (patch)
tree60640c440633279c72b2406be57ce13c3402e94f
parentZulip changed unread locations (#478) (diff)
downloadferdium-recipes-647b506874e55b8ba5df43f87eca08d11f1cbb9f.tar.gz
ferdium-recipes-647b506874e55b8ba5df43f87eca08d11f1cbb9f.tar.zst
ferdium-recipes-647b506874e55b8ba5df43f87eca08d11f1cbb9f.zip
Adds Spaces and Chat badges to countImportant (#479)
-rw-r--r--package.json8
-rw-r--r--recipes/gmail/package.json2
-rw-r--r--recipes/gmail/webview.js12
3 files changed, 17 insertions, 5 deletions
diff --git a/package.json b/package.json
index 9b3e468..f9960d5 100644
--- a/package.json
+++ b/package.json
@@ -5,12 +5,12 @@
5 "doc": "docs" 5 "doc": "docs"
6 }, 6 },
7 "engines": { 7 "engines": {
8 "node": "20.9.0", 8 "node": "^20.9.0",
9 "pnpm": "8.10.0" 9 "pnpm": "^8.10.0"
10 }, 10 },
11 "volta": { 11 "volta": {
12 "node": "20.9.0", 12 "node": "^20.9.0",
13 "pnpm": "8.10.0" 13 "pnpm": "^8.10.0"
14 }, 14 },
15 "engine-strict": true, 15 "engine-strict": true,
16 "packageManager": "pnpm@8.10.0", 16 "packageManager": "pnpm@8.10.0",
diff --git a/recipes/gmail/package.json b/recipes/gmail/package.json
index ffb7757..adaa88f 100644
--- a/recipes/gmail/package.json
+++ b/recipes/gmail/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "gmail", 2 "id": "gmail",
3 "name": "Gmail", 3 "name": "Gmail",
4 "version": "1.6.0", 4 "version": "1.6.1",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://mail.google.com" 7 "serviceURL": "https://mail.google.com"
diff --git a/recipes/gmail/webview.js b/recipes/gmail/webview.js
index dead877..6db2eec 100644
--- a/recipes/gmail/webview.js
+++ b/recipes/gmail/webview.js
@@ -18,6 +18,8 @@ module.exports = Ferdium => {
18 let countImportant = 0; 18 let countImportant = 0;
19 let countNonImportant = 0; 19 let countNonImportant = 0;
20 const inboxLinks = document.querySelectorAll('.J-Ke.n0'); 20 const inboxLinks = document.querySelectorAll('.J-Ke.n0');
21 const spaceAndChatBadges = document.querySelectorAll('span.XU.aH6');
22
21 if (inboxLinks.length > 0) { 23 if (inboxLinks.length > 0) {
22 const { parentNode } = inboxLinks[0]; 24 const { parentNode } = inboxLinks[0];
23 if (parentNode) { 25 if (parentNode) {
@@ -41,6 +43,16 @@ module.exports = Ferdium => {
41 } 43 }
42 } 44 }
43 } 45 }
46
47 if (spaceAndChatBadges.length > 0) {
48 const arr = [...spaceAndChatBadges];
49 const spaceAndChatCount = arr.reduce(
50 (acc, e) => Ferdium.safeParseInt(e.getInnerHTML()) + acc,
51 0,
52 );
53 countImportant += spaceAndChatCount;
54 }
55
44 Ferdium.setBadge(countImportant, countNonImportant); 56 Ferdium.setBadge(countImportant, countNonImportant);
45 }; 57 };
46 58