diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 1bb3debb6d..71aa68f180 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1880,7 +1880,7 @@ KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]); [% END %] [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] - KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]); + KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $("#bibliodescriptions")); [% END %] [% IF OpenLibraryCovers %] KOHA.OpenLibrary.GetCoverFromIsbn(); @@ -1906,7 +1906,7 @@ KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]); [% END %] [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] - KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]); + KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $("#bibliodescriptions")); [% END %] [% IF OpenLibraryCovers %] KOHA.OpenLibrary.GetCoverFromIsbn(); diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/coce.js b/koha-tmpl/opac-tmpl/bootstrap/js/coce.js index 65772380dd..8508d3a82b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/coce.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/coce.js @@ -14,9 +14,11 @@ KOHA.coce = { * and run a search with all collected isbns to coce cover service. * The result is asynchronously returned, and used to append . */ - getURL: function(host, provider) { + getURL: function(host, provider, parent=null) { var ids = []; - $("[id^=coce-thumbnail]").each(function() { + const thumbnail_selector = "[id^=coce-thumbnail]"; + let thumbnail_nodes = parent ? parent.find(thumbnail_selector) : $(thumbnail_selector); + thumbnail_nodes.each(function() { var id = $(this).attr("class"); // id=isbn if (id !== '') { ids.push(id); } }); @@ -40,7 +42,7 @@ KOHA.coce = { } }; $(this).attr('href', url); - $(this).empty().append(img); + $(this).append(img); }); } },