1 if (typeof KOHA == "undefined" || !KOHA) {
6 * A namespace for local cover related functions.
13 * <div title="biblionumber" id="isbn" class="openlibrary-thumbnail"></div>
15 * <div title="biblionumber" id="isbn" class="openlibrary-thumbnail-preview"></div>
16 * and run a search with all collected isbns to Open Library Book Search.
17 * The result is asynchronously returned by OpenLibrary and catched by
20 GetCoverFromBibnumber: function(uselink) {
21 $("div[id^=local-thumbnail],span[id^=local-thumbnail]").each(function(i) {
23 var message = document.createElement("span");
24 $(message).attr("class","no-image");
25 $(message).html(NO_LOCAL_JACKET);
26 $(mydiv).parent().find('.no-image').remove();
27 $(mydiv).append(message);
28 var img = $("<img />").attr('src',
29 '/cgi-bin/koha/opac-image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class"))
31 this.setAttribute("class", "thumbnail");
32 if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
36 $(mydiv).children('.no-image').remove();
40 } else if (this.width > 1) { // don't show the silly 1px "no image" img
42 var a = $("<a />").attr('href', '/cgi-bin/koha/opac-imageviewer.pl?biblionumber=' + $(mydiv).attr("class"));
44 $(mydiv).empty().append(a);
46 $(mydiv).empty().append(img);
48 $(mydiv).children('.no-image').remove();
53 GetCoverFromItemnumber: function(uselink) {
54 $("div[class^=local-thumbnail],span[class^=local-thumbnail]").each(function(i) {
56 var message = document.createElement("span");
57 var imagenumber = $(mydiv).data("imagenumber");
58 var biblionumber = $(mydiv).data("biblionumber");
59 $(message).attr("class","no-image");
60 $(message).html(NO_LOCAL_JACKET);
61 $(mydiv).parent().find('.no-image').remove();
62 $(mydiv).append(message);
63 var img = $("<img />").attr('src',
64 '/cgi-bin/koha/opac-image.pl?thumbnail=1&imagenumber=' + imagenumber)
66 this.setAttribute("class", "thumbnail");
67 if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
71 $(mydiv).children('.no-image').remove();
75 } else if (this.width > 1) { // don't show the silly 1px "no image" img
77 var a = $("<a />").attr('href', '/cgi-bin/koha/opac-imageviewer.pl?imagenumber=' + imagenumber + '&biblionumber=' + biblionumber);
79 $(mydiv).empty().append(a);
81 $(mydiv).empty().append(img);
83 $(mydiv).children('.no-image').remove();