blob: 03b2b2daf7ab366781879d0b53b0c62dc56f86f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
module.exports = Franz => {
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;
}
Franz.setBadge(direct);
};
Franz.loop(getMessages);
};
|