1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-30 12:30:52 +02:00
ttrss/plugins/note/note.js
Andrew Dolgov 3d11c61f32 * OPML import: don't reload everything, just feed tree
* dialogs: use auto-destroying dialog for almost all dialogs instead of destroying them manually
* some general dialog-related cleanup
2021-02-12 15:22:10 +03:00

39 lines
813 B
JavaScript

/* global Plugins, xhrJson, Notify, fox, __ */
Plugins.Note = {
edit: function(id) {
const query = "backend.php?op=pluginhandler&plugin=note&method=edit&param=" + encodeURIComponent(id);
const dialog = new fox.SingleUseDialog({
id: "editNoteDlg",
title: __("Edit article note"),
execute: function () {
if (this.validate()) {
Notify.progress("Saving article note...", true);
xhrJson("backend.php", this.attr('value'), (reply) => {
Notify.close();
dialog.hide();
if (reply) {
const elem = $("POSTNOTE-" + id);
if (elem) {
elem.innerHTML = reply.note;
if (reply.raw_length != 0)
Element.show(elem);
else
Element.hide(elem);
}
}
});
}
},
href: query,
});
dialog.show();
}
};