Skip to main content
ExLibris
Ex Libris Knowledge Center

Google Books Search alternative script

Alan Rykhus (ODIN) has rewritten the javascript for ProcessGBSBookInfo to make sure it shows the correct book cover.
The following is the enhanced code:

<script>
// Function to process GBS info and update the dom.
function ProcessGBSBookInfo(booksInfo) {
var url_elem = document.getElementById("$0800");
var pic_elem = document.getElementById("google_book");
var str = "$0800";
var str_parts = str.split(":");
var isbn = str_parts[1];
for (var items_idx = 0; items_idx < booksInfo.totalItems ; items_idx++)
{
var item = booksInfo.items[items_idx];
if(!item.volumeInfo || !item.volumeInfo.industryIdentifiers) {
continue;
}
for (var vinfo_idx = 0; vinfo_idx < item.volumeInfo.industryIdentifiers.length; vinfo_idx++)
{
var vinfo_id = item.volumeInfo.industryIdentifiers[vinfo_idx];
if (((vinfo_id.type == "ISBN_10") || (vinfo_id.type == "ISBN_13")) && (vinfo_id.identifier == isbn)) {
url_elem.href = item.volumeInfo.infoLink;
url_elem.style.display = '';
if (item.volumeInfo.imageLinks.smallThumbnail)
{
pic_elem.src = item.volumeInfo.imageLinks.smallThumbnail;
pic_elem.style.display = '';
break;
}
}
}
}
}
</script>
  • Was this article helpful?