summaryrefslogtreecommitdiff
path: root/plugins/note/note.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-24 21:56:52 +0300
committerAndrew Dolgov <[email protected]>2021-02-24 21:56:52 +0300
commit93940d2a9f80d9e1dac49b5eb7db23230d31c5f6 (patch)
tree71016661f6017918d0934eb462bd9552018d557a /plugins/note/note.js
parent8b022c2bfb356d7dddaf334bc931d6dec77086fb (diff)
parent1adacd057230aea4ede29dab510385bf01cf99a3 (diff)
Merge branch 'master' of git.fakecake.org:fox/tt-rss into weblate-integration
Diffstat (limited to 'plugins/note/note.js')
-rw-r--r--plugins/note/note.js31
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins/note/note.js b/plugins/note/note.js
index ab2ed9208..a46acb355 100644
--- a/plugins/note/note.js
+++ b/plugins/note/note.js
@@ -1,36 +1,39 @@
-/* global Plugins, xhrJson, Notify, fox, __ */
+/* global dojo, Plugins, xhr, App, 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) => {
+ xhr.json("backend.php", this.attr('value'), (reply) => {
Notify.close();
dialog.hide();
if (reply) {
- const elem = $("POSTNOTE-" + id);
-
- if (elem) {
- elem.innerHTML = reply.note;
+ App.findAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => {
+ elem.querySelector(".body").innerHTML = reply.note;
- if (reply.raw_length != 0)
- Element.show(elem);
+ if (reply.note)
+ elem.show();
else
- Element.hide(elem);
- }
+ elem.hide();
+ });
}
});
}
},
- href: query,
+ 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);
+ });
});
dialog.show();