1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-07-04 13:10:49 +02:00
ttrss/plugins/note/note.js

42 lines
951 B
JavaScript
Raw Normal View History

/* global dojo, Plugins, xhr, App, Notify, fox, __ */
Plugins.Note = {
edit: function(id) {
const dialog = new fox.SingleUseDialog({
title: __("Edit article note"),
execute: function () {
if (this.validate()) {
Notify.progress("Saving article note...", true);
xhr.json("backend.php", this.attr('value'), (reply) => {
Notify.close();
dialog.hide();
if (reply) {
2021-02-19 15:15:22 +01:00
App.findAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => {
elem.querySelector(".body").innerHTML = reply.note;
2021-02-19 15:15:22 +01:00
if (reply.note)
elem.show();
else
2021-02-19 15:15:22 +01:00
elem.hide();
});
}
});
}
},
content: __("Loading, please wait...")
});
const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
xhr.post("backend.php", App.getPhArgs("note", "edit", {id: id}), (reply) => {
dialog.attr('content', reply);
});
2011-12-21 07:58:06 +01:00
});
dialog.show();
2011-12-21 07:58:06 +01:00
}
};