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 $("div [id^=gbs-thumbnail]").each(function(i) {
21 bibkeys.push($(this).attr("class")); // 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 if (typeof(book.thumbnail_url) != "undefined") {
44 var img = document.createElement("img");
45 img.src = book.thumbnail_url;
48 '<div style="margin-bottom:5px; margin-top:-5px;font-size:9px">' +
51 '">Source Google</a></div>'
54 var message = document.createElement("span");
55 $(message).attr("class","no-image");
56 $(message).html(NO_GOOGLE_JACKET);
57 $(this).append(message);