aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/gmail/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/gmail/webview.js')
-rw-r--r--recipes/gmail/webview.js12
1 files changed, 12 insertions, 0 deletions
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