aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/online-go/webview.js
diff options
context:
space:
mode:
authorLibravatar Serene <33189705+Serene-Arc@users.noreply.github.com>2023-11-26 04:44:11 +1000
committerLibravatar GitHub <noreply@github.com>2023-11-25 11:44:11 -0700
commitdfac5cb4801b1ee6ad0395449898e991ac83ce3b (patch)
treec54c789f9f3e078cdfa08c4ff8ab52169ed02609 /recipes/online-go/webview.js
parentFix Zoho Mail badge (#466) (diff)
downloadferdium-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.js23
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 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
6
7module.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};