Changeset 34083

Show
Ignore:
Timestamp:
06/21/09 21:46:38 (4 years ago)
Author:
drry
Message:
  • UTF-8 にしました。
  • var 忘れを修正しました。
  • bit.ly へのパラメータをパーセントエンコードするようにしました。
  • 正規表現を修正しました。
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/retweet.js

    r34069 r34083  
    44  <name>retweet</name> 
    55  <description>ReTweet This Page.</description> 
    6   <description lang="ja">$B3+$$$F$$$k(BTweet$B$r(BReTweet$B$7$^$9!#(B</description> 
     6  <description lang="ja">開いているTweetをReTweetします。</description> 
    77  <author mail="from.kyushu.island@gmail.com" homepage="http://iddy.jp/profile/from_kyushu">from_kyushu</author> 
    8   <version>0.1</version> 
     8  <version>0.2</version> 
    99  <license>GPL</license> 
    1010  <minVersion>1.2</minVersion> 
     
    3434    { 
    3535      var body = $U.getFirstNodeFromXPath("//span[@class='entry-content']").innerHTML; 
    36       var tags = body.match(/<.*?>/g); 
    37       for(tag in tags) 
     36      //return body.replace(/<[^>]*>/g, ""); 
     37      var tags = body.match(/<[^>]*>/g); 
     38      for(var tag in tags) 
    3839      { 
    3940        body = body.replace(tags[tag],""); 
     
    5051    { 
    5152      var xhr = new XMLHttpRequest(); 
    52       var req = "http://bit.ly/api?url=" + longUrl; 
     53      var req = "http://bit.ly/api?url=" + encodeURIComponent(longUrl); 
    5354      xhr.open('GET',req, false); 
    5455      xhr.send(null); 
    55       if (xhr.status != 200) 
     56      if(xhr.status != 200) 
    5657      { 
    5758        return longUrl; 
     
    6465      var xhr = new XMLHttpRequest(); 
    6566      var statusText = "RT @" + name + " [" + url +"]: " + body; 
    66       xhr.open("POST", "http://twitter.com/statuses/update.json", false, username, password); 
     67      xhr.open("POST", "https://twitter.com/statuses/update.json", false, username, password); 
    6768      xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
    6869      xhr.send("status=" + encodeURIComponent(statusText) + "&source=Vimperator"); 
    69      
    70       liberator.echo("[RT] Your post was sent. " ); 
     70 
     71      liberator.echo("[RT] Your post was sent."); 
    7172    } 
    7273 
     
    8889            sendTwitter(url,name,body); 
    8990          } 
    90           else if (liberator.globalVariables.twitter_username && liberator.globalVariables.twitter_password) 
     91          else if(liberator.globalVariables.twitter_username && liberator.globalVariables.twitter_password) 
    9192          { 
    9293            username = liberator.globalVariables.twitter_username;