simplify preset sort for quick load labels and ir remotes using id
simplify sort to better align with quick load labels (sort first) and ir remotes using id (sort after presets)
This commit is contained in:
@@ -540,7 +540,7 @@ function populateQL()
|
|||||||
{
|
{
|
||||||
var cn = "";
|
var cn = "";
|
||||||
if (pQL.length > 0) {
|
if (pQL.length > 0) {
|
||||||
pQL.sort((a,b) => (a[0]>b[0]));
|
pQL.sort((a,b) => (a[1]>b[1])); //WLEDMM do not sort on preset id but on ql name
|
||||||
cn += `<p class="labels hd">Quick load</p>`;
|
cn += `<p class="labels hd">Quick load</p>`;
|
||||||
for (var key of (pQL||[])) {
|
for (var key of (pQL||[])) {
|
||||||
cn += `<button class="btn btn-xs psts" id="p${key[0]}qlb" title="${key[2]?key[2]:''}" onclick="setPreset(${key[0]});">${key[1]}</button>`;
|
cn += `<button class="btn btn-xs psts" id="p${key[0]}qlb" title="${key[2]?key[2]:''}" onclick="setPreset(${key[0]});">${key[1]}</button>`;
|
||||||
@@ -557,6 +557,7 @@ function populatePresets(fromls)
|
|||||||
delete pJson["0"];
|
delete pJson["0"];
|
||||||
var cn = "";
|
var cn = "";
|
||||||
var arr = Object.entries(pJson);
|
var arr = Object.entries(pJson);
|
||||||
|
console.log(arr);
|
||||||
arr.sort(cmpP);
|
arr.sort(cmpP);
|
||||||
pQL = [];
|
pQL = [];
|
||||||
var is = [];
|
var is = [];
|
||||||
@@ -571,7 +572,8 @@ function populatePresets(fromls)
|
|||||||
|
|
||||||
cn += `<div class="pres lstI" id="p${i}o">`;
|
cn += `<div class="pres lstI" id="p${i}o">`;
|
||||||
if (cfg.comp.pid) cn += `<div class="pid">${i}</div>`;
|
if (cfg.comp.pid) cn += `<div class="pid">${i}</div>`;
|
||||||
cn += `<div class="pname lstIname" onclick="setPreset(${i})">${isPlaylist(i)?"<i class='icons btn-icon'></i>":""}${pName(i)}
|
//WLEDMM: show ql if defined
|
||||||
|
cn += `<div class="pname lstIname" onclick="setPreset(${i})">${isPlaylist(i)?"<i class='icons btn-icon'></i>":""}${(pJson[i].ql?pJson[i].ql+' ':'') + pName(i)}
|
||||||
<i class="icons edit-icon flr" id="p${i}nedit" onclick="tglSegn(${i+100})"></i></div>
|
<i class="icons edit-icon flr" id="p${i}nedit" onclick="tglSegn(${i+100})"></i></div>
|
||||||
<i class="icons e-icon flr" id="sege${i+100}" onclick="expand(${i+100})"></i>
|
<i class="icons e-icon flr" id="sege${i+100}" onclick="expand(${i+100})"></i>
|
||||||
<div class="presin lstIcontent" id="seg${i+100}"></div>
|
<div class="presin lstIcontent" id="seg${i+100}"></div>
|
||||||
@@ -1533,14 +1535,15 @@ function displayRover(i,s)
|
|||||||
|
|
||||||
function cmpP(a, b)
|
function cmpP(a, b)
|
||||||
{
|
{
|
||||||
if (!a[1].n) return (a[0] > b[0]);
|
//WLEDMM: simplify sort to better align with quick load labels (sort first) and ir remotes using id (sort after presets)
|
||||||
// sort playlists first, followed by presets with characters and last presets with special 1st character
|
//WLEDMM a[0] = id, a[1] = Object(n, ql)
|
||||||
const c = a[1].n.charCodeAt(0);
|
//WLEDMM sort first on ql alphabetically then playlists, then id numerical
|
||||||
const d = b[1].n.charCodeAt(0);
|
|
||||||
if ((c>47 && c<58) || (c>64 && c<91) || (c>96 && c<123) || c>255) x = '='; else x = '>';
|
function toString(a) {
|
||||||
if ((d>47 && d<58) || (d>64 && d<91) || (d>96 && d<123) || d>255) y = '='; else y = '>';
|
return a[1].ql?String(a[1].ql).padEnd(2,' '):'zz' + (a[1].playlist ? '<' : '=') + String(a[0]).padStart(3, '0');
|
||||||
const n = (a[1].playlist ? '<' : x) + a[1].n;
|
}
|
||||||
return n.localeCompare((b[1].playlist ? '<' : y) + b[1].n, undefined, {numeric: true});
|
|
||||||
|
return toString(a).localeCompare(toString(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeWS() {
|
function makeWS() {
|
||||||
|
|||||||
2605
wled00/html_ui.h
2605
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2303230
|
#define VERSION 2303231
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
|||||||
Reference in New Issue
Block a user