blob: 0f0d3a6ba167ce6f2e89a84c2e0a95ce0701c842 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
const getMessages = () => {
// array-ify the list of conversations
const allConversations = [
...document.querySelectorAll('#tray .tray-list .list-item'),
];
// for each conversation on the list...
const filteredConversations = allConversations.filter(e => {
// keep it on the list if [1] it has unread messages (not .ng-hide), and [2] it isn't muted (not .overlay)
return (
!e.innerHTML.includes('ng-hide') && !e.innerHTML.includes('overlay')
);
});
const unreadConversations = filteredConversations.length;
// set Ferdium badge
Ferdium.setBadge(unreadConversations);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|