diff options
Diffstat (limited to 'recipes/gmail')
-rw-r--r-- | recipes/gmail/package.json | 2 | ||||
-rw-r--r-- | recipes/gmail/webview.js | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/recipes/gmail/package.json b/recipes/gmail/package.json index 518f856..ffb7757 100644 --- a/recipes/gmail/package.json +++ b/recipes/gmail/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "gmail", | 2 | "id": "gmail", |
3 | "name": "Gmail", | 3 | "name": "Gmail", |
4 | "version": "1.5.1", | 4 | "version": "1.6.0", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://mail.google.com" | 7 | "serviceURL": "https://mail.google.com" |
diff --git a/recipes/gmail/webview.js b/recipes/gmail/webview.js index fb8cf76..dead877 100644 --- a/recipes/gmail/webview.js +++ b/recipes/gmail/webview.js | |||
@@ -1,13 +1,13 @@ | |||
1 | const _path = _interopRequireDefault(require('path')); | ||
2 | |||
3 | function _interopRequireDefault(obj) { | 1 | function _interopRequireDefault(obj) { |
4 | return obj && obj.__esModule ? obj : { default: obj }; | 2 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 3 | } |
6 | 4 | ||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
8 | // if the user is on gmail's landing page, go to the login page. | 8 | // if the user is on gmail's landing page, go to the login page. |
9 | if ( | 9 | if ( |
10 | location.hostname == 'www.google.com' && | 10 | location.hostname === 'www.google.com' && |
11 | location.href.includes('gmail/about/') | 11 | location.href.includes('gmail/about/') |
12 | ) { | 12 | ) { |
13 | location.href = | 13 | location.href = |
@@ -19,22 +19,22 @@ module.exports = Ferdium => { | |||
19 | let countNonImportant = 0; | 19 | let countNonImportant = 0; |
20 | const inboxLinks = document.querySelectorAll('.J-Ke.n0'); | 20 | const inboxLinks = document.querySelectorAll('.J-Ke.n0'); |
21 | if (inboxLinks.length > 0) { | 21 | if (inboxLinks.length > 0) { |
22 | let parentNode = inboxLinks[0].parentNode; | 22 | const { parentNode } = inboxLinks[0]; |
23 | if (parentNode) { | 23 | if (parentNode) { |
24 | let parentNodeOfParentNode = parentNode.parentNode; | 24 | const parentNodeOfParentNode = parentNode.parentNode; |
25 | if (parentNodeOfParentNode) { | 25 | if (parentNodeOfParentNode) { |
26 | const unreadCounts = parentNodeOfParentNode.querySelectorAll('.bsU'); | 26 | const unreadCounts = parentNodeOfParentNode.querySelectorAll('.bsU'); |
27 | if (unreadCounts.length > 0) { | 27 | if (unreadCounts.length > 0) { |
28 | let unreadCount = unreadCounts[0].textContent; | 28 | const unreadCount = unreadCounts[0].textContent; |
29 | if (unreadCount.includes(':')) { | 29 | if (unreadCount.includes(':')) { |
30 | let counts = unreadCount | 30 | const counts = unreadCount |
31 | .split(':') | 31 | .split(':') |
32 | .map(s => Ferdium.safeParseInt(s.replace(/[^\p{N}]/gu, ''))); | 32 | .map(s => Ferdium.safeParseInt(s.replaceAll(/[^\p{N}]/gu, ''))); |
33 | countImportant = counts[0]; | 33 | countImportant = counts[0]; |
34 | countNonImportant = counts[1] - counts[0]; | 34 | countNonImportant = counts[1] - counts[0]; |
35 | } else { | 35 | } else { |
36 | countImportant = Ferdium.safeParseInt( | 36 | countImportant = Ferdium.safeParseInt( |
37 | unreadCount.replace(/[^\p{N}]/gu, ''), | 37 | unreadCount.replaceAll(/[^\p{N}]/gu, ''), |
38 | ); | 38 | ); |
39 | } | 39 | } |
40 | } | 40 | } |