diff options
author | 2020-09-22 20:56:48 +0200 | |
---|---|---|
committer | 2020-09-22 19:56:48 +0100 | |
commit | 6f5e4a00588aefdda7a5a1cfe70935870e7e234a (patch) | |
tree | 9e29aa7aa0620a1a4a968ff8739b4b8ba96791a9 /uncompressed/gmail/webview.js | |
parent | Updated logos for Outlook/OWA (diff) | |
download | ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.gz ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.tar.zst ferdium-recipes-6f5e4a00588aefdda7a5a1cfe70935870e7e234a.zip |
Unpack recipes and update recipes icons (#292)
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'uncompressed/gmail/webview.js')
-rw-r--r-- | uncompressed/gmail/webview.js | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/uncompressed/gmail/webview.js b/uncompressed/gmail/webview.js deleted file mode 100644 index 95d28e7..0000000 --- a/uncompressed/gmail/webview.js +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | const path = require("path"); | ||
2 | |||
3 | module.exports = (Franz) => { | ||
4 | // if the user is on gmail's landing page, go to the login page. | ||
5 | if (location.hostname == 'www.google.com' && location.href.includes("gmail/about/")) { | ||
6 | location.href = 'https://accounts.google.com/AccountChooser?service=mail&continue=https://mail.google.com/mail/'; | ||
7 | } | ||
8 | |||
9 | const getMessages = function getMessages() { | ||
10 | let count = 0; | ||
11 | |||
12 | if (document.getElementsByClassName('J-Ke n0').length > 0) { | ||
13 | if (document.getElementsByClassName('J-Ke n0')[0].getAttribute('aria-label') != null) { | ||
14 | count = parseInt(document.getElementsByClassName('J-Ke n0')[0].getAttribute('aria-label').replace(/[^0-9.]/g, ''), 10); | ||
15 | } | ||
16 | } | ||
17 | |||
18 | // Just incase we don't end up with a number, set it back to zero (parseInt can return NaN) | ||
19 | count = parseInt(count, 10); | ||
20 | if (isNaN(count)) { | ||
21 | count = 0; | ||
22 | } | ||
23 | |||
24 | // set Franz badge | ||
25 | Franz.setBadge(count); | ||
26 | }; | ||
27 | |||
28 | Franz.injectCSS(path.join(__dirname, 'service.css')); | ||
29 | // check for new messages every second and update Franz badge | ||
30 | Franz.loop(getMessages); | ||
31 | }; | ||