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