From 117f8a5ccc592631396ceacbf13d208528f59f51 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 27 Sep 2013 11:48:01 +0200 Subject: [PATCH] Bug 10856: Fix cover display in shelf browser Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer I was able to reproduce the problem with local covers and the patch fixes it in my tests. Signed-off-by: Galen Charlton --- .../prog/en/includes/shelfbrowser.inc | 18 ++++++++++++++++++ .../opac-tmpl/prog/en/js/google-jackets.js | 4 ++-- koha-tmpl/opac-tmpl/prog/en/js/localcovers.js | 4 ++-- koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/shelfbrowser.inc b/koha-tmpl/opac-tmpl/prog/en/includes/shelfbrowser.inc index b910592227..e991766459 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/shelfbrowser.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/shelfbrowser.inc @@ -100,6 +100,15 @@ }, success: function(data){ $("#shelfbrowser").replaceWith(data); + [% IF ( GoogleJackets ) %] + KOHA.Google.GetCoverFromIsbn([% covernewwindow %]); + [% END %] + [% IF OpenLibraryCovers %] + KOHA.OpenLibrary.GetCoverFromIsbn(); + [% END %] + [% IF OPACLocalCoverImages %] + KOHA.LocalCover.GetCoverFromBibnumber(true); + [% END %] } }); }); @@ -115,6 +124,15 @@ }, success: function(data){ $("#shelfbrowser").replaceWith(data); + [% IF ( GoogleJackets ) %] + KOHA.Google.GetCoverFromIsbn([% covernewwindow %]); + [% END %] + [% IF OpenLibraryCovers %] + KOHA.OpenLibrary.GetCoverFromIsbn(); + [% END %] + [% IF OPACLocalCoverImages %] + KOHA.LocalCover.GetCoverFromBibnumber(true); + [% END %] } }); }); diff --git a/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js b/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js index f129c3805e..b23599f24f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js @@ -51,7 +51,7 @@ KOHA.Google = { if (typeof(book.thumbnail_url) != "undefined") { var img = document.createElement("img"); img.src = book.thumbnail_url; - $(this).append(img); + $(this).empty().append(img); var re = /^gbs-thumbnail-preview/; if ( re.exec($(this).attr("id")) ) { $(this).append( @@ -67,7 +67,7 @@ KOHA.Google = { var message = document.createElement("span"); $(message).attr("class","no-image"); $(message).html(NO_GOOGLE_JACKET); - $(this).append(message); + $(this).empty().append(message); } }); } diff --git a/koha-tmpl/opac-tmpl/prog/en/js/localcovers.js b/koha-tmpl/opac-tmpl/prog/en/js/localcovers.js index 6d247983bf..7bd7ae254a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/localcovers.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/localcovers.js @@ -39,9 +39,9 @@ KOHA.LocalCover = { if (uselink) { var a = $("").attr('href', '/cgi-bin/koha/opac-imageviewer.pl?biblionumber=' + $(mydiv).attr("class")); $(a).append(img); - $(mydiv).append(a); + $(mydiv).empty().append(a); } else { - $(mydiv).append(img); + $(mydiv).empty().append(img); } $(mydiv).children('.no-image').remove(); } diff --git a/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js b/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js index 10a58dd38a..9142273b96 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js @@ -48,7 +48,7 @@ KOHA.OpenLibrary = { var img = document.createElement("img"); if (is_opacdetail) { img.src = book.cover.medium; - $(this).append(img); + $(this).empty().append(img); $(this).append(''); } else { img.src = book.cover.medium; -- 2.39.5