blob: 8388f60b26ac15a4c39cc4a74c93166d604dc48c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
// Inject css
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
// Get notifications
Ferdium.loop(() => {
const notifications = document
.querySelectorAll('[href$=notifications]')
.item(0);
// Null if not present
if (!notifications) {
return;
}
// Assume first element contains the number of notifications
const parsedValue = Ferdium.safeParseInt(notifications.outerText);
// Set to parsed value
Ferdium.setBadge(parsedValue);
});
};
|