move to module

This commit is contained in:
Stewart Allen 2021-03-02 15:12:58 -05:00
commit 5b1f922f3c
2 changed files with 0 additions and 161 deletions

View file

@ -363,14 +363,6 @@
case cca('i'): // file import
API.event.import();
break;
case cca('U'): // full settings url
storeSettingsToServer(true);
break;
case cca('u'): // full settings url
UC.prompt("settings id to load", "").then(id => {
if (id) loadSettingsFromServer(id);
});
break;
case cca('S'): // slice
case cca('s'): // slice
if (evt.shiftKey) {
@ -547,43 +539,6 @@
moveSelection(x, y, z, true);
}
function loadSettingsFromServer(tok) {
let hash = (tok || LOC.hash.substring(1)).split("/");
if (hash.length === 2) {
new moto.Ajax(function(reply) {
if (reply) {
let res = JSON.parse(reply);
if (res && res.ver && res.rec) {
let set = API.util.b64dec(res.rec);
set.id = res.space;
set.ver = res.ver;
API.conf.put(set);
API.event.settings();
API.ui.sync();
LOC.hash = '';
}
}
}).request("/data/"+ hash[0] + "/" + hash[1]);
}
}
function storeSettingsToServer(display) {
let set = API.util.b64enc(settings());
new moto.Ajax(function(reply) {
if (reply) {
let res = JSON.parse(reply);
if (res && res.ver) {
LOC.hash = res.space + "/" + res.ver;
if (display) {
UC.alert(`unique settings id is: <b>${res.space}/${res.ver}</b>`);
}
}
} else {
updateSpaceState();
}
}).request("/data/"+ settings().id + "/" + settings().ver, set);
}
function deviceExport(exp, name) {
name = (name || "device")
.toLowerCase()
@ -2435,9 +2390,6 @@
UI.sync();
// load settings provided in url hash
loadSettingsFromServer();
// clear alerts as they build up
setInterval(API.event.alerts, 1000);