summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-02-27 07:59:57 +0300
committerAndrew Dolgov <[email protected]>2020-02-27 07:59:57 +0300
commit3b635c755788e7e29e9b1d43056d809916fcfe8d (patch)
treed1bf82173c5a237f2668f4fd51e379ff06439986 /plugins
parent71ff485fbffcec64e36bd4441689f019a6d52535 (diff)
fix plugins/note javascript part broken by previous changeset
Diffstat (limited to 'plugins')
-rw-r--r--plugins/af_readability/init.js17
-rw-r--r--plugins/note/note.js49
2 files changed, 53 insertions, 13 deletions
diff --git a/plugins/af_readability/init.js b/plugins/af_readability/init.js
new file mode 100644
index 000000000..fd603cbf1
--- /dev/null
+++ b/plugins/af_readability/init.js
@@ -0,0 +1,17 @@
+Plugins.Af_Readability = {
+ embed: function(id) {
+ Notify.progress("Loading, please wait...");
+
+ xhrJson("backend.php",{ op: "pluginhandler", plugin: "af_readability", method: "embed", param: id }, (reply) => {
+ const content = $$(App.isCombinedMode() ? ".cdm[data-article-id=" + id + "] .content-inner" :
+ ".post[data-article-id=" + id + "] .content")[0];
+
+ if (content && reply.content) {
+ content.innerHTML = reply.content;
+ Notify.close();
+ } else {
+ Notify.error("Unable to fetch content for this article");
+ }
+ });
+ }
+};
diff --git a/plugins/note/note.js b/plugins/note/note.js
index 7724fab84..0c811000d 100644
--- a/plugins/note/note.js
+++ b/plugins/note/note.js
@@ -1,17 +1,40 @@
-Plugins.Af_Readability = {
- embed: function(id) {
- Notify.progress("Loading, please wait...");
+Plugins.Note = {
+ edit: function(id) {
+ const query = "backend.php?op=pluginhandler&plugin=note&method=edit&param=" + encodeURIComponent(id);
- xhrJson("backend.php",{ op: "pluginhandler", plugin: "af_readability", method: "embed", param: id }, (reply) => {
- const content = $$(App.isCombinedMode() ? ".cdm[data-article-id=" + id + "] .content-inner" :
- ".post[data-article-id=" + id + "] .content")[0];
+ if (dijit.byId("editNoteDlg"))
+ dijit.byId("editNoteDlg").destroyRecursive();
- if (content && reply.content) {
- content.innerHTML = reply.content;
- Notify.close();
- } else {
- Notify.error("Unable to fetch content for this article");
- }
+ const dialog = new dijit.Dialog({
+ id: "editNoteDlg",
+ title: __("Edit article note"),
+ style: "width: 600px",
+ 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();
}
-};
+}; \ No newline at end of file