From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- recipes/workplace/LICENSE | 19 +++++++++++++++ recipes/workplace/README.md | 4 ++++ recipes/workplace/icon.png | Bin 0 -> 88435 bytes recipes/workplace/icon.svg | 10 ++++++++ recipes/workplace/index.js | 3 +++ recipes/workplace/package.json | 16 +++++++++++++ recipes/workplace/webview.js | 51 ++++++++++++++++++++++++++++++++++++++++ recipes/workplace/workplace.css | 4 ++++ 8 files changed, 107 insertions(+) create mode 100644 recipes/workplace/LICENSE create mode 100644 recipes/workplace/README.md create mode 100644 recipes/workplace/icon.png create mode 100644 recipes/workplace/icon.svg create mode 100644 recipes/workplace/index.js create mode 100644 recipes/workplace/package.json create mode 100644 recipes/workplace/webview.js create mode 100644 recipes/workplace/workplace.css (limited to 'recipes/workplace') diff --git a/recipes/workplace/LICENSE b/recipes/workplace/LICENSE new file mode 100644 index 0000000..4608c00 --- /dev/null +++ b/recipes/workplace/LICENSE @@ -0,0 +1,19 @@ +Copyright 2017 Rico Herwig + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/recipes/workplace/README.md b/recipes/workplace/README.md new file mode 100644 index 0000000..75791ac --- /dev/null +++ b/recipes/workplace/README.md @@ -0,0 +1,4 @@ +# Franz 5 Recipe: Workplace by facebook +This recipe integrates the Workplace Chat by facebook into Franz. + +You can get the latest version of Franz [here](https://meetfranz.com/). \ No newline at end of file diff --git a/recipes/workplace/icon.png b/recipes/workplace/icon.png new file mode 100644 index 0000000..9705dcf Binary files /dev/null and b/recipes/workplace/icon.png differ diff --git a/recipes/workplace/icon.svg b/recipes/workplace/icon.svg new file mode 100644 index 0000000..52bef1d --- /dev/null +++ b/recipes/workplace/icon.svg @@ -0,0 +1,10 @@ + + + + Combined Shape + Created with Sketch. + + + + + \ No newline at end of file diff --git a/recipes/workplace/index.js b/recipes/workplace/index.js new file mode 100644 index 0000000..e8243fb --- /dev/null +++ b/recipes/workplace/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = Franz => Franz; \ No newline at end of file diff --git a/recipes/workplace/package.json b/recipes/workplace/package.json new file mode 100644 index 0000000..cb2193f --- /dev/null +++ b/recipes/workplace/package.json @@ -0,0 +1,16 @@ +{ + "id": "workplace", + "name": "Workplace", + "version": "1.1.1", + "description": "Workplace by facebook", + "main": "index.js", + "author": "Rico Herwig , Stefan Malzner ", + "license": "MIT", + "config": { + "serviceURL": "https://{teamId}.workplace.com/chat", + "hasNotificationSound": true, + "hasDirectMessages": true, + "hasTeamId": true, + "urlInputSuffix": ".workplace.com" + } + } diff --git a/recipes/workplace/webview.js b/recipes/workplace/webview.js new file mode 100644 index 0000000..a26515e --- /dev/null +++ b/recipes/workplace/webview.js @@ -0,0 +1,51 @@ +"use strict"; + +const path = require('path'); + +module.exports = Franz => { + const getMessages = () => { + let direct = 0; + let indirect = 0; + const chatsElement = document.querySelector('#chats'); + const notifications = document.querySelector('#notifications span span'); + + if (notifications) { + indirect = parseInt(notifications.innerText, 10); + } + + if (chatsElement) { + if (!chatsElement.hasAttribute('aria-current')) { + const chatMessages = chatsElement.querySelector('span'); + + if (chatMessages) { + direct = parseInt(chatMessages.innerText, 10); + } + } else { + direct = document.querySelectorAll('[data-pagelet="WorkGalahadChannel"] .uiList [role="gridcell"] [role="button"] .oxk9n0fw').length; + } + } + + Franz.setBadge(direct, indirect); + }; + + Franz.injectCSS(path.join(__dirname, 'workplace.css')); + Franz.loop(getMessages); + localStorage._cs_desktopNotifsEnabled = JSON.stringify({ + __t: new Date().getTime(), + __v: true + }); + + if (typeof Franz.onNotify === 'function') { + Franz.onNotify(notification => { + if (typeof notification.title !== 'string') { + notification.title = ((notification.title.props || {}).content || [])[0] || 'Work Chat'; + } + + if (typeof notification.options.body !== 'string') { + notification.options.body = (((notification.options.body || {}).props || {}).content || [])[0] || ''; + } + + return notification; + }); + } +}; \ No newline at end of file diff --git a/recipes/workplace/workplace.css b/recipes/workplace/workplace.css new file mode 100644 index 0000000..4830348 --- /dev/null +++ b/recipes/workplace/workplace.css @@ -0,0 +1,4 @@ +#pagelet_bluebar, +#pageFooter { + display: none; +} -- cgit v1.2.3-70-g09d2