Skip to content

Commit b2212ea

Browse files
committed
added option to change name
1 parent 7e5e9db commit b2212ea

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ order:
9898
| Name | Type | Requirement | Description
9999
| ---- | ---- | ------- | -----------
100100
| 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.
101+
| name | string | **Optional** | Change the name of the existing item to this string.
101102
| 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.
102103
| hide | boolean | **Optional** | Hide item in sidebar.
103104
| exact | boolean | **Optional** | Specify whether the item string match will be exact match instead of substring.

dist/custom-sidebar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ function moveItem(elements, config_entry) {
138138
if (config_entry.href) {
139139
elements.children[i].href = config_entry.href;
140140
}
141+
142+
if(config_entry.name){
143+
elements.children[i].children[0].getElementsByTagName("span")[0].innerHTML = elements.children[i].children[0].getElementsByTagName("span")[0].innerHTML.replace(current,config_entry.name);
144+
}
145+
141146
if (config_entry.icon) {
142147
var icon_holder = elements.children[i].querySelector("ha-icon");
143148
if (icon_holder) {

0 commit comments

Comments
 (0)