diff options
Diffstat (limited to 'recipes/github')
-rw-r--r-- | recipes/github/package.json | 2 | ||||
-rw-r--r-- | recipes/github/webview.js | 13 |
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 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.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; |