blob: 05e33b33312cfa516edeb09bc9d11e43703f6a61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
module.exports = (Ferdi) => {
const getMessages = function getMessages() {
const unreadBadges = document.querySelectorAll("span.unread");
const unreadBadgesArray = [...unreadBadges];
const unreadMessagesCount = unreadBadgesArray.reduce(
(previousValue, currentBadge) =>
previousValue + Ferdi.safeParseInt(currentBadge.textContent),
0,
);
Ferdi.setBadge(unreadMessagesCount);
};
Ferdi.loop(getMessages);
};
|