]>
git.wh0rd.org - tt-rss.git/blob - plugins/share/share.js
1 function shareArticle(id
) {
3 if (dijit
.byId("shareArticleDlg"))
4 dijit
.byId("shareArticleDlg").destroyRecursive();
6 var query
= "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + param_escape(id
);
8 dialog
= new dijit
.Dialog({
10 title
: __("Share article by URL"),
11 style
: "width: 600px",
13 if (confirm(__("Generate new share URL for this article?"))) {
15 notify_progress("Trying to change URL...", true);
17 var query
= "op=pluginhandler&plugin=share&method=newkey&id=" + param_escape(id
);
19 new Ajax
.Request("backend.php", {
21 onComplete: function(transport
) {
22 var reply
= JSON
.parse(transport
.responseText
);
23 var new_link
= reply
.link
;
25 var e
= $('gen_article_url');
29 e
.innerHTML
= e
.innerHTML
.replace(/\&key=.*$/,
30 "&key=" + new_link
);
32 e
.href
= e
.href
.replace(/\&key=.*$/,
35 new Effect
.Highlight(e
);
37 var img
= $("SHARE-IMG-" + id
);
38 if (img
) img
.src
= img
.src
.replace("notshared.png", "share.png");
43 notify_error("Could not change URL.");
51 if (confirm(__("Remove sharing for this article?"))) {
53 notify_progress("Trying to unshare...", true);
55 var query
= "op=pluginhandler&plugin=share&method=unshare&id=" + param_escape(id
);
57 new Ajax
.Request("backend.php", {
59 onComplete: function(transport
) {
60 notify("Article unshared.");
62 var img
= $("SHARE-IMG-" + id
);
63 if (img
) img
.src
= img
.src
.replace("share.png", "notshared.png");
74 var img
= $("SHARE-IMG-" + id
);
75 if (img
) img
.src
= img
.src
.replace("notshared.png", "share.png");
78 exception_error("shareArticle", e
);