Koha/koha-tmpl/intranet-tmpl/prog/js/localcovers.js
Jonathan Druart 4e66aa8065
Bug 35557: Remove LoadResultsCovers
The JS function LoadResultsCovers is not used from the Staff interface.

It is supposed to load the local cover images in JS but actually we are embedding the thumbnail in the img tag.

Test plan:
Confirm that LoadResultsCovers was called but had no effect.
Note that the selector ^local-thumbnail only exists in shelfbrowser.inc

but results.js is only used from results.tt (not shelfbrowser.inc)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-27 19:06:04 +01:00

41 lines
1.3 KiB
JavaScript

/* global __ */
if (typeof KOHA == "undefined" || !KOHA) {
var KOHA = {};
}
/**
* A namespace for local cover related functions.
*/
KOHA.LocalCover = {
/**
* Search all:
* <div title="biblionumber" id="isbn" class="openlibrary-thumbnail"></div>
* or
* <div title="biblionumber" id="isbn" class="openlibrary-thumbnail-preview"></div>
* and run a search with all collected isbns to Open Library Book Search.
* The result is asynchronously returned by OpenLibrary and catched by
* olCallBack().
*/
GetCoverFromBibnumber: function(uselink) {
var mydiv = $("#local-thumbnail-preview");
var biblionumber = mydiv.data("biblionumber");
var img = document.createElement("img");
img.src = "/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=" + biblionumber;
img.onload = function() {
// image dimensions can't be known until image has loaded
if ( (img.complete != null) && (!img.complete) ) {
mydiv.remove();
}
};
if (uselink) {
var a = $("<a />").attr('href', '/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=' + $(mydiv).attr("class"));
$(a).append(img);
mydiv.append(a);
} else {
mydiv.append(img);
}
},
};