diff --git a/main.js b/main.js index aa658da..f825f60 100644 --- a/main.js +++ b/main.js @@ -1126,7 +1126,7 @@ function createnote(title) header: indexheader(content) }; metadata[guid] = item; - localStorage.setItem("index", JSON.stringify(metadata)); + serializeindex() localStorage.setItem(guid, content); return guid; } @@ -1811,7 +1811,7 @@ function serialize() item.header = indexheader(md.value); item.lastchanged = Date.now(); - localStorage.setItem("index", JSON.stringify(metadata)); + serializeindex() localStorage.setItem(guid, md.value); } else if (title.value == "settings.json") @@ -2375,18 +2375,23 @@ function restoredeleted() metadata[guid].deleted = false; metadata[guid].lastchanged = Date.now(); renameinternallinks(title + " (deleted)", title); - localStorage.setItem("index", JSON.stringify(metadata)); + serializeindex(); } }); } +function serializeindex() +{ + localStorage.setItem("index", JSON.stringify(metadata)); +} + function deletenote(title) { var guid = getguid(title); metadata[guid].deleted = true; metadata[guid].lastchanged = Date.now(); renameinternallinks(title, title + " (deleted)"); - localStorage.setItem("index", JSON.stringify(metadata)); + serializeindex() } function deletecurrentnote()