From 7ee9d36331b5fe1027870062278732a84f2d2214 Mon Sep 17 00:00:00 2001 From: Marius <33354141+Mariusthvdb@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:06:50 +0200 Subject: [PATCH] fix more-info with 2023.9 (#100) * Update update_more_info.js to be compatible with 2023.9 thanks to @elchininet from the amazing Kiosk-mode custom card for fixing this in https://github.com/NemesisRE/kiosk-mode/discussions/98#discussioncomment-6888224 * Update update_more_info.js --- update_more_info.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/update_more_info.js b/update_more_info.js index 7839fab..db1ff14 100644 --- a/update_more_info.js +++ b/update_more_info.js @@ -1,5 +1,5 @@ const Name = "Update more-info"; -const Version = "20230628"; +const Version = "20230906"; const Description = "standalone"; const Url = "https://github.com/Mariusthvdb/custom-ui"; @@ -63,10 +63,15 @@ function updateMoreInfo(ev) { let e; for (const node of t) { const o = node.getElementsByClassName("key")[0]; + // make compatible for both 2023.8 and 2023.9 if (o.innerText.toLowerCase().trim() == "hide attributes") { - e = o.parentNode - .getElementsByClassName("value")[0] - .innerText.split(",") + const valueContainer = o.parentNode.getElementsByClassName("value")[0]; + const haAttributeValue = valueContainer.querySelector('ha-attribute-value'); + const text = haAttributeValue + ? haAttributeValue.shadowRoot.textContent + : valueContainer.innerText; + e = text + .split(",") .map((item) => item.replace("_", " ").trim()); e.push("hide attributes"); }