mirror of
https://github.com/wled/WLED.git
synced 2025-07-15 23:06:36 +00:00
Merge pull request #46 from w00000dy/search-keep-mod
Move selected to the bottom in search result
This commit is contained in:
commit
25ab381916
@ -2850,8 +2850,12 @@ function search(field, listId = null) {
|
||||
if (listId !== 'pcont' && i === 0) return;
|
||||
const listItemName = listItem.querySelector('.lstIname').innerText.toUpperCase();
|
||||
const searchIndex = listItemName.indexOf(field.value.toUpperCase());
|
||||
listItem.style.display = (searchIndex < 0) && !listItem.classList.contains("selected") ? 'none' : '';
|
||||
if (searchIndex < 0) {
|
||||
listItem.dataset.searchIndex = Number.MAX_SAFE_INTEGER;
|
||||
} else {
|
||||
listItem.dataset.searchIndex = searchIndex;
|
||||
}
|
||||
listItem.style.display = (searchIndex < 0) && !listItem.classList.contains("selected") ? 'none' : '';
|
||||
});
|
||||
|
||||
// sort list items by search index and name
|
||||
|
Loading…
x
Reference in New Issue
Block a user