diff options
Diffstat (limited to 'plugins/share/share.js')
-rw-r--r-- | plugins/share/share.js | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/plugins/share/share.js b/plugins/share/share.js index 11748d8fe..7366c2aff 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -1,20 +1,20 @@ -function shareArticle(id) { - try { +Plugins.Share = { + shareArticle: function(id) { if (dijit.byId("shareArticleDlg")) dijit.byId("shareArticleDlg").destroyRecursive(); - var query = "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + encodeURIComponent(id); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "shareArticleDlg", title: __("Share article by URL"), style: "width: 600px", - newurl: function() { + newurl: function () { if (confirm(__("Generate new share URL for this article?"))) { - notify_progress("Trying to change URL...", true); + Notify.progress("Trying to change URL...", true); - const query = { op: "pluginhandler", plugin: "share", method: "newkey", id: id }; + const query = {op: "pluginhandler", plugin: "share", method: "newkey", id: id}; xhrJson("backend.php", query, (reply) => { if (reply) { @@ -34,22 +34,22 @@ function shareArticle(id) { const img = $("SHARE-IMG-" + id); if (img) img.src = img.src.replace("notshared.png", "share.png"); - notify(''); + Notify.close(); } else { - notify_error("Could not change URL."); + Notify.error("Could not change URL."); } } }); } }, - unshare: function() { + unshare: function () { if (confirm(__("Remove sharing for this article?"))) { - notify_progress("Trying to unshare...", true); + Notify.progress("Trying to unshare...", true); - const query = { op: "pluginhandler", plugin: "share", method: "unshare", id: id }; + const query = {op: "pluginhandler", plugin: "share", method: "unshare", id: id}; xhrPost("backend.php", query, () => { notify("Article unshared."); @@ -62,16 +62,15 @@ function shareArticle(id) { } }, - href: query}); + href: query + }); dialog.show(); const img = $("SHARE-IMG-" + id); if (img) img.src = img.src.replace("notshared.png", "share.png"); - - } catch (e) { - exception_error("shareArticle", e); } -} +}; + |