Optimize updateMoreInfo() to use search customElements and dont use DOM scraping #82
Replies: 2 comments
-
current GPT pre-release code for this:
still not using the this is why:
general suggestions by GPT summarized:
|
Beta Was this translation helpful? Give feedback.
-
closing this as we now have custom_more_info and custom_attributes |
Beta Was this translation helpful? Give feedback.
-
trying to optimize the updateMoreInfo() function to be less dependent on the actual DOM, Ive fed GPT with the feedback by HeyImAlex in the community and especially the final bullet on DOM scraping:
Fed that into GPT which seems to 'get;' what we need, and responds with the following:
GPT:
replaced the DOM scraping with directly searching for the ha-attribute custom element. However, it's important to note that this code will only hide the ha-attribute element whose key is "hide attributes". It will not hide other ha-attribute elements based on the value of the "hide attributes" element.
To hide other ha-attribute elements based on the value of the "hide attributes" element, you will need to update the code as follows:
Retrieve the value of the "hide attributes" element. This can be done by accessing the value property of the ha-attribute element.
Split the value of the "hide attributes" element by a comma to get an array of attributes to hide.
Iterate over all the ha-attribute elements and check if the key of each element is in the array of attributes to hide. If it is, then hide the element by setting its style.display property to "none".
After some more iterating and unsuccessful code changes it finally suggests code below. However, it still does not hide the attributes in the more-info panel.....
Hope someone can check this and maybe help to figure out how to do it.
Beta Was this translation helpful? Give feedback.
All reactions