Created
July 12, 2011 01:16
-
-
Save tototoshi/1077180 to your computer and use it in GitHub Desktop.
Googleの検索言語切り替え(en<->ja)ブックマークレット
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:void((function () { | |
var url = location.href; | |
var ja = url.search(/hl=ja/); | |
var en = url.search(/hl=en/); | |
if (url.search(/google\.(co\.jp|com)\/search/) < 0) return; | |
if (ja > 0) { | |
location.href = url.replace(/hl=ja/, "hl=en"); | |
} else if (en > 0) { | |
location.href = url.replace(/hl=en/, "hl=ja"); | |
} else { | |
var beginning_of_params = url.search(/\?/) + 1; | |
location.href = url.substr(0, beginning_of_params) + "hl=ja&" + url.substr(beginning_of_params); | |
} | |
})()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment