From 822c5680c0461c90468cd8a69a37e3354376c73c Mon Sep 17 00:00:00 2001 From: Cromefire_ Date: Tue, 5 Jan 2021 22:59:23 +0100 Subject: Synchronize Outlook services and correct message count (#398) --- recipes/office365-owa/README.md | 8 ++++---- recipes/office365-owa/index.js | 4 ++-- recipes/office365-owa/package.json | 2 +- recipes/office365-owa/webview.js | 15 ++++++++------- 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'recipes/office365-owa') diff --git a/recipes/office365-owa/README.md b/recipes/office365-owa/README.md index a35ef46..0aca27b 100644 --- a/recipes/office365-owa/README.md +++ b/recipes/office365-owa/README.md @@ -1,5 +1,5 @@ -# Office 365 Outlook Web App for Franz -This is the Franz 5 Recipe for Office 365 Outlook Web App +# Office 365 Outlook Web App for Ferdi +This is the Ferdi 5 Recipe for Office 365 Outlook Web App -### How to create your own Franz recipes: -* [Read the documentation](https://github.com/meetfranz/plugins) +### How to create your own Ferdi recipes: +* [Read the documentation](https://github.com/getferdi/recipes/blob/master/docs/integration.md.) diff --git a/recipes/office365-owa/index.js b/recipes/office365-owa/index.js index ce5229a..12994ff 100644 --- a/recipes/office365-owa/index.js +++ b/recipes/office365-owa/index.js @@ -1,7 +1,7 @@ var os = require('os') -module.exports = Franz => - class Owa extends Franz { +module.exports = Ferdi => + class Outlook extends Ferdi { overrideUserAgent() { return window.navigator.userAgent.replace(/(Ferdi|Electron)\/\S+ \([^)]+\)/g,"").trim(); } diff --git a/recipes/office365-owa/package.json b/recipes/office365-owa/package.json index 1ffb2ee..35c4647 100644 --- a/recipes/office365-owa/package.json +++ b/recipes/office365-owa/package.json @@ -10,7 +10,7 @@ ], "license": "MIT", "config": { - "serviceURL": "https://outlook.office365.com/owa", + "serviceURL": "https://outlook.office365.com/mail/", "hasNotificationSound": true, "hasTeamId": false } diff --git a/recipes/office365-owa/webview.js b/recipes/office365-owa/webview.js index ae21e19..6d4edf2 100644 --- a/recipes/office365-owa/webview.js +++ b/recipes/office365-owa/webview.js @@ -1,7 +1,7 @@ 'use strict'; -module.exports = Franz => { - const getMessages = function getMessages() { +module.exports = Ferdi => { + function getMessages() { let unreadMail = 0; if (location.pathname.match(/\/owa/)) { @@ -14,12 +14,13 @@ module.exports = Franz => { ); } else { // new app - const folders = document.querySelector('div[title="Folders"]'); - if (!folders) { + const favorites = document.querySelector('div[title="Favorites"]'); + if (!favorites) { return; } + const folders = Array.from(favorites.nextSibling.childNodes); - unreadMail = [...folders.parentNode.parentNode.children].reduce((count, child) => { + unreadMail = folders.reduce((count, child) => { const unread = child.querySelector('.screenReaderOnly'); return unread && unread.textContent === 'unread' ? count + parseInt(unread.previousSibling.textContent, 10) @@ -27,7 +28,7 @@ module.exports = Franz => { }, 0); } - Franz.setBadge(unreadMail); + Ferdi.setBadge(unreadMail); }; - Franz.loop(getMessages); + Ferdi.loop(getMessages); }; -- cgit v1.2.3-70-g09d2