diff options
author | 2021-09-12 18:06:39 +0530 | |
---|---|---|
committer | 2021-09-12 12:36:39 +0000 | |
commit | b3411bfca0dd166995d33760feb4ab2c89537c46 (patch) | |
tree | 6fd36c537e634219d9b4ce6efb833036e82451c1 /recipes/teamleader/webview.js | |
parent | New recipe: 'ritetag' (#702) (diff) | |
download | ferdium-recipes-b3411bfca0dd166995d33760feb4ab2c89537c46.tar.gz ferdium-recipes-b3411bfca0dd166995d33760feb4ab2c89537c46.tar.zst ferdium-recipes-b3411bfca0dd166995d33760feb4ab2c89537c46.zip |
Add indirect count for 'teamleader' recipe. (#703)
Diffstat (limited to 'recipes/teamleader/webview.js')
-rw-r--r-- | recipes/teamleader/webview.js | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/recipes/teamleader/webview.js b/recipes/teamleader/webview.js index 7eff414..d341016 100644 --- a/recipes/teamleader/webview.js +++ b/recipes/teamleader/webview.js | |||
@@ -3,11 +3,29 @@ const _path = _interopRequireDefault(require('path')); | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | module.exports = (Ferdi) => { | 5 | module.exports = (Ferdi) => { |
6 | const getMessages = () => { | 6 | const getMessages = function getMessages() { |
7 | Ferdi.setBadge(document.getElementById('notifications_amount').innerHTML); | 7 | let notifications = 0; |
8 | let indirectNotifications = 0; | ||
9 | |||
10 | const notification_element = document.getElementById('notifications_amount'); | ||
11 | const ticket_element = document.querySelector("a[href='tickets.php'] > span"); | ||
12 | const call_element = document.getElementById('queue_amount'); | ||
13 | |||
14 | if (notification_element) { | ||
15 | notifications = Ferdi.safeParseInt(notification_element.getAttribute("datacount")); | ||
16 | } | ||
17 | |||
18 | if (ticket_element != null) { | ||
19 | indirectNotifications = Ferdi.safeParseInt(ticket_element.innerHTML); | ||
20 | } | ||
21 | |||
22 | if (call_element) { | ||
23 | indirectNotifications += Ferdi.safeParseInt(call_element.getAttribute("datacount")); | ||
24 | } | ||
25 | |||
26 | Ferdi.setBadge(notifications, indirectNotifications); | ||
8 | }; | 27 | }; |
9 | 28 | ||
10 | Ferdi.loop(getMessages); | 29 | Ferdi.loop(getMessages); |
11 | 30 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | |
12 | Ferdi.injectCSS(_path.default.join(__dirname, 'css', 'franz.css')); | ||
13 | }; | 31 | }; |