diff options
Diffstat (limited to 'recipes/online-go/webview.js')
-rw-r--r-- | recipes/online-go/webview.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/recipes/online-go/webview.js b/recipes/online-go/webview.js new file mode 100644 index 0000000..c2315de --- /dev/null +++ b/recipes/online-go/webview.js | |||
@@ -0,0 +1,23 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = Ferdium => { | ||
8 | const getMessages = () => { | ||
9 | const games = document.querySelector('.TurnIndicator'); | ||
10 | const chat_messages = document.querySelector('.ChatIndicator .count'); | ||
11 | const notifications = document.querySelector( | ||
12 | '.NotificationIndicator .count', | ||
13 | ); | ||
14 | const indirect = | ||
15 | Number.parseInt(notifications.textContent) + | ||
16 | Number.parseInt(chat_messages.textContent); | ||
17 | const direct = Number.parseInt(games.textContent); | ||
18 | Ferdium.setBadge(direct, indirect); | ||
19 | }; | ||
20 | Ferdium.loop(getMessages); | ||
21 | |||
22 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
23 | }; | ||