]> git.wh0rd.org - tt-rss.git/blame - js/tweet_button.js
support comments on simplepie properly
[tt-rss.git] / js / tweet_button.js
CommitLineData
8e70d965
AD
1 function tweetArticle(id) {
2 try {
3 var query = "?op=rpc&method=buttonPlugin&plugin=tweet&plugin_method=getTweetInfo&id=" + param_escape(id);
4
5 console.log(query);
6
7 var d = new Date();
8 var ts = d.getTime();
9
10 var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet',
11 "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
12
13 new Ajax.Request("backend.php", {
14 parameters: query,
15 onComplete: function(transport) {
16 var ti = JSON.parse(transport.responseText);
17
18 var share_url = "http://twitter.com/share?_=" + ts +
19 "&text=" + param_escape(ti.title) +
20 "&url=" + param_escape(ti.link);
21
22 w.location.href = share_url;
23
24 } });
25
26
27 } catch (e) {
28 exception_error("tweetArticle", e);
29 }
30 }
31