|
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 25-33
Link Here
|
| 25 |
› |
35 |
› |
| 26 |
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog |
36 |
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog |
| 27 |
</title> |
37 |
</title> |
| 28 |
[% INCLUDE 'doc-head-close.inc' %] |
|
|
| 29 |
|
38 |
|
| 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" /> |
39 |
<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" /> |
|
|
40 |
[% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %] |
| 41 |
[% INCLUDE 'doc-head-close.inc' %] |
| 31 |
</head> |
42 |
</head> |
| 32 |
[% BLOCK cssinclude %][% END %] |
43 |
[% BLOCK cssinclude %][% END %] |
| 33 |
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] |
44 |
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] |
|
Lines 329-423
Link Here
|
| 329 |
[% END %] |
340 |
[% END %] |
| 330 |
</td> |
341 |
</td> |
| 331 |
[% END %] |
342 |
[% END %] |
| 332 |
|
343 |
[% IF ( CoverImages) %] |
|
|
344 |
<td class="covercol"> |
| 345 |
[% INCLUDE 'cover-images.inc' %] |
| 346 |
</td> |
| 347 |
[% END %] |
| 333 |
[% # Cell 4: Search result details and controls %] |
348 |
[% # Cell 4: Search result details and controls %] |
| 334 |
<td class="bibliocol"> |
349 |
<td class="bibliocol"> |
| 335 |
[% IF ( SEARCH_RESULT.title ) %] |
|
|
| 336 |
[% img_title = SEARCH_RESULT.title %] |
| 337 |
[% ELSE %] |
| 338 |
[% img_title = SEARCH_RESULT.biblionumber %] |
| 339 |
[% 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 && SEARCH_RESULT.has_local_cover_image ) %] |
| 344 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span> |
| 345 |
[% END %] |
| 346 |
|
| 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 ) %] |
350 |
[% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %] |
| 422 |
<!-- COinS / Openurl --> |
351 |
<!-- COinS / Openurl --> |
| 423 |
<span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span> |
352 |
<span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span> |
|
Lines 578-583
Link Here
|
| 578 |
[% IF OpenLibraryCovers || OpenLibrarySearch %] |
507 |
[% IF OpenLibraryCovers || OpenLibrarySearch %] |
| 579 |
[% Asset.js("js/openlibrary.js") | $raw %] |
508 |
[% Asset.js("js/openlibrary.js") | $raw %] |
| 580 |
[% END %] |
509 |
[% END %] |
|
|
510 |
[% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %] |
| 581 |
[% CoverImagePlugins | $raw %] |
511 |
[% CoverImagePlugins | $raw %] |
| 582 |
<script> |
512 |
<script> |
| 583 |
[% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %] |
513 |
[% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %] |
|
Lines 688-693
Link Here
|
| 688 |
} |
618 |
} |
| 689 |
[% END # /IF OpacHighlightedWords %] |
619 |
[% END # /IF OpacHighlightedWords %] |
| 690 |
|
620 |
|
|
|
621 |
function verify_cover_images() { |
| 622 |
// Loop over each container in the template which contains covers |
| 623 |
$(".cover-slider").each(function( index ){ |
| 624 |
let biblionumber = $(this).data("biblionumber"); |
| 625 |
let booktitle = $(this).data("title"); |
| 626 |
var lightbox_descriptions = []; |
| 627 |
$(this).find(".cover-image").each( function( index ){ |
| 628 |
var div = $(this); |
| 629 |
// Find the image in the container |
| 630 |
var img = div.find("img")[0]; |
| 631 |
if( img && $(img).length > 0 ){ |
| 632 |
// All slides start hidden. If this is the first one, show it. |
| 633 |
// Check if Amazon image is present |
| 634 |
if ( div.hasClass("amazon-coverimg") ) { |
| 635 |
let w = img.width; |
| 636 |
let h = img.height; |
| 637 |
if ((w == 1) || (h == 1)) { |
| 638 |
// Amazon returned single-pixel placeholder |
| 639 |
// Remove the container |
| 640 |
div.remove(); |
| 641 |
} else { |
| 642 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 643 |
} |
| 644 |
} else if( div.hasClass("custom-coverimg") ){ |
| 645 |
|
| 646 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
| 647 |
// No image was loaded via the CustomCoverImages system preference |
| 648 |
// Remove the container |
| 649 |
div.remove(); |
| 650 |
} else { |
| 651 |
lightbox_descriptions.push(_("Custom cover image")); |
| 652 |
} |
| 653 |
} else if( div.hasClass("syndetics-coverimg") ){ |
| 654 |
lightbox_descriptions.push(_("Image from Syndetics")) |
| 655 |
} else if( div.hasClass("googlejacket-coverimg" ) ){ |
| 656 |
if( img.naturalHeight ){ |
| 657 |
lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 658 |
} |
| 659 |
} else if( div.hasClass("openlibrary-coverimg") ){ |
| 660 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 661 |
} else if( div.hasClass("coce-coverimg" ) ){ |
| 662 |
// Identify which service's image is being loaded by Coce |
| 663 |
var coce_description; |
| 664 |
let src = $(img).attr("src"); |
| 665 |
if( src.indexOf('amazon.com') >= 0 ){ |
| 666 |
coce_description = _("Coce image from Amazon.com"); |
| 667 |
} else if( src.indexOf('google.com') >= 0 ){ |
| 668 |
coce_description = _("Coce image from Google Books"); |
| 669 |
} else if( src.indexOf('openlibrary.org') >= 0 ){ |
| 670 |
coce_description = _("Coce image from Open Library"); |
| 671 |
} |
| 672 |
div.find(".hint").html(coce_description); |
| 673 |
lightbox_descriptions.push(coce_description); |
| 674 |
} else if ( div.hasClass("bakertaylor-coverimg" ) ){ |
| 675 |
lightbox_descriptions.push(_("Image from Baker & Taylor")); |
| 676 |
} else if ( div.hasClass("cover-image local-coverimg" ) ){ |
| 677 |
lightbox_descriptions.push(_("Local cover image")); |
| 678 |
} else { |
| 679 |
lightbox_descriptions.push(_("Cover image source unknown")); |
| 680 |
} |
| 681 |
} else { |
| 682 |
div.remove(); |
| 683 |
} |
| 684 |
}); |
| 685 |
|
| 686 |
// Lightbox for cover images |
| 687 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
| 688 |
description: function(){ |
| 689 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
| 690 |
} |
| 691 |
}); |
| 692 |
|
| 693 |
}); |
| 694 |
|
| 695 |
$(".cover-slider").each(function(){ |
| 696 |
var coverSlide = this; |
| 697 |
var coverImages = $(this).find(".cover-image"); |
| 698 |
if( coverImages.length > 1 ){ |
| 699 |
coverImages.each(function( index ){ |
| 700 |
// If more that one image is present, add a navigation link |
| 701 |
// for activating the slide |
| 702 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
| 703 |
if( index == 0 ){ |
| 704 |
// Set the first navigation link as active |
| 705 |
$(covernav).addClass("nav-active"); |
| 706 |
} |
| 707 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
| 708 |
$(coverSlide).append( covernav ); |
| 709 |
}); |
| 710 |
} |
| 711 |
|
| 712 |
$(coverSlide).find(".cover-image").eq(0).show(); |
| 713 |
|
| 714 |
// if( $(coverSlide).find(".cover-image").length < 1 ){ |
| 715 |
// $(coverSlide).remove(); |
| 716 |
// } else { |
| 717 |
// This is a suboptimal workaround; we should do this via load, but |
| 718 |
// the image code is scattered all over now. We come here now after |
| 719 |
// window load and wait_for_images (so load completed). |
| 720 |
var check_complete = 1; |
| 721 |
$(coverSlide).find("img").each( function() { |
| 722 |
if( !this.complete || this.naturalHeight == 0 ) check_complete = 0; |
| 723 |
}); |
| 724 |
if( check_complete ) $(coverSlide).removeClass('cover-slides'); |
| 725 |
// } |
| 726 |
}); |
| 727 |
|
| 728 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
| 729 |
e.preventDefault(); |
| 730 |
var cover_slider = $(this).parent(); |
| 731 |
// Adding click handler for cover image navigation links |
| 732 |
var num = $(this).data("num"); |
| 733 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
| 734 |
$(this).addClass("nav-active"); |
| 735 |
$(cover_slider).find(".cover-image").hide(); |
| 736 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
| 737 |
}); |
| 738 |
|
| 739 |
$("#editions img").each(function(i){ |
| 740 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
| 741 |
let w = this.width; |
| 742 |
let h = this.height; |
| 743 |
if ((w == 1) || (h == 1)) { |
| 744 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
| 745 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
| 746 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
| 747 |
} |
| 748 |
} |
| 749 |
}); |
| 750 |
} /* /verify_images */ |
| 751 |
|
| 752 |
|
| 753 |
let counter_wait = 0; |
| 754 |
function wait_for_images(cb){ |
| 755 |
|
| 756 |
var loaded = 1; |
| 757 |
counter_wait++; |
| 758 |
|
| 759 |
[% IF GoogleJackets %] |
| 760 |
if ( loaded ) { |
| 761 |
loaded = KOHA.Google.done; |
| 762 |
} |
| 763 |
[% END %] |
| 764 |
|
| 765 |
[% IF OpenLibraryCovers %] |
| 766 |
if ( loaded ) { |
| 767 |
loaded = KOHA.OpenLibrary.done; |
| 768 |
} |
| 769 |
[% END %] |
| 770 |
|
| 771 |
[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] |
| 772 |
if ( loaded ) { |
| 773 |
loaded = KOHA.coce.done; |
| 774 |
} |
| 775 |
[% END %] |
| 776 |
|
| 777 |
if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds |
| 778 |
window.setTimeout(function(){wait_for_images(cb);}, 100); |
| 779 |
} else { |
| 780 |
if (counter_wait >= 50 ) { |
| 781 |
} |
| 782 |
cb(); |
| 783 |
} |
| 784 |
} |
| 785 |
|
| 786 |
$(window).load(function() { |
| 787 |
wait_for_images(verify_cover_images); |
| 788 |
}); |
| 789 |
|
| 691 |
$(document).ready(function(){ |
790 |
$(document).ready(function(){ |
| 692 |
|
791 |
|
| 693 |
$(".moretoggle").click(function(e){ |
792 |
$(".moretoggle").click(function(e){ |
| 694 |
- |
|
|