任意のページの英単語(文章)をGoogleTranslateで調べるBookmarklet[JavaScript]

id:tomisima:20071016:1192551834 を参考につくってみました.
Debian etchでFF2/Opera9 ,WindowsXP FF2,Opera9,IE7で検証しました

  • 圧縮バージョン
javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://google.com/translate_t',e=encodeURIComponent,p='?langpair=en%7Cja&hl=en&ie=UTF8&text='+e(s),u=f+p,l=d.location;if(!w.open(u,'t','toolbar=0,scrollbars=1,resizable=0,width=450,height=430')){l.href=u;}})();
  • 圧縮前
javascript:(function (){ 
    // d = document
    // w = window
    // e = window.getSelection                   :新しいブラウザ向けのセレクト領域確保
    // k = document.getSelection                 :古めブラウザ向け
    // x = document.selection.createRange().text :IE向け
    // f = 'http://google.com/translate_t        :GoogleTranslateのURL
    // p ='?langpair=en%7Cja                     :英語->日本語
    // &hl=en                                    :表示言語 英語(日本語が無いので)
    // &ie=UTF8&text='                           :入力コード UTF8
    var d = document, w = window, e = w.getSelection, k = d.getSelection, x =d.selection, s = 
    (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)), f ='http://google.com/translate_t', e =encodeURIComponent, p ='?langpair=en%7Cja&hl=en&ie=UTF8&text=' + e(s), u = f + p , l = d.location;
    // ポップアップ表示
    if(!w.open (u, 't', 'toolbar=0, scrollbars=1,resizable=0,width=450,height=430')){
        // 失敗したらそのページに翻訳結果を...
        l.href = u;
    }   
    })();