Lines 6-12
Link Here
|
6 |
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %] |
6 |
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %] |
7 |
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %] |
7 |
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %] |
8 |
[% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] |
8 |
[% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] |
9 |
|
9 |
[% SET OPACLocalCoverImages = Koha.Preference('OPACLocalCoverImages') %] |
|
|
10 |
[% SET OPACAmazonCoverImages = Koha.Preference('OPACAmazonCoverImages') %] |
11 |
[% SET SyndeticsCoverImages = ( Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') ) %] |
12 |
[% SET GoogleJackets = Koha.Preference('GoogleJackets') %] |
13 |
[% SET OpenLibraryCovers = Koha.Preference('OpenLibraryCovers') %] |
14 |
[% SET BakerTaylorEnabled = Koha.Preference('BakerTaylorEnabled') %] |
15 |
[% SET OPACCoce = ( Koha.Preference('OPACCoce') && Koha.Preference('CoceProviders') ) %] |
16 |
[% IF ( CoverImagePlugins || OPACLocalCoverImages || OPACAmazonCoverImages || SyndeticsCoverImages || GoogleJackets || OpenLibraryCovers || BakerTaylorEnabled || OPACCoce || OPACCustomCoverImages ) %] |
17 |
[% SET CoverImages = 1 %] |
18 |
[% END %] |
19 |
[% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %] |
10 |
[% IF firstPage %] |
20 |
[% IF firstPage %] |
11 |
[% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %] |
21 |
[% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %] |
12 |
[% END %] |
22 |
[% END %] |
Lines 30-35
Link Here
|
30 |
[% BLOCK cssinclude %][% END %] |
40 |
[% BLOCK cssinclude %][% END %] |
31 |
|
41 |
|
32 |
<link rel="alternate" type="application/rss+xml" title="[% LibraryName | html %] Search RSS feed" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&count=[% countrss |uri %]&sort_by=acqdate_dsc&format=rss" /> |
42 |
<link rel="alternate" type="application/rss+xml" title="[% LibraryName | html %] Search RSS feed" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&count=[% countrss |uri %]&sort_by=acqdate_dsc&format=rss" /> |
|
|
43 |
[% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %] |
33 |
</head> |
44 |
</head> |
34 |
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] |
45 |
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] |
35 |
[% INCLUDE 'masthead.inc' %] |
46 |
[% INCLUDE 'masthead.inc' %] |
Lines 330-424
Link Here
|
330 |
[% END %] |
341 |
[% END %] |
331 |
</td> |
342 |
</td> |
332 |
[% END %] |
343 |
[% END %] |
333 |
|
344 |
[% IF ( CoverImages) %] |
|
|
345 |
<td class="covercol"> |
346 |
[% INCLUDE 'cover-images.inc' %] |
347 |
</td> |
348 |
[% END %] |
334 |
[% # Cell 4: Search result details and controls %] |
349 |
[% # Cell 4: Search result details and controls %] |
335 |
<td class="bibliocol"> |
350 |
<td class="bibliocol"> |
336 |
[% IF ( SEARCH_RESULT.title ) %] |
|
|
337 |
[% img_title = SEARCH_RESULT.title %] |
338 |
[% ELSE %] |
339 |
[% img_title = SEARCH_RESULT.biblionumber %] |
340 |
[% END %] |
341 |
<div class="coverimages cover-slides itemtype_[% SEARCH_RESULT.itemtype | html %]" data-isbn="[% To.json(SEARCH_RESULT.normalized_isbn) | $raw %]" data-imgtitle="[% img_title | html %]"> |
342 |
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]"> |
343 |
|
344 |
[% IF ( OPACLocalCoverImages && SEARCH_RESULT.has_local_cover_image ) %] |
345 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span> |
346 |
[% END %] |
347 |
|
348 |
[% IF ( OPACAmazonCoverImages ) %] |
349 |
[% IF ( SEARCH_RESULT.normalized_isbn ) %] |
350 |
<span title="[% img_title | html %]" id="amazon-thumbnail[% loop.count | html %]"><img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="" class="item-thumbnail" /></span> |
351 |
[% ELSE %] |
352 |
<span class="no-image">No cover image available</span> |
353 |
[% END %] |
354 |
[% END %] |
355 |
|
356 |
[% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %] |
357 |
[% IF ( SEARCH_RESULT.normalized_isbn || SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_oclc ) %] |
358 |
<span title="[% img_title | html %]" id="syndetics-thumbnail[% loop.count | html %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&client=[% SyndeticsClientCode | html %]&type=xw10&upc=[% SEARCH_RESULT.normalized_upc | html %]&oclc=[% SEARCH_RESULT.normalized_oclc | html %]" alt="" class="item-thumbnail" /></span> |
359 |
[% ELSE %] |
360 |
<span class="no-image">No cover image available</span> |
361 |
[% END %] |
362 |
[% END %] |
363 |
|
364 |
[% IF ( GoogleJackets ) %] |
365 |
[% IF ( SEARCH_RESULT.normalized_isbn ) %] |
366 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></span> |
367 |
[% ELSE %] |
368 |
<span class="no-image">No cover image available</span> |
369 |
[% END %] |
370 |
[% END %] |
371 |
|
372 |
[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] |
373 |
[% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn | html %] |
374 |
[% IF ( coce_id ) %] |
375 |
<span title="[% img_title | html %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span> |
376 |
[% ELSE %] |
377 |
<span class="no-image">No cover image available</span> |
378 |
[% END %] |
379 |
[% END %] |
380 |
|
381 |
[% IF OpenLibraryCovers %] |
382 |
[% IF SEARCH_RESULT.normalized_isbn %] |
383 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span> |
384 |
[% ELSE %] |
385 |
<span class="no-image">No cover image available</span> |
386 |
[% END %] |
387 |
[% END %] |
388 |
|
389 |
[% IF ( BakerTaylorEnabled && !BakerTaylorBookstoreURL ) %] |
390 |
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] |
391 |
[% IF ( bt_id ) %] |
392 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /> |
393 |
[% ELSE %] |
394 |
<span class="no-image">No cover image available</span> |
395 |
[% END %] |
396 |
[% END %] |
397 |
</a> |
398 |
|
399 |
[% IF ( BakerTaylorEnabled && BakerTaylorBookstoreURL ) %] |
400 |
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] |
401 |
[% IF ( bt_id ) %] |
402 |
<a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]"> |
403 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /> |
404 |
</a> |
405 |
[% ELSE %] |
406 |
<span class="no-image">No cover image available</span> |
407 |
[% END %] |
408 |
[% END %] |
409 |
|
410 |
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %] |
411 |
[% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %] |
412 |
[% IF custom_cover_image_url %] |
413 |
[% IF ( OPACURLOpenInNewWindow ) %] |
414 |
<a class="custom_cover_image" href="[% custom_cover_image_url | url %]" target="_blank" rel="noreferrer"><img alt="Cover image" src="[% custom_cover_image_url | url %]" /></a> |
415 |
[% ELSE %] |
416 |
<a class="custom_cover_image" href="[% custom_cover_image_url | url %]"><img alt="Cover image" src="[% custom_cover_image_url | url %]" /></a> |
417 |
[% END %] |
418 |
[% END %] |
419 |
[% END %] |
420 |
|
421 |
</div> |
422 |
[% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %] |
351 |
[% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %] |
423 |
<!-- COinS / Openurl --> |
352 |
<!-- COinS / Openurl --> |
424 |
<span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span> |
353 |
<span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span> |
Lines 579-584
Link Here
|
579 |
[% IF OpenLibraryCovers || OpenLibrarySearch %] |
508 |
[% IF OpenLibraryCovers || OpenLibrarySearch %] |
580 |
[% Asset.js("js/openlibrary.js") | $raw %] |
509 |
[% Asset.js("js/openlibrary.js") | $raw %] |
581 |
[% END %] |
510 |
[% END %] |
|
|
511 |
[% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %] |
582 |
[% CoverImagePlugins | $raw %] |
512 |
[% CoverImagePlugins | $raw %] |
583 |
<script> |
513 |
<script> |
584 |
[% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %] |
514 |
[% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %] |
Lines 689-694
Link Here
|
689 |
} |
619 |
} |
690 |
[% END # /IF OpacHighlightedWords %] |
620 |
[% END # /IF OpacHighlightedWords %] |
691 |
|
621 |
|
|
|
622 |
function verify_cover_images() { |
623 |
// Loop over each container in the template which contains covers |
624 |
$(".cover-slider").each(function( index ){ |
625 |
let biblionumber = $(this).data("biblionumber"); |
626 |
let booktitle = $(this).data("title"); |
627 |
var lightbox_descriptions = []; |
628 |
$(this).find(".cover-image").each( function( index ){ |
629 |
var div = $(this); |
630 |
// Find the image in the container |
631 |
var img = div.find("img")[0]; |
632 |
if( img && $(img).length > 0 ){ |
633 |
// All slides start hidden. If this is the first one, show it. |
634 |
// Check if Amazon image is present |
635 |
if ( div.hasClass("amazon-coverimg") ) { |
636 |
let w = img.width; |
637 |
let h = img.height; |
638 |
if ((w == 1) || (h == 1)) { |
639 |
// Amazon returned single-pixel placeholder |
640 |
// Remove the container |
641 |
div.remove(); |
642 |
} else { |
643 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
644 |
} |
645 |
} else if( div.hasClass("custom-coverimg") ){ |
646 |
|
647 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
648 |
// No image was loaded via the CustomCoverImages system preference |
649 |
// Remove the container |
650 |
div.remove(); |
651 |
} else { |
652 |
lightbox_descriptions.push(_("Custom cover image")); |
653 |
} |
654 |
} else if( div.hasClass("syndetics-coverimg") ){ |
655 |
lightbox_descriptions.push(_("Image from Syndetics")) |
656 |
} else if( div.hasClass("googlejacket-coverimg" ) ){ |
657 |
if( img.naturalHeight ){ |
658 |
lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
659 |
} |
660 |
} else if( div.hasClass("openlibrary-coverimg") ){ |
661 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
662 |
} else if( div.hasClass("coce-coverimg" ) ){ |
663 |
// Identify which service's image is being loaded by Coce |
664 |
var coce_description; |
665 |
let src = $(img).attr("src"); |
666 |
if( src.indexOf('amazon.com') >= 0 ){ |
667 |
coce_description = _("Coce image from Amazon.com"); |
668 |
} else if( src.indexOf('google.com') >= 0 ){ |
669 |
coce_description = _("Coce image from Google Books"); |
670 |
} else if( src.indexOf('openlibrary.org') >= 0 ){ |
671 |
coce_description = _("Coce image from Open Library"); |
672 |
} |
673 |
div.find(".hint").html(coce_description); |
674 |
lightbox_descriptions.push(coce_description); |
675 |
} else if ( div.hasClass("bakertaylor-coverimg" ) ){ |
676 |
lightbox_descriptions.push(_("Image from Baker & Taylor")); |
677 |
} else if ( div.hasClass("cover-image local-coverimg" ) ){ |
678 |
lightbox_descriptions.push(_("Local cover image")); |
679 |
} else { |
680 |
lightbox_descriptions.push(_("Cover image source unknown")); |
681 |
} |
682 |
} else { |
683 |
div.remove(); |
684 |
} |
685 |
}); |
686 |
|
687 |
// Lightbox for cover images |
688 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
689 |
description: function(){ |
690 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
691 |
} |
692 |
}); |
693 |
|
694 |
}); |
695 |
|
696 |
$(".cover-slider").each(function(){ |
697 |
var coverSlide = this; |
698 |
var coverImages = $(this).find(".cover-image"); |
699 |
if( coverImages.length > 1 ){ |
700 |
coverImages.each(function( index ){ |
701 |
// If more that one image is present, add a navigation link |
702 |
// for activating the slide |
703 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
704 |
if( index == 0 ){ |
705 |
// Set the first navigation link as active |
706 |
$(covernav).addClass("nav-active"); |
707 |
} |
708 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
709 |
$(coverSlide).append( covernav ); |
710 |
}); |
711 |
} |
712 |
|
713 |
$(coverSlide).find(".cover-image").eq(0).show(); |
714 |
|
715 |
// if( $(coverSlide).find(".cover-image").length < 1 ){ |
716 |
// $(coverSlide).remove(); |
717 |
// } else { |
718 |
// This is a suboptimal workaround; we should do this via load, but |
719 |
// the image code is scattered all over now. We come here now after |
720 |
// window load and wait_for_images (so load completed). |
721 |
var check_complete = 1; |
722 |
$(coverSlide).find("img").each( function() { |
723 |
if( !this.complete || this.naturalHeight == 0 ) check_complete = 0; |
724 |
}); |
725 |
if( check_complete ) $(coverSlide).removeClass('cover-slides'); |
726 |
// } |
727 |
}); |
728 |
|
729 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
730 |
e.preventDefault(); |
731 |
var cover_slider = $(this).parent(); |
732 |
// Adding click handler for cover image navigation links |
733 |
var num = $(this).data("num"); |
734 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
735 |
$(this).addClass("nav-active"); |
736 |
$(cover_slider).find(".cover-image").hide(); |
737 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
738 |
}); |
739 |
|
740 |
$("#editions img").each(function(i){ |
741 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
742 |
let w = this.width; |
743 |
let h = this.height; |
744 |
if ((w == 1) || (h == 1)) { |
745 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
746 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
747 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
748 |
} |
749 |
} |
750 |
}); |
751 |
} /* /verify_images */ |
752 |
|
753 |
|
754 |
let counter_wait = 0; |
755 |
function wait_for_images(cb){ |
756 |
|
757 |
var loaded = 1; |
758 |
counter_wait++; |
759 |
|
760 |
[% IF GoogleJackets %] |
761 |
if ( loaded ) { |
762 |
loaded = KOHA.Google.done; |
763 |
} |
764 |
[% END %] |
765 |
|
766 |
[% IF OpenLibraryCovers %] |
767 |
if ( loaded ) { |
768 |
loaded = KOHA.OpenLibrary.done; |
769 |
} |
770 |
[% END %] |
771 |
|
772 |
[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] |
773 |
if ( loaded ) { |
774 |
loaded = KOHA.coce.done; |
775 |
} |
776 |
[% END %] |
777 |
|
778 |
if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds |
779 |
window.setTimeout(function(){wait_for_images(cb);}, 100); |
780 |
} else { |
781 |
if (counter_wait >= 50 ) { |
782 |
} |
783 |
cb(); |
784 |
} |
785 |
} |
786 |
|
787 |
$(window).load(function() { |
788 |
wait_for_images(verify_cover_images); |
789 |
}); |
790 |
|
692 |
$(document).ready(function(){ |
791 |
$(document).ready(function(){ |
693 |
|
792 |
|
694 |
$(".moretoggle").click(function(e){ |
793 |
$(".moretoggle").click(function(e){ |
695 |
- |
|
|