twitterのパーマリンクからRTするブックマークレット


javascript:
(function(){
  if(location.href.match(/twitter\.com\/(.+?)\//)){
    var id=RegExp.$1;
    var s=document.getElementsByTagName('span');
    for(var i=0;i<s.length;i++){
      if(s[i].getAttribute('class')=='entry-content'){
        var u='http://twitter.com/home?status=';
        u+=encodeURIComponent('RT @'+id+': '+(s[i].innerText||s[i].textContent));
        with(window.open().document){
          location.href=u;
          close();
        }
        break;
      }
    }
  }
}
)();