Created
February 11, 2013 13:59
-
-
Save gh640/4754557 to your computer and use it in GitHub Desktop.
Amazonの書籍詳細ページからISBNをキーにGoogle Booksに飛ぶブックマークレット。
日本のAmazonを対象として作りましたが、アップロードした時点ではアメリカAmazonでも使えます。
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() { | |
/* 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