Google翻訳

    @@ -5,6 +5,14 @@ * @license MIT License * @javascript_url */ -(function(s, e, g) { - window.open(s.length > 0 ? g + '/#auto/ja/' + e(s) : confirm('translate this page?') ? g + '/translate?hl=ja&sl=auto&tl=ja&u=' + e(location.href) : g, '_blank'); -}) (document.getSelection().toString(), encodeURIComponent, '//translate.google.com'); +(function (s) { + var url; + if (s.length > 0) { + url = '//translate.google.com/#auto/ja/' + encodeURIComponent(s); + } else if (confirm('translate this page?')) { + url = '//translate.google.com/translate?hl=ja&sl=auto&tl=ja&u=' + encodeURIComponent(location.href); + } else { + url = '//translate.google.com'; + } + window.open(url, '_blank'); +}) (document.getSelection().toString());
  • /*
     * @title Google翻訳
     * @description 範囲選択した箇所をGoogle翻訳ページで表示。範囲選択してなければ現在のURLをページごと翻訳、もしくはGoogle翻訳ページを開く
     * @include http://*
     * @license MIT License
     * @javascript_url
     */
    (function (s) {
      var url;
      if (s.length > 0) {
        url = '//translate.google.com/#auto/ja/' + encodeURIComponent(s);
      } else if (confirm('translate this page?')) {
        url = '//translate.google.com/translate?hl=ja&sl=auto&tl=ja&u=' + encodeURIComponent(location.href);
      } else {
        url = '//translate.google.com';
      }
      window.open(url, '_blank');
    }) (document.getSelection().toString());
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/04/11 15:33:36 - 2017-04-11
  2. 2017/04/03 18:46:29 - 2017-04-03
  3. 2017/04/03 18:39:00 - 2017-04-03
  4. 2017/04/03 16:38:44 - 2017-04-03
  5. 2017/04/03 16:36:47 - 2017-04-03