|
|
@ -14,36 +14,33 @@ function shareArticle(id) {
|
|
|
|
|
|
|
|
|
|
|
|
notify_progress("Trying to change URL...", true);
|
|
|
|
notify_progress("Trying to change URL...", true);
|
|
|
|
|
|
|
|
|
|
|
|
var query = "op=pluginhandler&plugin=share&method=newkey&id=" + param_escape(id);
|
|
|
|
const query = { op: "pluginhandler", plugin: "share", method: "newkey", id: id };
|
|
|
|
|
|
|
|
|
|
|
|
new Ajax.Request("backend.php", {
|
|
|
|
xhrJson("backend.php", query, (reply) => {
|
|
|
|
parameters: query,
|
|
|
|
if (reply) {
|
|
|
|
onComplete: function(transport) {
|
|
|
|
const new_link = reply.link;
|
|
|
|
var reply = JSON.parse(transport.responseText);
|
|
|
|
const e = $('gen_article_url');
|
|
|
|
var new_link = reply.link;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var e = $('gen_article_url');
|
|
|
|
if (new_link) {
|
|
|
|
|
|
|
|
|
|
|
|
if (new_link) {
|
|
|
|
e.innerHTML = e.innerHTML.replace(/\&key=.*$/,
|
|
|
|
|
|
|
|
"&key=" + new_link);
|
|
|
|
|
|
|
|
|
|
|
|
e.innerHTML = e.innerHTML.replace(/\&key=.*$/,
|
|
|
|
e.href = e.href.replace(/\&key=.*$/,
|
|
|
|
"&key=" + new_link);
|
|
|
|
"&key=" + new_link);
|
|
|
|
|
|
|
|
|
|
|
|
e.href = e.href.replace(/\&key=.*$/,
|
|
|
|
new Effect.Highlight(e);
|
|
|
|
"&key=" + new_link);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Effect.Highlight(e);
|
|
|
|
const img = $("SHARE-IMG-" + id);
|
|
|
|
|
|
|
|
if (img) img.src = img.src.replace("notshared.png", "share.png");
|
|
|
|
|
|
|
|
|
|
|
|
var img = $("SHARE-IMG-" + id);
|
|
|
|
notify('');
|
|
|
|
if (img) img.src = img.src.replace("notshared.png", "share.png");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notify('');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
notify_error("Could not change URL.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
notify_error("Could not change URL.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -52,18 +49,16 @@ function shareArticle(id) {
|
|
|
|
|
|
|
|
|
|
|
|
notify_progress("Trying to unshare...", true);
|
|
|
|
notify_progress("Trying to unshare...", true);
|
|
|
|
|
|
|
|
|
|
|
|
var query = "op=pluginhandler&plugin=share&method=unshare&id=" + param_escape(id);
|
|
|
|
const query = { op: "pluginhandler", plugin: "share", method: "unshare", id: id };
|
|
|
|
|
|
|
|
|
|
|
|
new Ajax.Request("backend.php", {
|
|
|
|
xhrPost("backend.php", query, () => {
|
|
|
|
parameters: query,
|
|
|
|
notify("Article unshared.");
|
|
|
|
onComplete: function(transport) {
|
|
|
|
|
|
|
|
notify("Article unshared.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var img = $("SHARE-IMG-" + id);
|
|
|
|
var img = $("SHARE-IMG-" + id);
|
|
|
|
if (img) img.src = img.src.replace("share.png", "notshared.png");
|
|
|
|
if (img) img.src = img.src.replace("share.png", "notshared.png");
|
|
|
|
|
|
|
|
|
|
|
|
dialog.hide();
|
|
|
|
dialog.hide();
|
|
|
|
} });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -71,7 +66,7 @@ function shareArticle(id) {
|
|
|
|
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
|
|
|
|
var img = $("SHARE-IMG-" + id);
|
|
|
|
const img = $("SHARE-IMG-" + id);
|
|
|
|
if (img) img.src = img.src.replace("notshared.png", "share.png");
|
|
|
|
if (img) img.src = img.src.replace("notshared.png", "share.png");
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|