From 43fb9f9c7ab850db8277e60f436514746187f2d6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 Dec 2023 10:32:12 +0100 Subject: [PATCH] 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 Signed-off-by: Julian Maurice Signed-off-by: Katrin Fischer (cherry picked from commit 4e66aa8065803fb2829db988ca1f4c71cc641137) Signed-off-by: Fridolin Somers --- .../intranet-tmpl/prog/js/localcovers.js | 38 ------------------- .../intranet-tmpl/prog/js/pages/results.js | 4 -- 2 files changed, 42 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/localcovers.js b/koha-tmpl/intranet-tmpl/prog/js/localcovers.js index fe94760aa4..aa9c3b1626 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/localcovers.js +++ b/koha-tmpl/intranet-tmpl/prog/js/localcovers.js @@ -38,42 +38,4 @@ KOHA.LocalCover = { mydiv.append(img); } }, - LoadResultsCovers: function(){ - $("div [id^=local-thumbnail]").each(function(i) { - var mydiv = this; - var message = document.createElement("span"); - $(message).attr("class","no-image thumbnail"); - $(message).html( __("No cover image available") ); - $(mydiv).append(message); - var img = $(""); - img.attr('src','/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class")) - .addClass("thumbnail") - .load(function () { - if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth <= 1) { - //IE HACK - try { - var otherCovers = $(mydiv).closest('td').find('img'); - var nbCovers = otherCovers.length; - if(nbCovers > 0){ - var badCovers = 0; - otherCovers.each(function(){ - if(this.naturalWidth <= 1){ - $(this).parent().remove(); - badCovers++; - } - }); - if(badCovers < nbCovers){ - $(mydiv).parent().remove(); - } - } - } - catch(err){ - } - } else { - $(mydiv).append(img); - $(mydiv).children('.no-image').remove(); - } - }); - }); - } }; diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js index 511dc7d1c1..72dc9304f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js @@ -231,10 +231,6 @@ $(document).ready(function() { } } - if( PREF_LocalCoverImages ){ - KOHA.LocalCover.LoadResultsCovers(); - } - if( PREF_IntranetCoce && PREF_CoceProviders ){ KOHA.coce.getURL( CoceHost, CoceProviders ); } -- 2.20.1