1 if (KOHA
=== undefined || !KOHA
) { var KOHA
= {}; }
5 * A namespace for Coce cover images cache
11 * <div title="biblionumber" id="isbn" class="coce-thumbnail"></div>
13 * <div title="biblionumber" id="isbn" class="coce-thumbnail-preview"></div>
14 * and run a search with all collected isbns to coce cover service.
15 * The result is asynchronously returned, and used to append <img>.
17 getURL: function(host
,provider
,newWindow
) {
19 $("[id^=coce-thumbnail]").each(function(i
) {
20 var id
= $(this).attr("class"); // id=isbn
21 if ( id
!== '' ) { ids
.push(id
); }
23 if (ids
.length
== 0) return;
25 var coceURL
= host
+ '/cover?id=' + ids
+ '&provider=' + provider
;
29 success: function(urlPerID
){
30 for (var id
in urlPerID
) {
31 var url
= urlPerID
[id
];
32 $("[id^=coce-thumbnail]."+id
).each(function() {
33 var img
= document
.createElement("img");
35 img
.classList
.add("thumbnail");
36 img
.alt
= "Cover image";
37 img
.onload = function(){
38 // image dimensions can't be known until image has loaded
39 if( img
.height
== 1 && img
.width
== 1 ){