blob: 241d7873140a22d40569333d0a656736e4a7e6da (
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
|
const _path = _interopRequireDefault(require('path'));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = (Ferdi) => {
const getMessages = () => {
let notifications = 0;
let indirectNotifications = 0;
const notification_element = document.getElementById('notifications_amount');
const ticket_element = document.querySelector("a[href='tickets.php'] > span");
const call_element = document.getElementById('queue_amount');
if (notification_element) {
notifications = Ferdi.safeParseInt(notification_element.getAttribute("datacount"));
}
if (ticket_element != null) {
indirectNotifications = Ferdi.safeParseInt(ticket_element.innerHTML);
}
if (call_element) {
indirectNotifications += Ferdi.safeParseInt(call_element.getAttribute("datacount"));
}
Ferdi.setBadge(notifications, indirectNotifications);
};
Ferdi.loop(getMessages);
Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|