Skip to content

Commit

Permalink
added option to change name
Browse files Browse the repository at this point in the history
  • Loading branch information
Villhellm committed Jul 26, 2020
1 parent 7e5e9db commit b2212ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ order:
| Name | Type | Requirement | Description
| ---- | ---- | ------- | -----------
| item | string | **Required** | This is a string that will be checked for in the display name of the sidebar item. It can be a substring such as `developer` instead of `Developer Tools`. It is not case sensitive.
| name | string | **Optional** | Change the name of the existing item to this string.
| bottom | boolean | **Optional** | Setting this option to `true` will group the item with the bottom items (Configuration, Developer Tools, etc) instead of at the top.
| hide | boolean | **Optional** | Hide item in sidebar.
| exact | boolean | **Optional** | Specify whether the item string match will be exact match instead of substring.
Expand Down
5 changes: 5 additions & 0 deletions dist/custom-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ function moveItem(elements, config_entry) {
if (config_entry.href) {
elements.children[i].href = config_entry.href;
}

if(config_entry.name){
elements.children[i].children[0].getElementsByTagName("span")[0].innerHTML = elements.children[i].children[0].getElementsByTagName("span")[0].innerHTML.replace(current,config_entry.name);
}

if (config_entry.icon) {
var icon_holder = elements.children[i].querySelector("ha-icon");
if (icon_holder) {
Expand Down

0 comments on commit b2212ea

Please sign in to comment.