aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/google-voice/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/google-voice/webview.js')
-rw-r--r--recipes/google-voice/webview.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/recipes/google-voice/webview.js b/recipes/google-voice/webview.js
index 876ec1d..d589f28 100644
--- a/recipes/google-voice/webview.js
+++ b/recipes/google-voice/webview.js
@@ -1,3 +1,9 @@
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 function parseQuery(query) { 8 function parseQuery(query) {
3 const el = document.querySelector(query); 9 const el = document.querySelector(query);
@@ -9,22 +15,24 @@ module.exports = Ferdium => {
9 let count; 15 let count;
10 16
11 if (el && el.textContent) { 17 if (el && el.textContent) {
12 count = Ferdium.safeParseInt(el.textContent.replace(/[ ()]/gi, '')); 18 count = Ferdium.safeParseInt(el.textContent.replaceAll(/[ ()]/gi, ''));
13 } else { 19 } else {
14 const count_messages = parseQuery( 20 const countMessages = parseQuery(
15 'gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]', 21 'gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]',
16 ); 22 );
17 const count_calls = parseQuery( 23 const countCalls = parseQuery(
18 'gv-nav-tab[tooltip="Calls"] div[aria-label="Unread count"]', 24 'gv-nav-tab[tooltip="Calls"] div[aria-label="Unread count"]',
19 ); 25 );
20 const count_voicemails = parseQuery( 26 const countVoicemails = parseQuery(
21 'gv-nav-tab[tooltip="Voicemail"] div[aria-label="Unread count"]', 27 'gv-nav-tab[tooltip="Voicemail"] div[aria-label="Unread count"]',
22 ); 28 );
23 count = count_messages + count_calls + count_voicemails; 29 count = countMessages + countCalls + countVoicemails;
24 } 30 }
25 31
26 Ferdium.setBadge(count); 32 Ferdium.setBadge(count);
27 }; 33 };
28 34
29 Ferdium.loop(getMessages); 35 Ferdium.loop(getMessages);
36
37 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
30}; 38};