if (typeof KOHA == "undefined" || !KOHA) { var KOHA = {}; } /** * A namespace for OpenLibrary related functions. */ KOHA.OpenLibrary = { /** * Search all: *
* or * * and run a search with all collected isbns to Open Library Book Search. * The result is asynchronously returned by OpenLibrary and catched by * olCallBack(). */ GetCoverFromIsbn: function() { var bibkeys = []; $("[id^=openlibrary-thumbnail]").each(function(i) { bibkeys.push("ISBN:" + $(this).attr("class")); // id=isbn }); bibkeys = bibkeys.join(','); var scriptElement = document.createElement("script"); scriptElement.setAttribute("id", "jsonScript"); scriptElement.setAttribute("src", "http://openlibrary.org/api/books?bibkeys=" + escape(bibkeys) + "&callback=KOHA.OpenLibrary.olCallBack&jscmd=data"); scriptElement.setAttribute("type", "text/javascript"); document.documentElement.firstChild.appendChild(scriptElement); }, /** * Add cover pages