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/office365-owa/LICENSE | 21 +++++++++++++++++++++ recipes/office365-owa/README.md | 5 +++++ recipes/office365-owa/icon.png | Bin 0 -> 45435 bytes recipes/office365-owa/icon.svg | 1 + recipes/office365-owa/index.js | 1 + recipes/office365-owa/package.json | 17 +++++++++++++++++ recipes/office365-owa/webview.js | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+) create mode 100644 recipes/office365-owa/LICENSE create mode 100644 recipes/office365-owa/README.md create mode 100644 recipes/office365-owa/icon.png create mode 100644 recipes/office365-owa/icon.svg create mode 100644 recipes/office365-owa/index.js create mode 100644 recipes/office365-owa/package.json create mode 100644 recipes/office365-owa/webview.js (limited to 'recipes/office365-owa') diff --git a/recipes/office365-owa/LICENSE b/recipes/office365-owa/LICENSE new file mode 100644 index 0000000..e46b0c5 --- /dev/null +++ b/recipes/office365-owa/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Adam Birds + +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/office365-owa/README.md b/recipes/office365-owa/README.md new file mode 100644 index 0000000..a35ef46 --- /dev/null +++ b/recipes/office365-owa/README.md @@ -0,0 +1,5 @@ +# Office 365 Outlook Web App for Franz +This is the Franz 5 Recipe for Office 365 Outlook Web App + +### How to create your own Franz recipes: +* [Read the documentation](https://github.com/meetfranz/plugins) diff --git a/recipes/office365-owa/icon.png b/recipes/office365-owa/icon.png new file mode 100644 index 0000000..b4281c4 Binary files /dev/null and b/recipes/office365-owa/icon.png differ diff --git a/recipes/office365-owa/icon.svg b/recipes/office365-owa/icon.svg new file mode 100644 index 0000000..a1437c7 --- /dev/null +++ b/recipes/office365-owa/icon.svg @@ -0,0 +1 @@ +OfficeCore10_32x_24x_20x_16x_01-22-2019 \ No newline at end of file diff --git a/recipes/office365-owa/index.js b/recipes/office365-owa/index.js new file mode 100644 index 0000000..9157a2e --- /dev/null +++ b/recipes/office365-owa/index.js @@ -0,0 +1 @@ +module.exports = Franz => Franz; \ No newline at end of file diff --git a/recipes/office365-owa/package.json b/recipes/office365-owa/package.json new file mode 100644 index 0000000..1ffb2ee --- /dev/null +++ b/recipes/office365-owa/package.json @@ -0,0 +1,17 @@ +{ + "id": "office365-owa", + "name": "Office 365 Outlook Web App", + "version": "1.1.1", + "description": "Office 365 Outlook Web App", + "main": "index.js", + "author": "Adam Birds ", + "contributors": [ + "nonAlgebraic " + ], + "license": "MIT", + "config": { + "serviceURL": "https://outlook.office365.com/owa", + "hasNotificationSound": true, + "hasTeamId": false + } +} diff --git a/recipes/office365-owa/webview.js b/recipes/office365-owa/webview.js new file mode 100644 index 0000000..ae21e19 --- /dev/null +++ b/recipes/office365-owa/webview.js @@ -0,0 +1,33 @@ +'use strict'; + +module.exports = Franz => { + const getMessages = function getMessages() { + let unreadMail = 0; + + if (location.pathname.match(/\/owa/)) { + // classic app + unreadMail = parseInt( + jQuery("span[title*='Inbox'] + div > span") + .first() + .text(), + 10 + ); + } else { + // new app + const folders = document.querySelector('div[title="Folders"]'); + if (!folders) { + return; + } + + unreadMail = [...folders.parentNode.parentNode.children].reduce((count, child) => { + const unread = child.querySelector('.screenReaderOnly'); + return unread && unread.textContent === 'unread' + ? count + parseInt(unread.previousSibling.textContent, 10) + : count; + }, 0); + } + + Franz.setBadge(unreadMail); + }; + Franz.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2