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.js38
1 files changed, 31 insertions, 7 deletions
diff --git a/recipes/outlook/webview.js b/recipes/outlook/webview.js
index 7e30fe4..6d4edf2 100644
--- a/recipes/outlook/webview.js
+++ b/recipes/outlook/webview.js
@@ -1,10 +1,34 @@
1"use strict"; 1'use strict';
2 2
3module.exports = Franz => { 3module.exports = Ferdi => {
4 const getMessages = function getMessages() { 4 function getMessages() {
5 const unreadMail = parseInt(jQuery("i[data-icon-name='Inbox'] + span + span > span").first().text(), 10); 5 let unreadMail = 0;
6 Franz.setBadge(unreadMail); 6
7 if (location.pathname.match(/\/owa/)) {
8 // classic app
9 unreadMail = parseInt(
10 jQuery("span[title*='Inbox'] + div > span")
11 .first()
12 .text(),
13 10
14 );
15 } else {
16 // new app
17 const favorites = document.querySelector('div[title="Favorites"]');
18 if (!favorites) {
19 return;
20 }
21 const folders = Array.from(favorites.nextSibling.childNodes);
22
23 unreadMail = folders.reduce((count, child) => {
24 const unread = child.querySelector('.screenReaderOnly');
25 return unread && unread.textContent === 'unread'
26 ? count + parseInt(unread.previousSibling.textContent, 10)
27 : count;
28 }, 0);
29 }
30
31 Ferdi.setBadge(unreadMail);
7 }; 32 };
8 Franz.loop(getMessages); 33 Ferdi.loop(getMessages);
9}; 34};
10//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9mZmljZTM2NS1vd2Evd2Vidmlldy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiLCJnZXRNZXNzYWdlcyIsInVucmVhZE1haWwiLCJwYXJzZUludCIsImpRdWVyeSIsImZpcnN0IiwidGV4dCIsInNldEJhZGdlIiwibG9vcCJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxPQUFPLEFBQVAsVUFBa0IsQUFBRCxTQUFXLEFBQzFCO1FBQU0sY0FBYyxTQUFTLEFBQVQsY0FBdUIsQUFDekM7VUFBTSxhQUFhLFNBQVMsT0FBTyxBQUFQLEFBQTRDLEFBQTVDLEFBQW9ELEFBQXBELGtEQUFULEFBQXFFLEFBQXJFLEFBQW5CLGdCQUNBO1VBQU0sQUFBTixTQUFlLEFBQWYsQUFDRDtBQUhELEFBSUE7UUFBTSxBQUFOLEtBQVcsQUFBWCxBQUNEO0FBTkQiLCJmaWxlIjoib2ZmaWNlMzY1LW93YS93ZWJ2aWV3LmpzIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoRnJhbnopID0+IHtcbiAgY29uc3QgZ2V0TWVzc2FnZXMgPSBmdW5jdGlvbiBnZXRNZXNzYWdlcygpIHtcbiAgICBjb25zdCB1bnJlYWRNYWlsID0gcGFyc2VJbnQoalF1ZXJ5KFwic3Bhblt0aXRsZSo9J0luYm94J10gKyBkaXYgPiBzcGFuXCIpLmZpcnN0KCkudGV4dCgpLCAxMCk7XG4gICAgRnJhbnouc2V0QmFkZ2UodW5yZWFkTWFpbCk7XG4gIH07XG4gIEZyYW56Lmxvb3AoZ2V0TWVzc2FnZXMpO1xufTtcbiJdfQ== \ No newline at end of file