Skip to content

Commit

Permalink
Add recipe for Online Go (OGS) (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serene-Arc authored Nov 25, 2023
1 parent 44d1197 commit dfac5cb
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
35 changes: 35 additions & 0 deletions recipes/online-go/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions recipes/online-go/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = Ferdium => Ferdium;
15 changes: 15 additions & 0 deletions recipes/online-go/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
23 changes: 23 additions & 0 deletions recipes/online-go/webview.js
Original file line number Diff line number Diff line change
@@ -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'));
};

0 comments on commit dfac5cb

Please sign in to comment.