-
-
Save charithmadhuranga/57d02a74fcc8f2ab99b5aa0cca8ac92b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| To move a panel to below the divider in Home Assistant | |
| Add this to your configuration.yaml | |
| frontend: | |
| extra_module_url: | |
| - /local/move-panel.js | |
| And put the following into <config-dir>/www/move-panel.js | |
| Replace URL_TO_MOVE with the url of your panel | |
| */ | |
| customElements.whenDefined('ha-sidebar').then(() => { | |
| const URL_TO_MOVE = "/lovelace"; | |
| const sideBar = document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("#drawer > ha-sidebar"); | |
| sideBar.updateComplete.then(() => { | |
| const listbox = sideBar.shadowRoot.querySelector("paper-listbox"); | |
| const buttons = listbox.querySelectorAll("a"); | |
| const divider = listbox.querySelector("div"); | |
| for (let i = 0; i < buttons.length; i++) { | |
| if (buttons[i].href.endsWith(URL_TO_MOVE)) { | |
| listbox.insertBefore(buttons[i], divider.nextSibling); | |
| } | |
| } | |
| }); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment