aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/infomaniak-mail
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/infomaniak-mail')
-rw-r--r--recipes/infomaniak-mail/package.json2
-rw-r--r--recipes/infomaniak-mail/webview.js22
2 files changed, 19 insertions, 5 deletions
diff --git a/recipes/infomaniak-mail/package.json b/recipes/infomaniak-mail/package.json
index a90ce82..b3925f3 100644
--- a/recipes/infomaniak-mail/package.json
+++ b/recipes/infomaniak-mail/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "infomaniak-mail", 2 "id": "infomaniak-mail",
3 "name": "Infomaniak Mail", 3 "name": "Infomaniak Mail",
4 "version": "1.3.0", 4 "version": "1.4.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://mail.infomaniak.com/" 7 "serviceURL": "https://mail.infomaniak.com/"
diff --git a/recipes/infomaniak-mail/webview.js b/recipes/infomaniak-mail/webview.js
index 23516b2..5af4d25 100644
--- a/recipes/infomaniak-mail/webview.js
+++ b/recipes/infomaniak-mail/webview.js
@@ -1,10 +1,18 @@
1function _interopRequireDefault(obj) {
2 return obj && obj.__esModule ? obj : { default: obj };
3}
4
5const _path = _interopRequireDefault(require('path'));
6
1module.exports = Ferdium => { 7module.exports = Ferdium => {
2 const getMessages = () => { 8 const getMessages = () => {
3 // This selects the first folder (the inbox and reads its unread messages count) 9 // This selects the first folder (the inbox and reads its unread messages count)
4 const inboxField = document.querySelector('.ws-tree-node-content') 10 const inboxField = document.querySelector('.ws-tree-node-content');
5 const inboxCountField = inboxField.querySelector('.ws-tree-node-badge'); 11 const inboxCountField = inboxField.querySelector('.ws-tree-node-badge');
6 const inboxCountText = inboxCountField ? inboxCountField.textContent : null; 12 const inboxCountText = inboxCountField ? inboxCountField.textContent : null;
7 const inboxCount = inboxCountText ? Ferdium.safeParseInt(inboxCountText) : 0; 13 const inboxCount = inboxCountText
14 ? Ferdium.safeParseInt(inboxCountText)
15 : 0;
8 16
9 let unimportantCount = 0; 17 let unimportantCount = 0;
10 18
@@ -12,12 +20,18 @@ module.exports = Ferdium => {
12 // This selects the first folder with an unread message count. 20 // This selects the first folder with an unread message count.
13 // The actaul count and the total of all other folders is not needed as the badge has no number. 21 // The actaul count and the total of all other folders is not needed as the badge has no number.
14 const totalCountField = document.querySelector('.ws-tree-node-badge'); 22 const totalCountField = document.querySelector('.ws-tree-node-badge');
15 const totalCountText = totalCountField ? totalCountField.textContent : null; 23 const totalCountText = totalCountField
16 unimportantCount = totalCountText ? Ferdium.safeParseInt(totalCountText) : 0; 24 ? totalCountField.textContent
25 : null;
26 unimportantCount = totalCountText
27 ? Ferdium.safeParseInt(totalCountText)
28 : 0;
17 } 29 }
18 30
19 Ferdium.setBadge(inboxCount, unimportantCount); 31 Ferdium.setBadge(inboxCount, unimportantCount);
20 }; 32 };
21 33
22 Ferdium.loop(getMessages); 34 Ferdium.loop(getMessages);
35
36 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
23}; 37};