Skip to content

Instantly share code, notes, and snippets.

@gh640
Created February 11, 2013 13:59
Show Gist options
  • Save gh640/4754557 to your computer and use it in GitHub Desktop.
Save gh640/4754557 to your computer and use it in GitHub Desktop.
Amazonの書籍詳細ページからISBNをキーにGoogle Booksに飛ぶブックマークレット。 日本のAmazonを対象として作りましたが、アップロードした時点ではアメリカAmazonでも使えます。
javascript: (function() {
/* Amazonの書籍詳細ページからISBNをキーにGoogle Booksに飛ぶブックマークレット */
/* htmlドキュメント内からISBNを探す */
var bs = document.body.getElementsByTagName('b');
for(var i = 0; i < bs.length; i++) {
if(bs[i].innerText == 'ISBN-10:') {
codeuniq = bs[i].parentNode.innerText.slice(9);
break;
}
}
/* ISBNが見つからなければアラートを出して終了。見つかればGoogle BooksでISBN検索。 */
if(typeof codeuniq === 'undefined') {
alert('ISBN/ASIN not found');
} else {
var url = 'http://books.google.com/books?isbn=';
var w = window.open(url + escape(codeuniq));
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment