From e0a365b612e20c5e0c71861ff0db1e6f4ffdffc3 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Thu, 15 Feb 2024 22:32:17 +0100 Subject: [PATCH] add logs fix reload of current note --- main.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 809fc16..bbbf228 100644 --- a/main.js +++ b/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) {