diff options
Diffstat (limited to 'uncompressed/workplace/webview.js')
-rw-r--r-- | uncompressed/workplace/webview.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/uncompressed/workplace/webview.js b/uncompressed/workplace/webview.js deleted file mode 100644 index a26515e..0000000 --- a/uncompressed/workplace/webview.js +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | const path = require('path'); | ||
4 | |||
5 | module.exports = Franz => { | ||
6 | const getMessages = () => { | ||
7 | let direct = 0; | ||
8 | let indirect = 0; | ||
9 | const chatsElement = document.querySelector('#chats'); | ||
10 | const notifications = document.querySelector('#notifications span span'); | ||
11 | |||
12 | if (notifications) { | ||
13 | indirect = parseInt(notifications.innerText, 10); | ||
14 | } | ||
15 | |||
16 | if (chatsElement) { | ||
17 | if (!chatsElement.hasAttribute('aria-current')) { | ||
18 | const chatMessages = chatsElement.querySelector('span'); | ||
19 | |||
20 | if (chatMessages) { | ||
21 | direct = parseInt(chatMessages.innerText, 10); | ||
22 | } | ||
23 | } else { | ||
24 | direct = document.querySelectorAll('[data-pagelet="WorkGalahadChannel"] .uiList [role="gridcell"] [role="button"] .oxk9n0fw').length; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | Franz.setBadge(direct, indirect); | ||
29 | }; | ||
30 | |||
31 | Franz.injectCSS(path.join(__dirname, 'workplace.css')); | ||
32 | Franz.loop(getMessages); | ||
33 | localStorage._cs_desktopNotifsEnabled = JSON.stringify({ | ||
34 | __t: new Date().getTime(), | ||
35 | __v: true | ||
36 | }); | ||
37 | |||
38 | if (typeof Franz.onNotify === 'function') { | ||
39 | Franz.onNotify(notification => { | ||
40 | if (typeof notification.title !== 'string') { | ||
41 | notification.title = ((notification.title.props || {}).content || [])[0] || 'Work Chat'; | ||
42 | } | ||
43 | |||
44 | if (typeof notification.options.body !== 'string') { | ||
45 | notification.options.body = (((notification.options.body || {}).props || {}).content || [])[0] || ''; | ||
46 | } | ||
47 | |||
48 | return notification; | ||
49 | }); | ||
50 | } | ||
51 | }; \ No newline at end of file | ||