diff options
author | 2020-06-22 10:40:27 +0200 | |
---|---|---|
committer | 2020-06-22 10:40:27 +0200 | |
commit | 57fffb6572dd4fa8257357b42448cd2bbeb8d586 (patch) | |
tree | 73f8c766150bc4a37382cb10929fb2e4758bbfc7 /uncompressed/workplace | |
parent | Repackaged #206 (diff) | |
download | ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.tar.gz ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.tar.zst ferdium-recipes-57fffb6572dd4fa8257357b42448cd2bbeb8d586.zip |
Update repository
Diffstat (limited to 'uncompressed/workplace')
-rw-r--r-- | uncompressed/workplace/index.js | 3 | ||||
-rw-r--r-- | uncompressed/workplace/package.json | 10 | ||||
-rw-r--r-- | uncompressed/workplace/webview.js | 47 |
3 files changed, 47 insertions, 13 deletions
diff --git a/uncompressed/workplace/index.js b/uncompressed/workplace/index.js index c638730..e8243fb 100644 --- a/uncompressed/workplace/index.js +++ b/uncompressed/workplace/index.js | |||
@@ -1,4 +1,3 @@ | |||
1 | "use strict"; | 1 | "use strict"; |
2 | 2 | ||
3 | module.exports = Franz => Franz; | 3 | module.exports = Franz => Franz; \ No newline at end of file |
4 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndvcmtwbGFjZS9pbmRleC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiXSwibWFwcGluZ3MiOiI7O0FBQUFBLE9BQU9DLE9BQVAsR0FBaUJDLFNBQVNBLEtBQTFCIiwiZmlsZSI6IndvcmtwbGFjZS9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gRnJhbnogPT4gRnJhbno7XG4iXX0= \ No newline at end of file | ||
diff --git a/uncompressed/workplace/package.json b/uncompressed/workplace/package.json index 596daea..cb2193f 100644 --- a/uncompressed/workplace/package.json +++ b/uncompressed/workplace/package.json | |||
@@ -1,16 +1,16 @@ | |||
1 | { | 1 | { |
2 | "id": "workplace", | 2 | "id": "workplace", |
3 | "name": "Workplace", | 3 | "name": "Workplace", |
4 | "version": "1.0.0", | 4 | "version": "1.1.1", |
5 | "description": "Workplace by facebook", | 5 | "description": "Workplace by facebook", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Rico Herwig <rherwig4711@gmail.com>", | 7 | "author": "Rico Herwig <rherwig4711@gmail.com>, Stefan Malzner <stefan@adlk.io>", |
8 | "license": "MIT", | 8 | "license": "MIT", |
9 | "config": { | 9 | "config": { |
10 | "serviceURL": "https://{teamId}.facebook.com/chat", | 10 | "serviceURL": "https://{teamId}.workplace.com/chat", |
11 | "hasNotificationSound": true, | 11 | "hasNotificationSound": true, |
12 | "hasDirectMessages": true, | 12 | "hasDirectMessages": true, |
13 | "hasTeamId": true, | 13 | "hasTeamId": true, |
14 | "urlInputSuffix": ".facebook.com" | 14 | "urlInputSuffix": ".workplace.com" |
15 | } | 15 | } |
16 | } \ No newline at end of file | 16 | } |
diff --git a/uncompressed/workplace/webview.js b/uncompressed/workplace/webview.js index c1df892..a26515e 100644 --- a/uncompressed/workplace/webview.js +++ b/uncompressed/workplace/webview.js | |||
@@ -1,16 +1,51 @@ | |||
1 | 'use strict'; | 1 | "use strict"; |
2 | 2 | ||
3 | const path = require('path'); | 3 | const path = require('path'); |
4 | 4 | ||
5 | module.exports = Franz => { | 5 | module.exports = Franz => { |
6 | const getMessages = () => { | 6 | const getMessages = () => { |
7 | const $messages = document.querySelector('.uiScrollableAreaContent'); | 7 | let direct = 0; |
8 | const $unreadMessages = $messages.querySelectorAll('._1ht3 ._1ht6'); | 8 | let indirect = 0; |
9 | const chatsElement = document.querySelector('#chats'); | ||
10 | const notifications = document.querySelector('#notifications span span'); | ||
9 | 11 | ||
10 | Franz.setBadge($unreadMessages.length); | 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); | ||
11 | }; | 29 | }; |
12 | 30 | ||
13 | Franz.injectCSS(path.join(__dirname, 'workplace.css')); | 31 | Franz.injectCSS(path.join(__dirname, 'workplace.css')); |
14 | Franz.loop(getMessages); | 32 | Franz.loop(getMessages); |
15 | }; | 33 | localStorage._cs_desktopNotifsEnabled = JSON.stringify({ |
16 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndvcmtwbGFjZS93ZWJ2aWV3LmpzIl0sIm5hbWVzIjpbInBhdGgiLCJyZXF1aXJlIiwibW9kdWxlIiwiZXhwb3J0cyIsIkZyYW56IiwiZ2V0TWVzc2FnZXMiLCIkbWVzc2FnZXMiLCJkb2N1bWVudCIsInF1ZXJ5U2VsZWN0b3IiLCIkdW5yZWFkTWVzc2FnZXMiLCJxdWVyeVNlbGVjdG9yQWxsIiwic2V0QmFkZ2UiLCJsZW5ndGgiLCJpbmplY3RDU1MiLCJqb2luIiwiX19kaXJuYW1lIiwibG9vcCJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxNQUFNQSxPQUFPQyxRQUFRLE1BQVIsQ0FBYjs7QUFFQUMsT0FBT0MsT0FBUCxHQUFrQkMsS0FBRCxJQUFXO0FBQzFCLFFBQU1DLGNBQWMsTUFBTTtBQUN4QixVQUFNQyxZQUFZQyxTQUFTQyxhQUFULENBQXVCLDBCQUF2QixDQUFsQjtBQUNBLFVBQU1DLGtCQUFrQkgsVUFBVUksZ0JBQVYsQ0FBMkIsZUFBM0IsQ0FBeEI7O0FBRUFOLFVBQU1PLFFBQU4sQ0FBZUYsZ0JBQWdCRyxNQUEvQjtBQUNELEdBTEQ7O0FBT0FSLFFBQU1TLFNBQU4sQ0FBZ0JiLEtBQUtjLElBQUwsQ0FBVUMsU0FBVixFQUFxQixlQUFyQixDQUFoQjtBQUNBWCxRQUFNWSxJQUFOLENBQVdYLFdBQVg7QUFDRCxDQVZEIiwiZmlsZSI6IndvcmtwbGFjZS93ZWJ2aWV3LmpzIiwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgcGF0aCA9IHJlcXVpcmUoJ3BhdGgnKTtcblxubW9kdWxlLmV4cG9ydHMgPSAoRnJhbnopID0+IHtcbiAgY29uc3QgZ2V0TWVzc2FnZXMgPSAoKSA9PiB7XG4gICAgY29uc3QgJG1lc3NhZ2VzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcignLnVpU2Nyb2xsYWJsZUFyZWFDb250ZW50Jyk7XG4gICAgY29uc3QgJHVucmVhZE1lc3NhZ2VzID0gJG1lc3NhZ2VzLnF1ZXJ5U2VsZWN0b3JBbGwoJy5fMWh0MyAuXzFodDYnKTtcblxuICAgIEZyYW56LnNldEJhZGdlKCR1bnJlYWRNZXNzYWdlcy5sZW5ndGgpO1xuICB9O1xuXG4gIEZyYW56LmluamVjdENTUyhwYXRoLmpvaW4oX19kaXJuYW1lLCAnd29ya3BsYWNlLmNzcycpKTtcbiAgRnJhbnoubG9vcChnZXRNZXNzYWdlcyk7XG59O1xuIl19 \ No newline at end of file | 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 | ||