[Notes] Double click to edit note (#645)

This commit is contained in:
Tarrgon 2024-08-26 09:34:42 -04:00 committed by GitHub
parent d3fa071149
commit 2cc040a9d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,6 +108,26 @@ let Note = {
e.stopPropagation();
},
);
if (Utility.meta("current-user-name") !== "Anonymous") {
$note_box.on("dblclick.danbooru", function (e) {
if (e.target.tagName !== "A") {
var note_id = $note_box.data("id");
var note_body = Note.Body.find(note_id);
Note.Edit.show(note_body);
}
e.stopPropagation();
});
} else {
$note_box.on("dblclick.danbooru", function (e) {
var note_id = $note_box.data("id");
var note_body = Note.Body.find(note_id);
if (note_body.tagName !== "A") {
Utility.error("You must be logged in to edit notes");
}
e.stopPropagation();
});
}
},
find: function (id) {