|
|
|
@ -228,16 +228,20 @@ function savenote(callback) {
|
|
|
|
|
closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection.
|
|
|
|
|
}).open();
|
|
|
|
|
save_in_progress = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var noteid = $("#note").data("noteid");
|
|
|
|
|
var note = new Note();
|
|
|
|
|
var append = "";
|
|
|
|
|
if (noteid != "") {
|
|
|
|
|
note = NOTES.get(noteid);
|
|
|
|
|
if (note.getSyncStatus() != "LOCAL_ONLY") {
|
|
|
|
|
note.setSyncStatus("LOCAL_EDITED");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var tempuuid = Math.random() * 100000000000000000;
|
|
|
|
|
append = " <!-- MobileNewNoteSaveTempID:" + tempuuid + " -->";
|
|
|
|
|
}
|
|
|
|
|
note.setText($("#note").val());
|
|
|
|
|
note.setText($("#note").val() + append);
|
|
|
|
|
note.setModified();
|
|
|
|
|
NOTES.set(note);
|
|
|
|
|
NOTES.syncAll(function () {
|
|
|
|
@ -246,6 +250,14 @@ function savenote(callback) {
|
|
|
|
|
closeTimeout: 3000
|
|
|
|
|
}).open();
|
|
|
|
|
$("#orignote").val(note.content);
|
|
|
|
|
if (append != "") {
|
|
|
|
|
for (n in NOTES.notes) {
|
|
|
|
|
if (NOTES.notes[n].getText().endsWith(append)) {
|
|
|
|
|
$("#note").data("noteid", NOTES.notes[n].noteid);
|
|
|
|
|
NOTES.notes[n].setText(NOTES.notes[n].getText().replace(append, ""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
save_in_progress = false;
|
|
|
|
|
if (typeof callback == "function") {
|
|
|
|
|
callback();
|
|
|
|
@ -256,6 +268,14 @@ function savenote(callback) {
|
|
|
|
|
closeTimeout: 3000
|
|
|
|
|
}).open();
|
|
|
|
|
$("#orignote").val(note.content);
|
|
|
|
|
if (append != "") {
|
|
|
|
|
for (n in NOTES.notes) {
|
|
|
|
|
if (NOTES.notes[n].getText().endsWith(append)) {
|
|
|
|
|
$("#note").data("noteid", NOTES.notes[n].noteid);
|
|
|
|
|
NOTES.notes[n].setText(NOTES.notes[n].getText().replace(append, ""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
save_in_progress = false;
|
|
|
|
|
if (typeof callback == "function") {
|
|
|
|
|
callback();
|
|
|
|
|