diff options
Diffstat (limited to 'recipes/google-voice')
-rw-r--r-- | recipes/google-voice/webview.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/recipes/google-voice/webview.js b/recipes/google-voice/webview.js index eb3004d..8b2d2b3 100644 --- a/recipes/google-voice/webview.js +++ b/recipes/google-voice/webview.js | |||
@@ -1,16 +1,15 @@ | |||
1 | module.exports = Ferdi => { | 1 | module.exports = Ferdi => { |
2 | function parseQuery(query) { | 2 | function parseQuery(query) { |
3 | const el = document.querySelector(query); | 3 | const el = document.querySelector(query); |
4 | return el && Ferdi.safeParseInt(el.innerHTML); | 4 | return el && Ferdi.safeParseInt(el.textContent); |
5 | } | 5 | } |
6 | 6 | ||
7 | const getMessages = () => { | 7 | const getMessages = () => { |
8 | const el = document.querySelector('.msgCount'); | 8 | const el = document.querySelector('.msgCount'); |
9 | let count; | 9 | let count; |
10 | 10 | ||
11 | if (el) { | 11 | if (el && el.textContent) { |
12 | // eslint-disable-next-line no-useless-escape | 12 | count = Ferdi.safeParseInt(el.textContent.replace(/[ ()]/gi, '')); |
13 | count = Ferdi.safeParseInt(el.innerHTML.replace(/[\(\) ]/gi, '')); | ||
14 | } else { | 13 | } else { |
15 | const count_messages = parseQuery( | 14 | const count_messages = parseQuery( |
16 | 'gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]', | 15 | 'gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]', |