diff options
Diffstat (limited to 'recipes/workplace/webview.js')
-rw-r--r-- | recipes/workplace/webview.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/recipes/workplace/webview.js b/recipes/workplace/webview.js index efa5e2a..90c6c27 100644 --- a/recipes/workplace/webview.js +++ b/recipes/workplace/webview.js | |||
@@ -1,6 +1,8 @@ | |||
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 = () => { |
@@ -10,7 +12,7 @@ module.exports = Ferdi => { | |||
10 | const notifications = document.querySelector('#notifications span span'); | 12 | const notifications = document.querySelector('#notifications span span'); |
11 | 13 | ||
12 | if (notifications) { | 14 | if (notifications) { |
13 | indirect = Ferdi.safeParseInt(notifications.innerText); | 15 | indirect = Ferdi.safeParseInt(notifications.textContent); |
14 | } | 16 | } |
15 | 17 | ||
16 | if (chatsElement) { | 18 | if (chatsElement) { |
@@ -18,10 +20,12 @@ module.exports = Ferdi => { | |||
18 | const chatMessages = chatsElement.querySelector('span'); | 20 | const chatMessages = chatsElement.querySelector('span'); |
19 | 21 | ||
20 | if (chatMessages) { | 22 | if (chatMessages) { |
21 | direct = Ferdi.safeParseInt(chatMessages.innerText); | 23 | direct = Ferdi.safeParseInt(chatMessages.textContent); |
22 | } | 24 | } |
23 | } else { | 25 | } else { |
24 | direct = document.querySelectorAll('[data-pagelet="WorkGalahadChannel"] .uiList [role="gridcell"] [role="button"] .oxk9n0fw').length; | 26 | direct = document.querySelectorAll( |
27 | '[data-pagelet="WorkGalahadChannel"] .uiList [role="gridcell"] [role="button"] .oxk9n0fw', | ||
28 | ).length; | ||
25 | } | 29 | } |
26 | } | 30 | } |
27 | 31 | ||
@@ -33,18 +37,21 @@ module.exports = Ferdi => { | |||
33 | Ferdi.injectCSS(_path.default.join(__dirname, 'workplace.css')); | 37 | Ferdi.injectCSS(_path.default.join(__dirname, 'workplace.css')); |
34 | 38 | ||
35 | localStorage._cs_desktopNotifsEnabled = JSON.stringify({ | 39 | localStorage._cs_desktopNotifsEnabled = JSON.stringify({ |
36 | __t: new Date().getTime(), | 40 | __t: Date.now(), |
37 | __v: true, | 41 | __v: true, |
38 | }); | 42 | }); |
39 | 43 | ||
40 | if (typeof Ferdi.onNotify === 'function') { | 44 | if (typeof Ferdi.onNotify === 'function') { |
41 | Ferdi.onNotify(notification => { | 45 | Ferdi.onNotify(notification => { |
42 | if (typeof notification.title !== 'string') { | 46 | if (typeof notification.title !== 'string') { |
43 | notification.title = ((notification.title.props || {}).content || [])[0] || 'Work Chat'; | 47 | notification.title = |
48 | ((notification.title.props || {}).content || [])[0] || 'Work Chat'; | ||
44 | } | 49 | } |
45 | 50 | ||
46 | if (typeof notification.options.body !== 'string') { | 51 | if (typeof notification.options.body !== 'string') { |
47 | notification.options.body = (((notification.options.body || {}).props || {}).content || [])[0] || ''; | 52 | notification.options.body = |
53 | (((notification.options.body || {}).props || {}).content || [])[0] || | ||
54 | ''; | ||
48 | } | 55 | } |
49 | 56 | ||
50 | return notification; | 57 | return notification; |