Typo fix and preset reload after restore

This commit is contained in:
Blaz Kristan 2023-09-16 20:29:32 +02:00
parent 9929c96650
commit befce5b887
2 changed files with 992 additions and 991 deletions

View File

@ -430,14 +430,14 @@ function presetError(empty)
else
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 += `<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>`;
gId('pcont').innerHTML = cn;
if (hasBackup) gId('bck').value = bckstr;
}
function saveBackup(txt) {
function restore(txt) {
var req = new XMLHttpRequest();
req.addEventListener('load', function(){showToast(this.responseText,this.status >= 400)});
req.addEventListener('error', function(e){showToast(e.stack,true);});
@ -446,6 +446,7 @@ function saveBackup(txt) {
var b = new Blob([txt], {type: "application/json"});
formData.append("data", b, '/presets.json');
req.send(formData);
setTimeout(loadPresets, 2000);
return false;
}

File diff suppressed because it is too large Load Diff