diff options
Diffstat (limited to 'plugins/share/share.js')
| -rw-r--r-- | plugins/share/share.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/share/share.js b/plugins/share/share.js index 7366c2aff..c49f64b4b 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -32,7 +32,7 @@ Plugins.Share = { new Effect.Highlight(e); const img = $("SHARE-IMG-" + id); - if (img) img.src = img.src.replace("notshared.png", "share.png"); + img.addClassName("shared"); Notify.close(); @@ -47,17 +47,21 @@ Plugins.Share = { unshare: function () { if (confirm(__("Remove sharing for this article?"))) { - Notify.progress("Trying to unshare...", true); - const query = {op: "pluginhandler", plugin: "share", method: "unshare", id: id}; xhrPost("backend.php", query, () => { - notify("Article unshared."); + try { + const img = $("SHARE-IMG-" + id); - var img = $("SHARE-IMG-" + id); - if (img) img.src = img.src.replace("share.png", "notshared.png"); + if (img) { + img.removeClassName("shared"); + img.up("div[id*=RROW]").removeClassName("shared"); + } - dialog.hide(); + dialog.hide(); + } catch (e) { + console.error(e); + } }); } @@ -68,7 +72,7 @@ Plugins.Share = { dialog.show(); const img = $("SHARE-IMG-" + id); - if (img) img.src = img.src.replace("notshared.png", "share.png"); + img.addClassName("shared"); } }; |