diff options
Diffstat (limited to 'recipes/home-assistant/webview.js')
-rw-r--r-- | recipes/home-assistant/webview.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/recipes/home-assistant/webview.js b/recipes/home-assistant/webview.js index a449cc4..7a0ab47 100644 --- a/recipes/home-assistant/webview.js +++ b/recipes/home-assistant/webview.js | |||
@@ -1,12 +1,12 @@ | |||
1 | module.exports = Ferdium => { | 1 | module.exports = Ferdium => { |
2 | const getMessages = () => { | 2 | const getMessages = () => { |
3 | const badges = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-sidebar").shadowRoot.querySelectorAll(".notification-badge"); | 3 | const badges = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-sidebar").shadowRoot.querySelectorAll(".notification-badge"); |
4 | if (badges.length > 0) { | 4 | if (badges.length > 0) { |
5 | var count = Ferdium.safeParseInt(badges[0].textContent.replace(/[^\p{N}]/gu, '')); | 5 | var count = Ferdium.safeParseInt(badges[0].textContent.replace(/[^\p{N}]/gu, '')); |
6 | Ferdium.setBadge(count) | 6 | Ferdium.setBadge(count) |
7 | } else { | 7 | } else { |
8 | Ferdium.setBadge(0) | 8 | Ferdium.setBadge(0) |
9 | } | 9 | } |
10 | }; | 10 | }; |
11 | Ferdium.loop(getMessages); | 11 | Ferdium.loop(getMessages); |
12 | }; | 12 | }; |