Add google books links
janusman - April 24, 2008 - 15:28
| Project: | Millennium Integration |
| Version: | 5.x-1.2 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | janusman |
| Status: | closed |
Description
Something like the code in Tim Spalding's Thingology Blog.
<div id="gbsthumbnail"></div>
<div id="gbslink"></div>
<script type="text/javascript">
/* GBS Cover Script by Tim Spalding/LibraryThing */
function addTheCover(booksInfo)
{
var gbsnameA = new Array("No information", "Book info", "Partial view", "Full view");
for (i in booksInfo)
{
var book = booksInfo[i];
var quality = 0;
if(book.preview == "noview") { quality = 1; }
if(book.preview == "partial") { quality = 2; }
if(book.preview == "full") { quality = 3; }
if (book.thumbnail_url != undefined)
{
document.getElementById('gbsthumbnail').innerHTML =
'<img src="' + book.thumbnail_url + '">';
}
if (quality > 3)
{
document.getElementById('gbslink').innerHTML =
"<a href=\'" + book.preview_url + "\'>" + "Google Books: " + gbsnameA[quality] + "</a>";
}
}
}
</script>
<script src="http://books.google.com/books?jscmd=viewapi&bibkeys=ISBN:0670880728&callback=addTheCover"></script>
#1
Added to DEV version. Try it out!
So far there is only one config. option: dont show / show in full view / show in teaser + full view.
It only shows the link if the item has either limited or full view at Google. It does this by calling a javascript at Google for each item being shown on screen; so this incurs a possible performance penalty on the browser.
#2
#3
Automatically closed -- issue fixed for two weeks with no activity.