diff options
author | 2020-03-06 11:31:16 +0100 | |
---|---|---|
committer | 2020-03-06 11:31:16 +0100 | |
commit | f6353a457cca3feaedb340cddd0eb5d03ee3f4e9 (patch) | |
tree | 69bde67f287915f1b28f52162dfc0db5e04c642a /uncompressed/office365-owa/webview.js | |
parent | Remove unneeded workflows (diff) | |
download | ferdium-recipes-f6353a457cca3feaedb340cddd0eb5d03ee3f4e9.tar.gz ferdium-recipes-f6353a457cca3feaedb340cddd0eb5d03ee3f4e9.tar.zst ferdium-recipes-f6353a457cca3feaedb340cddd0eb5d03ee3f4e9.zip |
#34 Switch Office 365 Outlook recipe
Diffstat (limited to 'uncompressed/office365-owa/webview.js')
-rw-r--r-- | uncompressed/office365-owa/webview.js | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/uncompressed/office365-owa/webview.js b/uncompressed/office365-owa/webview.js index fa2e187..e144c46 100644 --- a/uncompressed/office365-owa/webview.js +++ b/uncompressed/office365-owa/webview.js | |||
@@ -1,10 +1,33 @@ | |||
1 | "use strict"; | 1 | 'use strict'; |
2 | 2 | ||
3 | module.exports = Franz => { | 3 | module.exports = Franz => { |
4 | const getMessages = function getMessages() { | 4 | const getMessages = function getMessages() { |
5 | const unreadMail = parseInt(jQuery("span[title*='Inbox'] + div > span").first().text(), 10); | 5 | let unreadMail = 0; |
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 folders = document.querySelector('div[title="Folders"]'); | ||
18 | if (!folders) { | ||
19 | return; | ||
20 | } | ||
21 | |||
22 | unreadMail = [...folders.parentNode.children].reduce((count, child) => { | ||
23 | const unread = child.querySelector('.screenReaderOnly'); | ||
24 | return unread && unread.textContent === 'unread' | ||
25 | ? count + parseInt(unread.previousSibling.textContent, 10) | ||
26 | : count; | ||
27 | }, 0); | ||
28 | } | ||
29 | |||
6 | Franz.setBadge(unreadMail); | 30 | Franz.setBadge(unreadMail); |
7 | }; | 31 | }; |
8 | Franz.loop(getMessages); | 32 | Franz.loop(getMessages); |
9 | }; | 33 | }; |
10 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9mZmljZTM2NS1vd2Evd2Vidmlldy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiLCJnZXRNZXNzYWdlcyIsInVucmVhZE1haWwiLCJwYXJzZUludCIsImpRdWVyeSIsImZpcnN0IiwidGV4dCIsInNldEJhZGdlIiwibG9vcCJdLCJtYXBwaW5ncyI6Ijs7QUFBQUEsT0FBT0MsT0FBUCxHQUFrQkMsS0FBRCxJQUFXO0FBQzFCLFFBQU1DLGNBQWMsU0FBU0EsV0FBVCxHQUF1QjtBQUN6QyxVQUFNQyxhQUFhQyxTQUFTQyxPQUFPLG1DQUFQLEVBQTRDQyxLQUE1QyxHQUFvREMsSUFBcEQsRUFBVCxFQUFxRSxFQUFyRSxDQUFuQjtBQUNBTixVQUFNTyxRQUFOLENBQWVMLFVBQWY7QUFDRCxHQUhEO0FBSUFGLFFBQU1RLElBQU4sQ0FBV1AsV0FBWDtBQUNELENBTkQiLCJmaWxlIjoib2ZmaWNlMzY1LW93YS93ZWJ2aWV3LmpzIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoRnJhbnopID0+IHtcbiAgY29uc3QgZ2V0TWVzc2FnZXMgPSBmdW5jdGlvbiBnZXRNZXNzYWdlcygpIHtcbiAgICBjb25zdCB1bnJlYWRNYWlsID0gcGFyc2VJbnQoalF1ZXJ5KFwic3Bhblt0aXRsZSo9J0luYm94J10gKyBkaXYgPiBzcGFuXCIpLmZpcnN0KCkudGV4dCgpLCAxMCk7XG4gICAgRnJhbnouc2V0QmFkZ2UodW5yZWFkTWFpbCk7XG4gIH07XG4gIEZyYW56Lmxvb3AoZ2V0TWVzc2FnZXMpO1xufTtcbiJdfQ== \ No newline at end of file | ||