diff options
Diffstat (limited to 'recipes/github')
-rw-r--r-- | recipes/github/webview.js | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/recipes/github/webview.js b/recipes/github/webview.js index ab55792..1023975 100644 --- a/recipes/github/webview.js +++ b/recipes/github/webview.js | |||
@@ -3,19 +3,12 @@ module.exports = Ferdium => { | |||
3 | const directCountElement = document.querySelector( | 3 | const directCountElement = document.querySelector( |
4 | '.filter-list.js-notification-inboxes .count', | 4 | '.filter-list.js-notification-inboxes .count', |
5 | ); | 5 | ); |
6 | let directCount = 0; | 6 | const directCount = directCountElement |
7 | if (directCountElement) { | 7 | ? Ferdium.safeParseInt(directCountElement.textContent) |
8 | directCount = Ferdium.safeParseInt(directCountElement.textContent); | 8 | : 0; |
9 | } | 9 | const indirectCount = document.querySelector( |
10 | 10 | '[class*="mail-status unread"]:not([hidden])', | |
11 | const indirectCountElement = document.querySelector( | 11 | ) ? 1 : 0; |
12 | '[class*="mail-status unread"]', | ||
13 | ); | ||
14 | let indirectCount = 0; | ||
15 | if (indirectCountElement && indirectCountElement.textContent.trim().length > 0) { | ||
16 | indirectCount = 1; | ||
17 | } | ||
18 | |||
19 | Ferdium.setBadge(directCount, indirectCount); | 12 | Ferdium.setBadge(directCount, indirectCount); |
20 | }; | 13 | }; |
21 | 14 | ||