blob: 84438f225c83515c582fbd7232c461a046a7883f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
const _path = _interopRequireDefault(require('path'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
module.exports = Ferdi => {
const calculateTotalDirectMessages = () =>
[...document.querySelectorAll('.chats-list-element')]
.map(el =>
Ferdi.safeParseInt(
el.querySelector('.m-indicator .number').textContent,
),
)
.reduce((curr, prev) => curr + prev, 0);
Ferdi.loop(() => Ferdi.setBadge(calculateTotalDirectMessages()));
Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|