Last active
December 12, 2015 09:49
-
-
Save gh640/4754516 to your computer and use it in GitHub Desktop.
選択した文字列をAmazon.co.jpで検索するブックマークレット。
This file contains 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:(function(){ | |
var q, location; | |
/* 選択された文字列を取得 */ | |
/* 選択されてなければダイアログから文字列を取得 */ | |
q = ""+(window.getSelection?window.getSelection():document.getSelection()); | |
if(!q) q = prompt("Amazon search... ",""); | |
/* urlエスケープした上でAmazonにリクエスト */ | |
if(q!=null){ | |
location = "http://www.amazon.co.jp/s/?field-keywords="+escape(q).replace(/ /g,"+"); | |
}else{ | |
location = "http://www.amazon.co.jp/"; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment