From dfac5cb4801b1ee6ad0395449898e991ac83ce3b Mon Sep 17 00:00:00 2001 From: Serene <33189705+Serene-Arc@users.noreply.github.com> Date: Sun, 26 Nov 2023 04:44:11 +1000 Subject: Add recipe for Online Go (OGS) (#467) --- recipes/online-go/icon.svg | 35 +++++++++++++++++++++++++++++++++++ recipes/online-go/index.js | 1 + recipes/online-go/package.json | 15 +++++++++++++++ recipes/online-go/webview.js | 23 +++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 recipes/online-go/icon.svg create mode 100644 recipes/online-go/index.js create mode 100644 recipes/online-go/package.json create mode 100644 recipes/online-go/webview.js (limited to 'recipes') diff --git a/recipes/online-go/icon.svg b/recipes/online-go/icon.svg new file mode 100644 index 0000000..cdbb4ab --- /dev/null +++ b/recipes/online-go/icon.svg @@ -0,0 +1,35 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/recipes/online-go/index.js b/recipes/online-go/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/online-go/index.js @@ -0,0 +1 @@ +module.exports = Ferdium => Ferdium; diff --git a/recipes/online-go/package.json b/recipes/online-go/package.json new file mode 100644 index 0000000..4d57ff7 --- /dev/null +++ b/recipes/online-go/package.json @@ -0,0 +1,15 @@ +{ + "id": "online-go", + "name": "Online Go", + "version": "1.0.0", + "license": "MIT", + "aliases": [ + "OGS" + ], + "config": { + "hasDirectMessages": true, + "hasIndirectMessages": true, + "hasNotificationSound": true, + "serviceURL": "https://online-go.com" + } +} 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 @@ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} + +const _path = _interopRequireDefault(require('path')); + +module.exports = Ferdium => { + const getMessages = () => { + const games = document.querySelector('.TurnIndicator'); + const chat_messages = document.querySelector('.ChatIndicator .count'); + const notifications = document.querySelector( + '.NotificationIndicator .count', + ); + const indirect = + Number.parseInt(notifications.textContent) + + Number.parseInt(chat_messages.textContent); + const direct = Number.parseInt(games.textContent); + Ferdium.setBadge(direct, indirect); + }; + Ferdium.loop(getMessages); + + Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); +}; -- cgit v1.2.3-54-g00ecf