diff options
Diffstat (limited to 'recipes/teamleader')
-rw-r--r-- | recipes/teamleader/webview.js | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/recipes/teamleader/webview.js b/recipes/teamleader/webview.js index 241d787..f846f55 100644 --- a/recipes/teamleader/webview.js +++ b/recipes/teamleader/webview.js | |||
@@ -1,26 +1,36 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | 1 | const _path = _interopRequireDefault(require('path')); |
2 | 2 | ||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | ||
5 | } | ||
4 | 6 | ||
5 | module.exports = (Ferdi) => { | 7 | module.exports = Ferdi => { |
6 | const getMessages = () => { | 8 | const getMessages = () => { |
7 | let notifications = 0; | 9 | let notifications = 0; |
8 | let indirectNotifications = 0; | 10 | let indirectNotifications = 0; |
9 | 11 | ||
10 | const notification_element = document.getElementById('notifications_amount'); | 12 | const notification_element = document.querySelector( |
11 | const ticket_element = document.querySelector("a[href='tickets.php'] > span"); | 13 | '#notifications_amount', |
12 | const call_element = document.getElementById('queue_amount'); | 14 | ); |
15 | const ticket_element = document.querySelector( | ||
16 | "a[href='tickets.php'] > span", | ||
17 | ); | ||
18 | const call_element = document.querySelector('#queue_amount'); | ||
13 | 19 | ||
14 | if (notification_element) { | 20 | if (notification_element) { |
15 | notifications = Ferdi.safeParseInt(notification_element.getAttribute("datacount")); | 21 | notifications = Ferdi.safeParseInt( |
22 | notification_element.getAttribute('datacount'), | ||
23 | ); | ||
16 | } | 24 | } |
17 | 25 | ||
18 | if (ticket_element != null) { | 26 | if (ticket_element != null) { |
19 | indirectNotifications = Ferdi.safeParseInt(ticket_element.innerHTML); | 27 | indirectNotifications = Ferdi.safeParseInt(ticket_element.textContent); |
20 | } | 28 | } |
21 | 29 | ||
22 | if (call_element) { | 30 | if (call_element) { |
23 | indirectNotifications += Ferdi.safeParseInt(call_element.getAttribute("datacount")); | 31 | indirectNotifications += Ferdi.safeParseInt( |
32 | call_element.getAttribute('datacount'), | ||
33 | ); | ||
24 | } | 34 | } |
25 | 35 | ||
26 | Ferdi.setBadge(notifications, indirectNotifications); | 36 | Ferdi.setBadge(notifications, indirectNotifications); |