blob: 7e2ef951a0bb9abaaa74de6cc73ad11129269083 (
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
26
27
28
29
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
// Regular expression for (*) or (1), will extract the asterisk or the number
const titleRegEx = /^\(([\d*])\)/;
const getMessages = function unreadCount() {
let directCount = 0;
let indirectCount = 0;
const matchArr = document.title.match(titleRegEx);
if (matchArr) {
if (matchArr[1] === '*') {
indirectCount = 1;
} else {
directCount = Number(matchArr[1]);
}
}
Ferdium.setBadge(directCount, indirectCount);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|