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/webview.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'recipes/office365-owa/webview.js') 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