Sha256: eca455ca432185ad585913ca75d0e7f5830cc007bf9ef6fc4b237613e3f5fa33
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 KB
Contents
<script type="text/javascript"> function addTheCover(booksInfo){ jQuery(function(){ var link = ''; for (i in booksInfo.items) { var book = booksInfo.items[i] var image = book.volumeInfo.imageLinks; if (image && image.thumbnail != undefined) { var thumbnail = image.thumbnail.replace('zoom=5', 'zoom=1'); if ( document.location.protocol == 'https:' ) { var parser = document.createElement('a'); parser.href = thumbnail; parser.protocol = 'https:'; parser.hostname = 'encrypted.google.com'; thumbnail = parser.href; } if (thumbnail) { var link = '<img src="' + thumbnail + '" alt="' + book.volumeInfo.title + '" />'; if (book.accessInfo && book.accessInfo.viewability != "NO_PAGES") { var preview = book.volumeInfo.previewLink; link += '<br /><a href="' + preview + '" target="_blank"><img border=0 src="//www.google.com/googlebooks/images/gbs_preview_button1.gif" title="Google Preview" alt="Google Preview" /></a>'; } } } } if (link === '') { <% if Setting.book_jacket.unknown_resource.blank? %> var link = '<%= image_tag("unknown_resource.png", :size => "150x150", :alt => "*") %>'; <% else %> var link = '<%= Setting.book_jacket.unknown_resource %>'; <% end %> } var thumb_element = document.getElementById('gbsthumbnail'); if (thumb_element) { thumb_element.innerHTML = link; } }); } </script> <% if @manifestation.try(:isbn?) %> <script src="https://www.googleapis.com/books/v1/volumes?q=isbn:<%= @manifestation.isbn %>&callback=addTheCover"></script> <% end %>
Version data entries
3 entries across 3 versions & 2 rubygems