aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Joseph Hale <47901316+thehale@users.noreply.github.com>2023-05-23 14:32:33 -0700
committerLibravatar GitHub <noreply@github.com>2023-05-23 22:32:33 +0100
commit7bcc6b18102725e5d2e737801ff114716c5a6825 (patch)
tree8bcab256ea3abd1560eb817f0640ab6655788e91 /recipes
parentDowngrade node to '18.15.0' (diff)
downloadferdium-recipes-7bcc6b18102725e5d2e737801ff114716c5a6825.tar.gz
ferdium-recipes-7bcc6b18102725e5d2e737801ff114716c5a6825.tar.zst
ferdium-recipes-7bcc6b18102725e5d2e737801ff114716c5a6825.zip
fix(github): Include "new notifications" in direct total (#371)
Diffstat (limited to 'recipes')
-rw-r--r--recipes/github/package.json2
-rw-r--r--recipes/github/webview.js13
2 files changed, 13 insertions, 2 deletions
diff --git a/recipes/github/package.json b/recipes/github/package.json
index 7562766..fa734c7 100644
--- a/recipes/github/package.json
+++ b/recipes/github/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "github", 2 "id": "github",
3 "name": "GitHub", 3 "name": "GitHub",
4 "version": "2.5.2", 4 "version": "2.5.3",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://github.com/notifications", 7 "serviceURL": "https://github.com/notifications",
diff --git a/recipes/github/webview.js b/recipes/github/webview.js
index 1023975..b73e96e 100644
--- a/recipes/github/webview.js
+++ b/recipes/github/webview.js
@@ -1,11 +1,22 @@
1module.exports = Ferdium => { 1module.exports = Ferdium => {
2 const _parseNewCount = (text) => {
3 const match = text.match(/\d+/);
4 return match ? Ferdium.safeParseInt(match[0]) : 0;
5 };
6
2 const getMessages = () => { 7 const getMessages = () => {
3 const directCountElement = document.querySelector( 8 const directCountElement = document.querySelector(
4 '.filter-list.js-notification-inboxes .count', 9 '.filter-list.js-notification-inboxes .count',
5 ); 10 );
6 const directCount = directCountElement 11 let directCount = directCountElement
7 ? Ferdium.safeParseInt(directCountElement.textContent) 12 ? Ferdium.safeParseInt(directCountElement.textContent)
8 : 0; 13 : 0;
14
15 const newCountElement = document.querySelector('a.h6[href="/notifications?query="]');
16 const newCount = newCountElement ?
17 _parseNewCount(newCountElement.textContent) : 0;
18 directCount += newCount;
19
9 const indirectCount = document.querySelector( 20 const indirectCount = document.querySelector(
10 '[class*="mail-status unread"]:not([hidden])', 21 '[class*="mail-status unread"]:not([hidden])',
11 ) ? 1 : 0; 22 ) ? 1 : 0;