blob: 7a859dc01f9a7d2354b0bebbd6b124114cf14e7e (
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
31
32
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
const getMessages = () => {
let direct = 0;
// "Notifications" and "Messages" - aria-label ending in
// "unread items". Sum the values for direct badge.
const notificationsElement = document.querySelector(
'[data-testid=AppTabBar_Notifications_Link] div div div',
);
if (notificationsElement) {
direct += Ferdium.safeParseInt(notificationsElement.textContent);
}
const DMElement = document.querySelector(
'[data-testid=AppTabBar_DirectMessage_Link] div div div',
);
if (DMElement) {
direct += Ferdium.safeParseInt(DMElement.textContent);
}
Ferdium.setBadge(direct);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|