From 4299298955b74a03a6fca7b5e77e606bd49a6aca Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 20 Apr 2021 14:08:01 +0200 Subject: [PATCH] Bug 28180: Reintroduce and adjust Google Jackets Test plan: 1. Turn on GoogleJackets 2. Display the cover images in the gallery Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch) --- .../bootstrap/en/modules/opac-detail.tt | 13 +++++++ .../opac-tmpl/bootstrap/js/google-jackets.js | 38 +++++++++++-------- 2 files changed, 36 insertions(+), 15 deletions(-) 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 5822c4927b..ad74cb647c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -104,6 +104,13 @@ [% END %] [% END %] + [% IF ( GoogleJackets ) %] +
+
+
Image from Google Jackets
+
+ [% END %] + [% IF ( Koha.Preference('OPACCoce') && Koha.Preference('CoceProviders') && normalized_isbn ) %] [% coce_id = normalized_ean || normalized_isbn %]
@@ -1647,6 +1654,10 @@ [% END %] [% END %] + [% IF ( GoogleJackets ) %] + 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 %]); [% END %] @@ -1690,6 +1701,8 @@ } } else if( div.attr("id") == "syndetics-coverimg" ){ lightbox_descriptions.push("Image from Syndetics") + } else if( div.attr("id") == "googlejacket-coverimg" ){ + lightbox_descriptions.push(_("Image from Google Jacket (see the original image)").format($(img).data('link'))); } else if( div.attr("id") == "coce-coverimg" ){ // Identify which service's image is being loaded by Coce var coce_description; diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js b/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js index 85592cd659..ad1fd638a4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js @@ -46,22 +46,30 @@ KOHA.Google = { for (id in booksInfo) { var book = booksInfo[id]; $("[id^=gbs-thumbnail]."+book.bib_key).each(function() { - var a = document.createElement("a"); - a.href = book.info_url; if (typeof(book.thumbnail_url) != "undefined") { - var img = document.createElement("img"); - img.src = book.thumbnail_url; - $(this).empty().append(img); - var re = /^gbs-thumbnail-preview/; - if ( re.exec($(this).attr("id")) ) { - $(this).append( - '
' + - '
' - ); + if ( $(this).data('use-data-link') ) { + var a = document.createElement("a"); + a.href = book.thumbnail_url; + var img = document.createElement("img"); + img.src = book.thumbnail_url; + img.setAttribute('data-link', book.info_url); + a.append(img) + $(this).empty().append(a); + } else { + var img = document.createElement("img"); + img.src = book.thumbnail_url; + $(this).empty().append(img); + var re = /^gbs-thumbnail-preview/; + if ( re.exec($(this).attr("id")) ) { + $(this).append( + '
' + + '
' + ); + } } } else { var message = document.createElement("span"); -- 2.20.1