diff options
Diffstat (limited to 'recipes/zoho/webview.js')
-rw-r--r-- | recipes/zoho/webview.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/recipes/zoho/webview.js b/recipes/zoho/webview.js index 177ea4c..7c833a3 100644 --- a/recipes/zoho/webview.js +++ b/recipes/zoho/webview.js | |||
@@ -1,10 +1,23 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
1 | module.exports = (Ferdi) => { | 5 | module.exports = (Ferdi) => { |
2 | const getMessages = () => { | 6 | const getMessages = () => { |
3 | const unreadMailInCurrentFolder = $('.zmList.zmLUrd').length; | 7 | Ferdi.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); |
4 | const unreadMailAnyware = $('#zmlTree .zmTreeNDWra .zmBold').length; | ||
5 | |||
6 | Ferdi.setBadge(unreadMailInCurrentFolder, unreadMailAnyware); | ||
7 | }; | 8 | }; |
8 | 9 | ||
10 | //Zoho uses different URLs for different regions. Find out which region the account belongs to and redirect to the correct URL. | ||
11 | const redirectRegion = () => { | ||
12 | if (window.location.href === "https://www.zoho.com/mail/login.html") { | ||
13 | const btn = document.querySelectorAll(".access-apps"); | ||
14 | if (btn.length > 0) { | ||
15 | window.location.assign(btn[0].href + "zm/"); | ||
16 | } | ||
17 | } | ||
18 | } | ||
19 | |||
20 | window.addEventListener('load', redirectRegion); | ||
9 | Ferdi.loop(getMessages); | 21 | Ferdi.loop(getMessages); |
22 | |||
10 | }; | 23 | }; |