diff options
author | Andrew Dolgov <[email protected]> | 2018-11-30 14:39:06 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-11-30 14:39:06 +0300 |
commit | 67cdf4cf123ef4ac04baba881b3443e64c90d9a4 (patch) | |
tree | 8702ff1d9f85b9140ae40e457869952b2555bb7a /plugins/note/note.js | |
parent | 59f5335f56a85c428740a9cd6ded75ecc51d31fa (diff) |
remove some unnecessary element IDs
rework plugins/note to use xhrJson()
Diffstat (limited to 'plugins/note/note.js')
-rw-r--r-- | plugins/note/note.js | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/plugins/note/note.js b/plugins/note/note.js index 022fc88e7..bf69a680e 100644 --- a/plugins/note/note.js +++ b/plugins/note/note.js @@ -12,31 +12,26 @@ function editArticleNote(id) { style: "width: 600px", execute: function() { if (this.validate()) { - var query = dojo.objectToQuery(this.attr('value')); - notify_progress("Saving article note...", true); - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - notify(''); - dialog.hide(); - - var reply = JSON.parse(transport.responseText); - - cache_delete("article:" + id); + xhrJson("backend.php", this.attr('value'), (reply) => { + notify(''); + dialog.hide(); - var elem = $("POSTNOTE-" + id); + if (reply) { + cache_delete("article:" + id); - if (elem) { - Element.hide(elem); - elem.innerHTML = reply.note; + var elem = $("POSTNOTE-" + id); - if (reply.raw_length != 0) - new Effect.Appear(elem); - } + if (elem) { + Element.hide(elem); + elem.innerHTML = reply.note; - }}); + if (reply.raw_length != 0) + new Effect.Appear(elem); + } + } + }); } }, href: query, |