blob: 7000e53717e6d3c35ca9b5a823c1138dceb01127 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module.exports = Ferdi => {
// 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]);
}
}
Ferdi.setBadge(directCount, indirectCount);
};
Ferdi.loop(getMessages);
};
|