From 54f3affd80401051db8464d6bed8ad4ed1e66fd1 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Tue, 7 Jun 2022 17:01:37 +0100 Subject: Add webview.js to some services that were generated without it. (#42) This had blocked users from manually generating a `service.css` which is what the documentation recommends as self-help to override styling. Co-authored-by: Vijay A --- recipes/home-assistant/package.json | 2 +- recipes/home-assistant/webview.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'recipes/home-assistant') diff --git a/recipes/home-assistant/package.json b/recipes/home-assistant/package.json index 60e06e0..0a8ad6a 100644 --- a/recipes/home-assistant/package.json +++ b/recipes/home-assistant/package.json @@ -1,7 +1,7 @@ { "id": "home-assistant", "name": "Home Assistant", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "config": { "hasCustomUrl": true, 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 @@ module.exports = Ferdium => { - const getMessages = () => { - const badges = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-sidebar").shadowRoot.querySelectorAll(".notification-badge"); - if (badges.length > 0) { - var count = Ferdium.safeParseInt(badges[0].textContent.replace(/[^\p{N}]/gu, '')); - Ferdium.setBadge(count) - } else { - Ferdium.setBadge(0) - } - }; - Ferdium.loop(getMessages); + const getMessages = () => { + const badges = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-sidebar").shadowRoot.querySelectorAll(".notification-badge"); + if (badges.length > 0) { + var count = Ferdium.safeParseInt(badges[0].textContent.replace(/[^\p{N}]/gu, '')); + Ferdium.setBadge(count) + } else { + Ferdium.setBadge(0) + } + }; + Ferdium.loop(getMessages); }; -- cgit v1.2.3-54-g00ecf