From 449f6ae52f25643b3dfc22b60596fac9bca99226 Mon Sep 17 00:00:00 2001 From: drry Date: Sun, 21 Jun 2009 12:46:38 +0000 Subject: * UTF-8 にしました。 * `var` 忘れを修正しました。 * bit.ly へのパラメータをパーセントエンコードするようにしました。 * 正規表現を修正しました。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@34083 d0d07461-0603-4401-acd4-de1884942a52 --- retweet.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'retweet.js') diff --git a/retweet.js b/retweet.js index 839bcd8..3d9bbc9 100644 --- a/retweet.js +++ b/retweet.js @@ -3,9 +3,9 @@ var PLUGIN_INFO = retweet ReTweet This Page. - $B3+$$$F$$$k(BTweet$B$r(BReTweet$B$7$^$9!#(B + 開いているTweetをReTweetします。 from_kyushu - 0.1 + 0.2 GPL 1.2 2.1 @@ -33,8 +33,9 @@ Usage: function getBody() { var body = $U.getFirstNodeFromXPath("//span[@class='entry-content']").innerHTML; - var tags = body.match(/<.*?>/g); - for(tag in tags) + //return body.replace(/<[^>]*>/g, ""); + var tags = body.match(/<[^>]*>/g); + for(var tag in tags) { body = body.replace(tags[tag],""); } @@ -49,10 +50,10 @@ Usage: function getShortenUrl(longUrl) { var xhr = new XMLHttpRequest(); - var req = "http://bit.ly/api?url=" + longUrl; + var req = "http://bit.ly/api?url=" + encodeURIComponent(longUrl); xhr.open('GET',req, false); xhr.send(null); - if (xhr.status != 200) + if(xhr.status != 200) { return longUrl; } @@ -63,11 +64,11 @@ Usage: { var xhr = new XMLHttpRequest(); var statusText = "RT @" + name + " [" + url +"]: " + body; - xhr.open("POST", "http://twitter.com/statuses/update.json", false, username, password); + xhr.open("POST", "https://twitter.com/statuses/update.json", false, username, password); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("status=" + encodeURIComponent(statusText) + "&source=Vimperator"); - - liberator.echo("[RT] Your post was sent. " ); + + liberator.echo("[RT] Your post was sent."); } commands.addUserCommand( @@ -87,7 +88,7 @@ Usage: password = logins[0].password; sendTwitter(url,name,body); } - else if (liberator.globalVariables.twitter_username && liberator.globalVariables.twitter_password) + else if(liberator.globalVariables.twitter_username && liberator.globalVariables.twitter_password) { username = liberator.globalVariables.twitter_username; password = liberator.globalVariables.twitter_password; -- cgit v1.2.3