blob: 6f46d8e72fe496b6f55733f88e4483280f2c9eac (
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
30
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
const getMessages = () => {
const newsDOM = document.querySelectorAll(
"div[title='All'] > .LeftnavListRow__count",
);
let counter = 0;
if (newsDOM && newsDOM.length > 0) {
const { textContent } = newsDOM[0];
counter =
textContent.includes('K') || textContent.includes('+')
? `${textContent.slice(0, Math.max(0, textContent.indexOf('K')))}000`
: Ferdium.safeParseInt(textContent);
}
Ferdium.setBadge(counter);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|