[% END %]
@@ -986,71 +992,75 @@ Note that permanent location is a code, and location may be an authval.
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_images() {
// Loop over each container in the template which contains covers
- $(".cover-image").each( function( index ){
- var div = $(this);
- // Find the image in the container
- var img = div.find("img")[0];
- if( $(img).length > 0 ){
- if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
- // No image loaded in the container. Remove the slide
- div.remove();
- } else {
- // All slides start hidden. If this is the first one, show it.
- if( index == 0 ){
- div.show();
- }
- // Check if Amazon image is present
- if ( div.attr("id") == "amazon-bookcoverimg" ) {
- w = img.width;
- h = img.height;
- if ((w == 1) || (h == 1)) {
- // Amazon returned single-pixel placeholder
- // Remove the container
- div.remove();
+ $(".cover-slider").each(function(){
+ $(this).find(".cover-image").each( function( index ){
+ var div = $(this);
+ // Find the image in the container
+ var img = div.find("img")[0];
+ if( $(img).length > 0 ){
+ if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
+ // No image loaded in the container. Remove the slide
+ div.remove();
+ } else {
+ // All slides start hidden. If this is the first one, show it.
+ if( index == 0 ){
+ div.show();
}
- }
- if( div.attr("id") == "custom-img" ){
- if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
- // No image was loaded via the CustomCoverImages system preference
- // Remove the container
- div.remove();
+ // Check if Amazon image is present
+ if ( div.attr("id") == "amazon-bookcoverimg" ) {
+ w = img.width;
+ h = img.height;
+ if ((w == 1) || (h == 1)) {
+ // Amazon returned single-pixel placeholder
+ // Remove the container
+ div.remove();
+ }
}
- }
- if( div.attr("id") == "coce-coverimg" ){
- // Identify which service's image is being loaded by Coce
- if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
- div.find(".hint").html(_("Coce image from Amazon.com"));
- } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
- div.find(".hint").html(_("Coce image from Google Books"));
- } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
- div.find(".hint").html(_("Coce image from Open Library"));
+ if( div.attr("id") == "custom-img" ){
+ if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
+ // No image was loaded via the CustomCoverImages system preference
+ // Remove the container
+ div.remove();
+ }
+ }
+ if( div.attr("id") == "coce-coverimg" ){
+ // Identify which service's image is being loaded by Coce
+ if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
+ div.find(".hint").html(_("Coce image from Amazon.com"));
+ } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
+ div.find(".hint").html(_("Coce image from Google Books"));
+ } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
+ div.find(".hint").html(_("Coce image from Open Library"));
+ }
}
}
}
- }
+ });
});
- var coverSlides = $(".cover-image");
- if( coverSlides.length > 1 ){
- coverSlides.each(function( index ){
- // If more that one slide is present, add a navigation link
- // for activating the slide
- var covernav = $("");
- if( index == 0 ){
- // Set the first navigation link as active
- $(covernav).addClass("nav-active");
- }
- $(covernav).html("");
- $("#cover-slides").append( covernav );
-
- });
- }
+ $(".cover-slider").each(function(){
+ var coverSlide = this;
+ var coverImages = $(this).find(".cover-image");
+ if( coverImages.length > 1 ){
+ coverImages.each(function( index ){
+ // If more that one image is present, add a navigation link
+ // for activating the slide
+ var covernav = $("");
+ if( index == 0 ){
+ // Set the first navigation link as active
+ $(covernav).addClass("nav-active");
+ }
+ $(covernav).html("");
+ $(coverSlide).append( covernav );
+ });
+ }
- if( $(".cover-image:visible").length < 1 ){
- $("#cover-slides").remove();
- } else {
- $("#cover-slides").addClass("cover-slides");
- }
+ if( $(coverSlide).find(".cover-image:visible").length < 1 ){
+ $(coverSlide).remove();
+ } else {
+ $(coverSlide).addClass("cover-slides");
+ }
+ });
$("#editions img").each(function(i){
if ( this.src.indexOf('amazon.com') >= 0 ) {
@@ -1223,14 +1233,15 @@ Note that permanent location is a code, and location may be an authval.
link = $(this).attr("href");
openWindow(link,"Print spine label",400,400);
});
- $("#cover-slides").on("click",".cover-nav", function(e){
+ $(".cover-slider").on("click",".cover-nav", function(e){
e.preventDefault();
+ var cover_slider = $(this).parent();
// Adding click handler for cover image navigation links
var num = $(this).data("num");
- $(".cover-nav").removeClass("nav-active");
+ $(cover_slider).find(".cover-nav").removeClass("nav-active");
$(this).addClass("nav-active");
- $(".cover-image").hide();
- $(".cover-image").eq( num ).show();
+ $(cover_slider).find(".cover-image").hide();
+ $(cover_slider).find(".cover-image").eq( num ).show();
});
});
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt
@@ -100,7 +100,7 @@