blob: dfd06d14230a965e44588c623b515fe1ed9629ff (
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 += Ferdi.safeParseInt(notificationsElement.innerHTML);
}
const DMElement = document.querySelector('[data-testid=AppTabBar_DirectMessage_Link] div div div');
if (DMElement) {
direct += Ferdi.safeParseInt(DMElement.innerHTML);
}
Ferdi.setBadge(direct);
};
Ferdi.loop(getMessages);
};
|