diff options
author | 2023-11-26 04:44:11 +1000 | |
---|---|---|
committer | 2023-11-25 11:44:11 -0700 | |
commit | dfac5cb4801b1ee6ad0395449898e991ac83ce3b (patch) | |
tree | c54c789f9f3e078cdfa08c4ff8ab52169ed02609 /recipes/online-go/webview.js | |
parent | Fix Zoho Mail badge (#466) (diff) | |
download | ferdium-recipes-dfac5cb4801b1ee6ad0395449898e991ac83ce3b.tar.gz ferdium-recipes-dfac5cb4801b1ee6ad0395449898e991ac83ce3b.tar.zst ferdium-recipes-dfac5cb4801b1ee6ad0395449898e991ac83ce3b.zip |
Add recipe for Online Go (OGS) (#467)
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 | }; | ||