From 511720999af2a231a66ecde5b4be36212d628394 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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) Signed-off-by: Rasmus Leißner Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../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 5ed4c17442..54e50d1e42 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -93,6 +93,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 %]
@@ -1487,6 +1494,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 %] @@ -1530,6 +1541,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.39.5