Due to quirks in how different parts of the Google Books API
processes ISBN searches, it is possible for a Google Books Preview
badge to get displayed, but when the user tries to display the preview,
the embedded preview does not get displayed.
This patch fixes the problem by grabbing the preview link from
the GB volumes search results, which in turn can be fed into the
Embedded Viewer initialization.
An ISBN that can be used to reproduce the problem is
9781937994198.
Before the patch, the badge is displayed but not the preview; after
the patch, both badge and preview should be displayed.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
<script type="text/javascript">
var GBisbns = Array();
+var GBPreviewLink = '';
var GBPreviewShowing = false;
/**
}
if ( accessInfo.embeddable ) {
+ GPPreviewLink = GBPBookInfo.items[0].volumeInfo.previewLink;
+ if ( !GPPreviewLink) {
+ return;
+ }
/* Add a button below the book cover image to load the preview. */
var GBPBadge = document.createElement( 'img' );
GBPBadge.id = 'gbpbadge';
function GBPViewerLoadCallback() {
var GBPViewer = new google.books.DefaultViewer(dojo.byId('rdetail_preview_div'));
- GBPViewer.load('ISBN:' + GBisbns[0]);
+ GBPViewer.load(GPPreviewLink);
GBPViewer.resize();
var GBPBadgelink = dojo.byId('gbpbadge_link');
GBPBadgelink.href = 'javascript:GBShowHidePreview(true);';