Skip to content

Commit

Permalink
Fixed DOM walk for 2022.11 (#66)
Browse files Browse the repository at this point in the history
and make hide_attributes work again
  • Loading branch information
alexarch21 authored Nov 15, 2022
1 parent 2ea37d4 commit db3e642
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ window.customUI = window.customUI || {
{
var moreInfoNodeName;
var contentChild;
contentChild = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("more-info-content").childNodes;
contentChild = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("ha-more-info-info").shadowRoot.querySelector("more-info-content").childNodes;
for (var c = 0; c < contentChild.length; c++) {
var nodeItem = contentChild.item(c);
if (nodeItem.nodeName.toLowerCase().startsWith("more-info-")) {
Expand All @@ -65,17 +65,17 @@ window.customUI = window.customUI || {
if (moreInfoNodeName == "more-info-group") {
var moreInfoNestedNodeName;
var contentChildNested;
contentChildNested = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("more-info-group").shadowRoot.childNodes;
contentChildNested = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("ha-more-info-info").shadowRoot.querySelector("more-info-group").shadowRoot.childNodes;
for (var c = 0; c < contentChildNested.length; c++) {
var nodeItemNested = contentChildNested.item(c);

if (nodeItemNested.nodeName.toLowerCase().startsWith("more-info-")) {
moreInfoNestedNodeName = nodeItemNested.nodeName.toLowerCase();
}
}
t = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("more-info-group").shadowRoot.querySelector(moreInfoNestedNodeName).shadowRoot.querySelector("ha-attributes").shadowRoot.querySelectorAll(".data-entry");
t = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("ha-more-info-info").shadowRoot.querySelector("more-info-group").shadowRoot.querySelector(moreInfoNestedNodeName).shadowRoot.querySelector("ha-attributes").shadowRoot.querySelectorAll(".data-entry");
} else {
t = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector(moreInfoNodeName).shadowRoot.querySelector("ha-attributes").shadowRoot.querySelectorAll(".data-entry");
t = document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("ha-more-info-info").shadowRoot.querySelector(moreInfoNodeName).shadowRoot.querySelector("ha-attributes").shadowRoot.querySelectorAll(".data-entry");
}
}

Expand Down

0 comments on commit db3e642

Please sign in to comment.