blob: 39a704e23b9bfcd38ce647e45fcbdae48f2628ec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
module.exports = Ferdi => {
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 += notificationsElement.innerHTML;
}
const DMElement = document.querySelector('[data-testid=AppTabBar_DirectMessage_Link] div div div');
if (DMElement) {
direct += DMElement.innerHTML;
}
Ferdi.setBadge(direct);
};
Ferdi.loop(getMessages);
};
|