Google翻訳
by
shiiiiir
2017-04-11 [2017/04/11 15:33:36]
範囲選択した箇所をGoogle翻訳ページで表示。範囲選択してなければ現在のURLをページごと翻訳、もしくはGoogle翻訳ページを開く
-
/*
* @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 です。