blob: 43c73fd65b8bdc3138a181b6ab33c76b23a04642 (
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 => {
const getMessages = () => {
// Get value of <title> tag where in case of new messages the number of messages appear
const title = document.querySelector('title');
if (title) {
const titleValue = title.text;
// Extract the number from the tag
const match = titleValue.match(/\d+/);
const unread = match !== null && match.length > 0 ? match[0] : 0;
// Set unread msgs badge
Ferdium.setBadge(Ferdium.safeParseInt(unread));
}
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|