From 2a4a91aef3ecaacdf3d01dc358f9486b96fba705 Mon Sep 17 00:00:00 2001 From: mbeaulieu Date: Fri, 8 Aug 2014 09:49:53 -0400 Subject: [PATCH] Bug 11982 - Images now display properly in the details section. If the a cover image exists, it will be displayed on the details page. Nothing is displayed of there is no cover available. modified: koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js modified: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Works as described, passes tests and QA script. Checked Amazon covers and local covers display correctly in staff on results and detail pages. Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/js/localcovers.js | 5 +- .../prog/en/modules/catalogue/detail.tt | 54 +++++++++++-------- .../prog/en/modules/catalogue/results.tt | 2 +- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js b/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js index 253d7a6082..ac1f885dcf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js @@ -28,11 +28,10 @@ KOHA.LocalCover = { var img = $("").attr('src', '/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class")) .load(function () { - if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { + if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth <= 1) { //IE HACK try { - $(mydiv).append(img); - $(mydiv).children('.no-image').remove(); + $(mydiv).remove(); } catch(err){ } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 48bc90b259..a392e1afde 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -28,19 +28,22 @@ //= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { - w = this.width; - h = this.height; - if ((w == 1) || (h == 1)) { - $("#bookcoverimg").remove(); - $(".yui-gb").attr("class","yui-g"); - } else if ((this.complete != null) && (!this.complete)) { - $("#bookcoverimg").remove(); - $(".yui-gb").attr("class","yui-g"); + w = this.width; + h = this.height; + if ((w == 1) || (h == 1)) { + $("#amazon-bookcoverimg").remove(); + $(".yui-gb").attr("class","yui-g"); + } else if ((this.complete != null) && (!this.complete)) { + $("#amazon-bookcoverimg").remove(); + $(".yui-gb").attr("class","yui-g"); + } } - } }); + if( $(this).find('img').length < 1 ) $(this).remove(); + }); $("#editions img").each(function(i){ if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { w = this.width; @@ -189,7 +192,7 @@ function verify_images() { }); }); - [% IF ( AmazonCoverImages ) %]$(window).load(function() { + [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() { verify_images(); });[% END %] //]]> @@ -376,17 +379,21 @@ function verify_images() { MARC Preview: Show [% IF ( holdcount ) %]Holds: [% holdcount %][% ELSE %][% END %] - [% IF ( ( AmazonEnabled && AmazonCoverImages ) || LocalCoverImages ) %] + [% IF ( AmazonCoverImages || LocalCoverImages ) %]
- [% IF ( LocalCoverImages ) %]
[% END %] - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %] + [% END %] [% END %] [% ELSE %] @@ -450,10 +457,13 @@ function verify_images() {
- [% IF ( ( AmazonEnabled && AmazonCoverImages ) || LocalCoverImages ) %] + [% IF ( AmazonCoverImages || LocalCoverImages ) %]
- [% IF ( LocalCoverImages ) %]
[% END %] - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]
+ [% IF ( LocalCoverImages ) %] +
+ [% END %] + [% IF ( AmazonCoverImages ) %] + - [% END %][% END %] + [% END %]
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 933453c561..785da666c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -16,7 +16,7 @@ var q_array = new Array(); // will hold search terms, if present // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html function verify_images() { $("img").each(function(i){ - if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0)) { + if ((this.src.indexOf('images-amazon.com') >= 0) || (this.src.indexOf('images.amazon.com') >=0)) { w = this.width; h = this.height; if ((w == 1) || (h == 1)) { -- 2.39.5