blob: 0421d54e296c7ecd94ed75a8bdff0c974690fc0a (
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
30
31
32
33
34
35
36
|
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
const getMessages = () => {
let messages = 0;
// Let's only loop through user folders, as all system folders are duplicated there
for (const obj of document.querySelectorAll(
'.b-folders-user .ui-droppable',
)) {
const countEl = obj.querySelector('.count');
const countText = countEl ? countEl.innerHTML : '';
if (countText !== '') {
if (obj.classList.contains('system')) {
// Only count the Inbox system folder and ignore Archive, Trash, Drafts, Spam, Sent
if (obj.classList.contains('i-am-inbox')) {
messages += Ferdium.safeParseInt(countText);
}
} else {
messages += Ferdium.safeParseInt(countText);
}
}
}
Ferdium.setBadge(messages);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|