diff options
author | Andrew Dolgov <[email protected]> | 2018-12-03 15:46:54 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-03 15:46:54 +0300 |
commit | 4cb3a601a0fbeb0bf98c932bd5af8a3cffa8ab64 (patch) | |
tree | ed3dae8894591be12287b3cce3ff5b4cc6d1ce0e /plugins/note | |
parent | cd0a39ea4cb7137aef5b225bdc4472d207a48e62 (diff) | |
parent | 98986ce066764158c045c3e23b69e98183b94236 (diff) |
Merge branch 'js-objects' into weblate-integration
Diffstat (limited to 'plugins/note')
-rw-r--r-- | plugins/note/init.php | 2 | ||||
-rw-r--r-- | plugins/note/note.js | 45 |
2 files changed, 21 insertions, 26 deletions
diff --git a/plugins/note/init.php b/plugins/note/init.php index 354591b75..ac908a5ba 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -24,7 +24,7 @@ class Note extends Plugin { function hook_article_button($line) { return "<img src=\"plugins/note/note.png\" style=\"cursor : pointer\" style=\"cursor : pointer\" - onclick=\"editArticleNote(".$line["id"].")\" + onclick=\"Plugins.Note.edit(".$line["id"].")\" class='tagsPic' title='".__('Edit article note')."'>"; } diff --git a/plugins/note/note.js b/plugins/note/note.js index bf69a680e..21c1ae51e 100644 --- a/plugins/note/note.js +++ b/plugins/note/note.js @@ -1,46 +1,41 @@ -function editArticleNote(id) { - try { - - var query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + param_escape(id); +Plugins.Note = { + edit: function(id) { + const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id); if (dijit.byId("editNoteDlg")) dijit.byId("editNoteDlg").destroyRecursive(); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "editNoteDlg", title: __("Edit article note"), style: "width: 600px", - execute: function() { + execute: function () { if (this.validate()) { - notify_progress("Saving article note...", true); + Notify.progress("Saving article note...", true); xhrJson("backend.php", this.attr('value'), (reply) => { - notify(''); - dialog.hide(); + Notify.close(); + dialog.hide(); - if (reply) { - cache_delete("article:" + id); + if (reply) { + ArticleCache.del(id); - var elem = $("POSTNOTE-" + id); + var elem = $("POSTNOTE-" + id); - if (elem) { - Element.hide(elem); - elem.innerHTML = reply.note; + if (elem) { + Element.hide(elem); + elem.innerHTML = reply.note; - if (reply.raw_length != 0) - new Effect.Appear(elem); - } - } - }); + if (reply.raw_length != 0) + new Effect.Appear(elem); + } + } + }); } }, href: query, }); dialog.show(); - - } catch (e) { - exception_error("editArticleNote", e); } -} - +};
\ No newline at end of file |