aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/outlook/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/outlook/webview.js')
-rw-r--r--recipes/outlook/webview.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/recipes/outlook/webview.js b/recipes/outlook/webview.js
deleted file mode 100644
index 123158e..0000000
--- a/recipes/outlook/webview.js
+++ /dev/null
@@ -1,33 +0,0 @@
1module.exports = Ferdi => {
2 function getMessages() {
3 let unreadMail = 0;
4
5 if (location.pathname.match(/\/owa/)) {
6 // classic app
7 unreadMail = parseInt(
8 jQuery("span[title*='Inbox'] + div > span")
9 .first()
10 .text(),
11 10,
12 );
13 } else {
14 // new app
15 const favorites = document.querySelector('div[title="Favorites"]');
16 if (!favorites) {
17 return;
18 }
19 const folders = Array.from(favorites.nextSibling.childNodes);
20
21 unreadMail = folders.reduce((count, child) => {
22 const unread = child.querySelector('.screenReaderOnly');
23 return unread && unread.textContent === 'unread'
24 ? count + parseInt(unread.previousSibling.textContent, 10)
25 : count;
26 }, 0);
27 }
28
29 Ferdi.setBadge(unreadMail);
30 }
31
32 Ferdi.loop(getMessages);
33};