diff options
Diffstat (limited to 'recipes/github')
-rw-r--r-- | recipes/github/package.json | 2 | ||||
-rw-r--r-- | recipes/github/webview.js | 25 |
2 files changed, 20 insertions, 7 deletions
diff --git a/recipes/github/package.json b/recipes/github/package.json index fa734c7..8788aad 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.3", | 4 | "version": "2.6.0", |
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 b73e96e..3068b80 100644 --- a/recipes/github/webview.js +++ b/recipes/github/webview.js | |||
@@ -1,5 +1,11 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
1 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
2 | const _parseNewCount = (text) => { | 8 | const _parseNewCount = text => { |
3 | const match = text.match(/\d+/); | 9 | const match = text.match(/\d+/); |
4 | return match ? Ferdium.safeParseInt(match[0]) : 0; | 10 | return match ? Ferdium.safeParseInt(match[0]) : 0; |
5 | }; | 11 | }; |
@@ -11,17 +17,24 @@ module.exports = Ferdium => { | |||
11 | let directCount = directCountElement | 17 | let directCount = directCountElement |
12 | ? Ferdium.safeParseInt(directCountElement.textContent) | 18 | ? Ferdium.safeParseInt(directCountElement.textContent) |
13 | : 0; | 19 | : 0; |
14 | 20 | ||
15 | const newCountElement = document.querySelector('a.h6[href="/notifications?query="]'); | 21 | const newCountElement = document.querySelector( |
16 | const newCount = newCountElement ? | 22 | 'a.h6[href="/notifications?query="]', |
17 | _parseNewCount(newCountElement.textContent) : 0; | 23 | ); |
24 | const newCount = newCountElement | ||
25 | ? _parseNewCount(newCountElement.textContent) | ||
26 | : 0; | ||
18 | directCount += newCount; | 27 | directCount += newCount; |
19 | 28 | ||
20 | const indirectCount = document.querySelector( | 29 | const indirectCount = document.querySelector( |
21 | '[class*="mail-status unread"]:not([hidden])', | 30 | '[class*="mail-status unread"]:not([hidden])', |
22 | ) ? 1 : 0; | 31 | ) |
32 | ? 1 | ||
33 | : 0; | ||
23 | Ferdium.setBadge(directCount, indirectCount); | 34 | Ferdium.setBadge(directCount, indirectCount); |
24 | }; | 35 | }; |
25 | 36 | ||
26 | Ferdium.loop(getMessages); | 37 | Ferdium.loop(getMessages); |
38 | |||
39 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
27 | }; | 40 | }; |