blob: 8c78bb65f569466334d698b439224d3df418c1c8 (
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
|
const _path = _interopRequireDefault(require('path'));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = (Ferdi) => {
// if the user is on gmail's landing page, go to the login page.
if (location.hostname == 'www.google.com' && location.href.includes('gmail/about/')) {
location.href = 'https://accounts.google.com/AccountChooser?service=mail&continue=https://mail.google.com/mail/';
}
const getMessages = function getMessages() {
let count = 0;
const inboxLinks = document.getElementsByClassName('J-Ke n0');
if (inboxLinks.length > 0) {
const unreadCounts = inboxLinks[0].parentNode.parentNode.getElementsByClassName('bsU');
if (unreadCounts.length > 0) {
count = Ferdi.safeParseInt(unreadCounts[0].innerHTML);
}
}
// set Ferdi badge
Ferdi.setBadge(count);
};
Ferdi.loop(getMessages);
Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|