Fix for expanding saved preset.

This commit is contained in:
Blaz Kristan 2022-02-12 11:32:49 +01:00
parent cd1765a0f3
commit 4f83325e3c
3 changed files with 1638 additions and 1634 deletions

View File

@ -534,7 +534,7 @@ function populateQL()
function populatePresets(fromls) function populatePresets(fromls)
{ {
if (fromls) pJson = JSON.parse(localStorage.getItem("wledP")); if (fromls) pJson = JSON.parse(localStorage.getItem("wledP"));
if (!pJson) {pJson={};return}; if (!pJson) {setTimeout(loadPresets,250); return;}
delete pJson["0"]; delete pJson["0"];
var cn = `<p class="labels">All presets</p>`; var cn = `<p class="labels">All presets</p>`;
var arr = Object.entries(pJson); var arr = Object.entries(pJson);
@ -2255,9 +2255,11 @@ function formatArr(pl) {
} }
} }
function expand(i,a=false) function expand(i/*,a=false*/)
{ {
var seg = gId('seg' +i); var seg = gId('seg' +i);
let util = i<100?'segutil':'putil';
let stay = i<100?"staybot":"staytop";
/* /*
if (!a) { if (!a) {
var j = i>100 ? 100 : 0; var j = i>100 ? 100 : 0;
@ -2268,16 +2270,18 @@ function expand(i,a=false)
expanded[i] = !expanded[i]; expanded[i] = !expanded[i];
seg.style.display = (expanded[i]) ? "block":"none"; seg.style.display = (expanded[i]) ? "block":"none";
//gId('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)"; //gId('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)";
if (expanded[i]) gId('sege' +i).classList.add("exp"); if (expanded[i]) {
else gId('sege' +i).classList.remove("exp"); gId('sege' +i).classList.add("exp");
gId(util).classList.remove(stay);
if (expanded[i]) gId(i<100?'segutil':'putil').classList.remove(i<100?"staybot":"staytop"); } else {
else gId(i<100?'segutil':'putil').classList.add(i<100?"staybot":"staytop"); gId('sege' +i).classList.remove("exp");
gId(util).classList.add(stay);
}
if (i >= 100) { if (i >= 100) {
var p = i-100; var p = i-100;
gId(`p${p}o`).classList.toggle('expand'); gId(`p${p}o`).classList.toggle('expand');
if (seg.innerHTML === "") { if (expanded[i]) {
if (isPlaylist(p)) { if (isPlaylist(p)) {
plJson[p] = pJson[p].playlist; plJson[p] = pJson[p].playlist;
//make sure all keys are present in plJson[p] //make sure all keys are present in plJson[p]
@ -2291,10 +2295,9 @@ function expand(i,a=false)
} else { } else {
seg.innerHTML = makeP(p); seg.innerHTML = makeP(p);
} }
var papi = papiVal(p); var papi = papiVal(p);
gId(`p${p}api`).value = papi; gId(`p${p}api`).value = papi;
if (papi.indexOf("Please") == 0) gId(`p${p}cstgl`).checked = true; if (papi.indexOf("Please") == 0) gId(`p${p}cstgl`).checked = false;
tglCs(p); tglCs(p);
} else } else
seg.innerHTML = ""; seg.innerHTML = "";

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2202101 #define VERSION 2202111
//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