diff options
author | 2021-10-05 17:04:09 +0200 | |
---|---|---|
committer | 2021-10-05 17:04:09 +0200 | |
commit | d3841b766f9d37d557646003899f67525c5f755f (patch) | |
tree | 1bcab990c94f2b05678b7a83ffebe08298500f0b /recipes/google-voice/webview.js | |
parent | chore: repo maintenance (#732) (diff) | |
download | ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.tar.gz ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.tar.zst ferdium-recipes-d3841b766f9d37d557646003899f67525c5f755f.zip |
chore: add eslint-plugin-unicorn (#733)
Diffstat (limited to 'recipes/google-voice/webview.js')
-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"]', |