Typo fix and preset reload after restore
This commit is contained in:
parent
9929c96650
commit
befce5b887
@ -430,14 +430,14 @@ function presetError(empty)
|
|||||||
else
|
else
|
||||||
cn += `Here is a backup of the last known good state:`;
|
cn += `Here is a backup of the last known good state:`;
|
||||||
cn += `<textarea id="bck"></textarea><br><button class="btn" onclick="cpBck()">Copy to clipboard</button>`;
|
cn += `<textarea id="bck"></textarea><br><button class="btn" onclick="cpBck()">Copy to clipboard</button>`;
|
||||||
cn += `<button type="button" class="btn" onclick="saveBackup(gID('bck').value)">Restore</button>`;
|
cn += `<br><button type="button" class="btn" onclick="restore(gId('bck').value)">Restore</button>`;
|
||||||
}
|
}
|
||||||
cn += `</div>`;
|
cn += `</div>`;
|
||||||
gId('pcont').innerHTML = cn;
|
gId('pcont').innerHTML = cn;
|
||||||
if (hasBackup) gId('bck').value = bckstr;
|
if (hasBackup) gId('bck').value = bckstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveBackup(txt) {
|
function restore(txt) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.addEventListener('load', function(){showToast(this.responseText,this.status >= 400)});
|
req.addEventListener('load', function(){showToast(this.responseText,this.status >= 400)});
|
||||||
req.addEventListener('error', function(e){showToast(e.stack,true);});
|
req.addEventListener('error', function(e){showToast(e.stack,true);});
|
||||||
@ -446,6 +446,7 @@ function saveBackup(txt) {
|
|||||||
var b = new Blob([txt], {type: "application/json"});
|
var b = new Blob([txt], {type: "application/json"});
|
||||||
formData.append("data", b, '/presets.json');
|
formData.append("data", b, '/presets.json');
|
||||||
req.send(formData);
|
req.send(formData);
|
||||||
|
setTimeout(loadPresets, 2000);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1978
wled00/html_ui.h
1978
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user