blob: d974836785bc02ee45a65f2185ef381bdfedc3ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
module.exports = Ferdi => {
const getMessages = function getMessages() {
const indirectElements = document.querySelectorAll('.badge:not(.danger)');
const direct = document.querySelectorAll('.badge.danger').length - 1;
let indirect = -1;
for (let i = 0; i < indirectElements.length; i += 1) {
if (indirectElements[i].innerHTML.length > 0) indirect++;
}
Ferdi.setBadge(Math.max(direct, 0), Math.max(indirect, 0));
};
Ferdi.loop(getMessages);
};
|