parent
a1c0033e26
commit
e0a365b612
15
main.js
15
main.js
|
@ -356,6 +356,7 @@ function pushitem(key, value)
|
|||
{
|
||||
unsavedmark.hidden = false;
|
||||
pending[key] = true;
|
||||
var name = metadata[key] ? metadata[key].title : key;
|
||||
|
||||
encryptstring(value)
|
||||
.then(encrypted =>
|
||||
|
@ -364,13 +365,12 @@ function pushitem(key, value)
|
|||
})
|
||||
.then( () =>
|
||||
{
|
||||
console.log(key + " pushed to server");
|
||||
console.log("'" + name + "' pushed to server");
|
||||
delete pending[key];
|
||||
})
|
||||
.catch( err =>
|
||||
{
|
||||
var msg = "error while pushing '" + (metadata[key] ? metadata[key].title : key) + "': " + err;
|
||||
console.error(msg);
|
||||
console.error("error while pushing '" + name + "': " + err);
|
||||
showtemporaryinfo(msg);
|
||||
setTimeout( () =>
|
||||
{
|
||||
|
@ -1191,10 +1191,10 @@ function loadstorage()
|
|||
}
|
||||
|
||||
var title = params.get("n") || params.get("name");
|
||||
if (window.title.value)
|
||||
if (document.title.value)
|
||||
{
|
||||
// reload current
|
||||
loadnote(window.title.value);
|
||||
loadnote(document.title.value);
|
||||
}
|
||||
else if (title)
|
||||
{
|
||||
|
@ -1336,10 +1336,13 @@ function pushall()
|
|||
|
||||
function fetchandserialize(guid)
|
||||
{
|
||||
var name = metadata[guid] ? metadata[guid] : guid;
|
||||
console.log("fetching '" + name + "'");
|
||||
return queryremote({action: "fetch", name: guid})
|
||||
.then(content =>
|
||||
{
|
||||
localStorage.setItem(guid, content);
|
||||
console.log("'" + name + "' fetched and serialized");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1897,7 +1900,7 @@ function flush()
|
|||
}
|
||||
|
||||
unsavedmark.hidden = Object.keys(pending).length == 0;
|
||||
console.log("data serialized locally");
|
||||
console.log("'" + title.value + "' serialized locally");
|
||||
}
|
||||
|
||||
function escapeHtml(unsafe) {
|
||||
|
|
Loading…
Reference in New Issue