Revert "Fix preset sorting"

This reverts commit 00038453e1fd15c8b8a3063badb8e00577737375.
This commit is contained in:
Woody 2024-03-02 21:56:25 +01:00
parent f8c48ef60a
commit 200d11ca99
No known key found for this signature in database
GPG Key ID: 9872D7F5072789B2

View File

@ -2794,7 +2794,6 @@ function search(field, listId = null) {
if (!listId) return;
const search = field.value !== '';
const presets = listId === 'pcont';
// clear filter if searching in fxlist
if (listId === 'fxlist' && search) {
@ -2806,7 +2805,7 @@ function search(field, listId = null) {
const listItems = gId(listId).querySelectorAll('.lstI');
// filter list items but leave (Default & Solid) always visible
for (i = (presets ? 0 : 1); i < listItems.length; i++) {
for (i = (listId === 'pcont' ? 0 : 1); i < listItems.length; i++) {
const listItem = listItems[i];
const listItemName = listItem.querySelector('.lstIname').innerText.toUpperCase();
const searchIndex = listItemName.indexOf(field.value.toUpperCase());
@ -2814,7 +2813,6 @@ function search(field, listId = null) {
listItem.dataset.searchIndex = searchIndex;
}
if (!presets) {
// sort list items by search index and name
const sortedListItems = Array.from(listItems).sort((a, b) => {
const aSearchIndex = parseInt(a.dataset.searchIndex);
@ -2838,7 +2836,6 @@ function search(field, listId = null) {
if (firstVisibleItem && search) {
firstVisibleItem.scrollIntoView({ behavior: "instant", block: "center" });
}
}
}
function clean(clearButton) {