diff options
Diffstat (limited to 'recipes/slite/webview.js')
-rw-r--r-- | recipes/slite/webview.js | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/recipes/slite/webview.js b/recipes/slite/webview.js index d892c3c..a044399 100644 --- a/recipes/slite/webview.js +++ b/recipes/slite/webview.js | |||
@@ -1,15 +1,7 @@ | |||
1 | const getInnerInt = selector => { | ||
2 | const element = document.querySelector(selector); | ||
3 | return element && parseInt(element.innerText); | ||
4 | }; | ||
5 | |||
6 | module.exports = Ferdi => { | 1 | module.exports = Ferdi => { |
7 | const getMessages = function getMessages() { | 2 | const getMessages = function getMessages() { |
8 | const direct = ( | 3 | const element = document.querySelector("#app button[data-test-id='notificationsCount']"); |
9 | getInnerInt("#app button[data-test-id='notificationsCount']") || 0 | 4 | Ferdi.setBadge(element ? Ferdi.safeParseInt(element.innerText) : 0); |
10 | ); | ||
11 | |||
12 | Ferdi.setBadge(direct); | ||
13 | }; | 5 | }; |
14 | 6 | ||
15 | Ferdi.loop(getMessages); | 7 | Ferdi.loop(getMessages); |