1 if (typeof KOHA == "undefined" || !KOHA) {
6 * A namespace for Google related functions.
13 * <div title="biblionumber" id="isbn" class="gbs-thumbnail"></div>
14 * and run a search with all collected isbns to Google Book Search.
15 * The result is asynchronously returned by Google and catched by
18 GetCoverFromIsbn: function() {
20 $(".gbs-thumbnail").each(function(i) {
21 bibkeys.push(this.id); // id=isbn
23 bibkeys = bibkeys.join(',');
24 var scriptElement = document.createElement("script");
25 scriptElement.setAttribute("id", "jsonScript");
26 scriptElement.setAttribute("src",
27 "http://books.google.com/books?bibkeys=" + escape(bibkeys) +
28 "&jscmd=viewapi&callback=KOHA.Google.gbsCallBack");
29 scriptElement.setAttribute("type", "text/javascript");
30 document.documentElement.firstChild.appendChild(scriptElement);
35 * Add cover pages and links to Google detail in <div
37 gbsCallBack: function(booksInfo) {
38 for (id in booksInfo) {
39 var book = booksInfo[id];
40 $("#"+book.bib_key).each(function() {
41 var a = document.createElement("a");
42 a.href = book.info_url;
43 var img = document.createElement("img");
44 img.src = book.thumbnail_url;