fix plugins/note javascript part broken by previous changeset
This commit is contained in:
parent
71ff485fbf
commit
3b635c7557
|
@ -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");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,17 +1,40 @@
|
||||||
Plugins.Af_Readability = {
|
Plugins.Note = {
|
||||||
embed: function(id) {
|
edit: function(id) {
|
||||||
Notify.progress("Loading, please wait...");
|
const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id);
|
||||||
|
|
||||||
xhrJson("backend.php",{ op: "pluginhandler", plugin: "af_readability", method: "embed", param: id }, (reply) => {
|
if (dijit.byId("editNoteDlg"))
|
||||||
const content = $$(App.isCombinedMode() ? ".cdm[data-article-id=" + id + "] .content-inner" :
|
dijit.byId("editNoteDlg").destroyRecursive();
|
||||||
".post[data-article-id=" + id + "] .content")[0];
|
|
||||||
|
|
||||||
if (content && reply.content) {
|
const dialog = new dijit.Dialog({
|
||||||
content.innerHTML = reply.content;
|
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();
|
Notify.close();
|
||||||
} else {
|
dialog.hide();
|
||||||
Notify.error("Unable to fetch content for this article");
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
};
|
};
|
Loading…
Reference in New Issue