diff options
Diffstat (limited to 'uncompressed/gmail/webview.js')
-rw-r--r-- | uncompressed/gmail/webview.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/uncompressed/gmail/webview.js b/uncompressed/gmail/webview.js new file mode 100644 index 0000000..521d4ad --- /dev/null +++ b/uncompressed/gmail/webview.js | |||
@@ -0,0 +1,23 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | const getMessages = function getMessages() { | ||
5 | let count = 0; | ||
6 | |||
7 | if (document.getElementsByClassName('J-Ke n0').length > 0) { | ||
8 | if (document.getElementsByClassName('J-Ke n0')[0].getAttribute('aria-label') != null) { | ||
9 | count = parseInt(document.getElementsByClassName('J-Ke n0')[0].getAttribute('aria-label').replace(/[^0-9.]/g, ''), 10); | ||
10 | } | ||
11 | } | ||
12 | |||
13 | count = parseInt(count, 10); | ||
14 | |||
15 | if (isNaN(count)) { | ||
16 | count = 0; | ||
17 | } | ||
18 | |||
19 | Franz.setBadge(count); | ||
20 | }; | ||
21 | |||
22 | Franz.loop(getMessages); | ||
23 | }; \ No newline at end of file | ||