Lines 14-22
Link Here
|
14 |
[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled %] |
14 |
[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled %] |
15 |
[% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] |
15 |
[% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] |
16 |
[% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] |
16 |
[% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] |
17 |
|
17 |
[% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] |
18 |
[% IF firstPage %] |
18 |
[% SET OPACLocalCoverImages = Koha.Preference('OPACLocalCoverImages') %] |
19 |
[% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %] |
19 |
[% SET OPACAmazonCoverImages = Koha.Preference('OPACAmazonCoverImages') %] |
|
|
20 |
[% SET SyndeticsCoverImages = ( Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') ) %] |
21 |
[% SET GoogleJackets = Koha.Preference('GoogleJackets') %] |
22 |
[% SET OpenLibraryCovers = Koha.Preference('OpenLibraryCovers') %] |
23 |
[% SET BakerTaylorEnabled = Koha.Preference('BakerTaylorEnabled') %] |
24 |
[% SET OPACCoce = ( Koha.Preference('OPACCoce') && Koha.Preference('CoceProviders') ) %] |
25 |
[% IF ( CoverImagePlugins || OPACLocalCoverImages || OPACAmazonCoverImages || SyndeticsCoverImages || GoogleJackets || OpenLibraryCovers || BakerTaylorEnabled || OPACCoce || OPACCustomCoverImages ) %] |
26 |
[% IF firstPage %] |
27 |
[% SET CoverImages = 1 %] |
28 |
[% END %] |
29 |
[% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %] |
30 |
[% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %] |
20 |
[% END %] |
31 |
[% END %] |
21 |
|
32 |
|
22 |
[% INCLUDE 'doc-head-open.inc' %] |
33 |
[% INCLUDE 'doc-head-open.inc' %] |
Lines 38-43
Link Here
|
38 |
[% BLOCK cssinclude %][% END %] |
49 |
[% BLOCK cssinclude %][% END %] |
39 |
|
50 |
|
40 |
<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" /> |
51 |
<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" /> |
|
|
52 |
[% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %] |
41 |
</head> |
53 |
</head> |
42 |
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] |
54 |
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] |
43 |
[% INCLUDE 'masthead.inc' %] |
55 |
[% INCLUDE 'masthead.inc' %] |
Lines 251-345
Link Here
|
251 |
[% END %] |
263 |
[% END %] |
252 |
</td> |
264 |
</td> |
253 |
[% END %] |
265 |
[% END %] |
254 |
|
266 |
[% IF ( CoverImages) %] |
|
|
267 |
<td class="covercol"> |
268 |
[% INCLUDE 'cover-images.inc' %] |
269 |
</td> |
270 |
[% END %] |
255 |
[% # Cell 4: Search result details and controls %] |
271 |
[% # Cell 4: Search result details and controls %] |
256 |
<td class="bibliocol"> |
272 |
<td class="bibliocol"> |
257 |
[% IF ( SEARCH_RESULT.title ) %] |
|
|
258 |
[% img_title = SEARCH_RESULT.title %] |
259 |
[% ELSE %] |
260 |
[% img_title = SEARCH_RESULT.biblionumber %] |
261 |
[% END %] |
262 |
<div class="coverimages cover-slides itemtype_[% SEARCH_RESULT.itemtype | html %]" data-isbn="[% To.json(SEARCH_RESULT.normalized_isbn) | $raw %]" data-imgtitle="[% img_title | html %]"> |
263 |
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]"> |
264 |
|
265 |
[% IF ( OPACLocalCoverImages && SEARCH_RESULT.has_local_cover_image ) %] |
266 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span> |
267 |
[% END %] |
268 |
|
269 |
[% IF ( OPACAmazonCoverImages ) %] |
270 |
[% IF ( SEARCH_RESULT.normalized_isbn ) %] |
271 |
<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> |
272 |
[% ELSE %] |
273 |
<span class="no-image">No cover image available</span> |
274 |
[% END %] |
275 |
[% END %] |
276 |
|
277 |
[% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %] |
278 |
[% IF ( SEARCH_RESULT.normalized_isbn || SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_oclc ) %] |
279 |
<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> |
280 |
[% ELSE %] |
281 |
<span class="no-image">No cover image available</span> |
282 |
[% END %] |
283 |
[% END %] |
284 |
|
285 |
[% IF ( GoogleJackets ) %] |
286 |
[% IF ( SEARCH_RESULT.normalized_isbn ) %] |
287 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></span> |
288 |
[% ELSE %] |
289 |
<span class="no-image">No cover image available</span> |
290 |
[% END %] |
291 |
[% END %] |
292 |
|
293 |
[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] |
294 |
[% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn | html %] |
295 |
[% IF ( coce_id ) %] |
296 |
<span title="[% img_title | html %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span> |
297 |
[% ELSE %] |
298 |
<span class="no-image">No cover image available</span> |
299 |
[% END %] |
300 |
[% END %] |
301 |
|
302 |
[% IF OpenLibraryCovers %] |
303 |
[% IF SEARCH_RESULT.normalized_isbn %] |
304 |
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span> |
305 |
[% ELSE %] |
306 |
<span class="no-image">No cover image available</span> |
307 |
[% END %] |
308 |
[% END %] |
309 |
|
310 |
[% IF ( BakerTaylorEnabled && !BakerTaylorBookstoreURL ) %] |
311 |
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] |
312 |
[% IF ( bt_id ) %] |
313 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /> |
314 |
[% ELSE %] |
315 |
<span class="no-image">No cover image available</span> |
316 |
[% END %] |
317 |
[% END %] |
318 |
</a> |
319 |
|
320 |
[% IF ( BakerTaylorEnabled && BakerTaylorBookstoreURL ) %] |
321 |
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] |
322 |
[% IF ( bt_id ) %] |
323 |
<a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]"> |
324 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /> |
325 |
</a> |
326 |
[% ELSE %] |
327 |
<span class="no-image">No cover image available</span> |
328 |
[% END %] |
329 |
[% END %] |
330 |
|
331 |
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %] |
332 |
[% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %] |
333 |
[% IF custom_cover_image_url %] |
334 |
[% IF ( OPACURLOpenInNewWindow ) %] |
335 |
<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> |
336 |
[% ELSE %] |
337 |
<a class="custom_cover_image" href="[% custom_cover_image_url | url %]"><img alt="Cover image" src="[% custom_cover_image_url | url %]" /></a> |
338 |
[% END %] |
339 |
[% END %] |
340 |
[% END %] |
341 |
|
342 |
</div> |
343 |
[% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %] |
273 |
[% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %] |
344 |
<!-- COinS / Openurl --> |
274 |
<!-- COinS / Openurl --> |
345 |
<span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span> |
275 |
<span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span> |
Lines 499-504
Link Here
|
499 |
[% IF OpenLibraryCovers || OpenLibrarySearch %] |
429 |
[% IF OpenLibraryCovers || OpenLibrarySearch %] |
500 |
[% Asset.js("js/openlibrary.js") | $raw %] |
430 |
[% Asset.js("js/openlibrary.js") | $raw %] |
501 |
[% END %] |
431 |
[% END %] |
|
|
432 |
[% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %] |
502 |
[% CoverImagePlugins | $raw %] |
433 |
[% CoverImagePlugins | $raw %] |
503 |
<script> |
434 |
<script> |
504 |
const loggedinusername = [% ( loggedinusername ) ? 1 : 0 | html %]; |
435 |
const loggedinusername = [% ( loggedinusername ) ? 1 : 0 | html %]; |
Lines 530-535
Link Here
|
530 |
} |
461 |
} |
531 |
[% END # /IF OpacHighlightedWords %] |
462 |
[% END # /IF OpacHighlightedWords %] |
532 |
|
463 |
|
|
|
464 |
function verify_cover_images() { |
465 |
// Loop over each container in the template which contains covers |
466 |
$(".cover-slider").each(function( index ){ |
467 |
let biblionumber = $(this).data("biblionumber"); |
468 |
let booktitle = $(this).data("title"); |
469 |
var lightbox_descriptions = []; |
470 |
$(this).find(".cover-image").each( function( index ){ |
471 |
var div = $(this); |
472 |
// Find the image in the container |
473 |
var img = div.find("img")[0]; |
474 |
if( img && $(img).length > 0 ){ |
475 |
// All slides start hidden. If this is the first one, show it. |
476 |
// Check if Amazon image is present |
477 |
if ( div.hasClass("amazon-coverimg") ) { |
478 |
let w = img.width; |
479 |
let h = img.height; |
480 |
if ((w == 1) || (h == 1)) { |
481 |
// Amazon returned single-pixel placeholder |
482 |
// Remove the container |
483 |
div.remove(); |
484 |
} else { |
485 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
486 |
} |
487 |
} else if( div.hasClass("custom-coverimg") ){ |
488 |
|
489 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
490 |
// No image was loaded via the CustomCoverImages system preference |
491 |
// Remove the container |
492 |
div.remove(); |
493 |
} else { |
494 |
lightbox_descriptions.push(_("Custom cover image")); |
495 |
} |
496 |
} else if( div.hasClass("syndetics-coverimg") ){ |
497 |
lightbox_descriptions.push(_("Image from Syndetics")) |
498 |
} else if( div.hasClass("googlejacket-coverimg" ) ){ |
499 |
if( img.naturalHeight ){ |
500 |
lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
501 |
} |
502 |
} else if( div.hasClass("openlibrary-coverimg") ){ |
503 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
504 |
} else if( div.hasClass("coce-coverimg" ) ){ |
505 |
// Identify which service's image is being loaded by Coce |
506 |
var coce_description; |
507 |
let src = $(img).attr("src"); |
508 |
if( src.indexOf('amazon.com') >= 0 ){ |
509 |
coce_description = _("Coce image from Amazon.com"); |
510 |
} else if( src.indexOf('google.com') >= 0 ){ |
511 |
coce_description = _("Coce image from Google Books"); |
512 |
} else if( src.indexOf('openlibrary.org') >= 0 ){ |
513 |
coce_description = _("Coce image from Open Library"); |
514 |
} |
515 |
div.find(".hint").html(coce_description); |
516 |
lightbox_descriptions.push(coce_description); |
517 |
} else if ( div.hasClass("bakertaylor-coverimg" ) ){ |
518 |
lightbox_descriptions.push(_("Image from Baker & Taylor")); |
519 |
} else if ( div.hasClass("cover-image local-coverimg" ) ){ |
520 |
lightbox_descriptions.push(_("Local cover image")); |
521 |
} else { |
522 |
lightbox_descriptions.push(_("Cover image source unknown")); |
523 |
} |
524 |
} else { |
525 |
div.remove(); |
526 |
} |
527 |
}); |
528 |
|
529 |
// Lightbox for cover images |
530 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
531 |
description: function(){ |
532 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
533 |
} |
534 |
}); |
535 |
|
536 |
}); |
537 |
|
538 |
$(".cover-slider").each(function(){ |
539 |
var coverSlide = this; |
540 |
var coverImages = $(this).find(".cover-image"); |
541 |
if( coverImages.length > 1 ){ |
542 |
coverImages.each(function( index ){ |
543 |
// If more that one image is present, add a navigation link |
544 |
// for activating the slide |
545 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
546 |
if( index == 0 ){ |
547 |
// Set the first navigation link as active |
548 |
$(covernav).addClass("nav-active"); |
549 |
} |
550 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
551 |
$(coverSlide).append( covernav ); |
552 |
}); |
553 |
} |
554 |
|
555 |
$(coverSlide).find(".cover-image").eq(0).show(); |
556 |
|
557 |
// if( $(coverSlide).find(".cover-image").length < 1 ){ |
558 |
// $(coverSlide).remove(); |
559 |
// } else { |
560 |
// This is a suboptimal workaround; we should do this via load, but |
561 |
// the image code is scattered all over now. We come here now after |
562 |
// window load and wait_for_images (so load completed). |
563 |
var check_complete = 1; |
564 |
$(coverSlide).find("img").each( function() { |
565 |
if( !this.complete || this.naturalHeight == 0 ) check_complete = 0; |
566 |
}); |
567 |
if( check_complete ) $(coverSlide).removeClass('cover-slides'); |
568 |
// } |
569 |
}); |
570 |
|
571 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
572 |
e.preventDefault(); |
573 |
var cover_slider = $(this).parent(); |
574 |
// Adding click handler for cover image navigation links |
575 |
var num = $(this).data("num"); |
576 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
577 |
$(this).addClass("nav-active"); |
578 |
$(cover_slider).find(".cover-image").hide(); |
579 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
580 |
}); |
581 |
|
582 |
$("#editions img").each(function(i){ |
583 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
584 |
let w = this.width; |
585 |
let h = this.height; |
586 |
if ((w == 1) || (h == 1)) { |
587 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
588 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
589 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
590 |
} |
591 |
} |
592 |
}); |
593 |
} /* /verify_images */ |
594 |
|
595 |
|
596 |
let counter_wait = 0; |
597 |
function wait_for_images(cb){ |
598 |
|
599 |
var loaded = 1; |
600 |
counter_wait++; |
601 |
|
602 |
[% IF GoogleJackets %] |
603 |
if ( loaded ) { |
604 |
loaded = KOHA.Google.done; |
605 |
} |
606 |
[% END %] |
607 |
|
608 |
[% IF OpenLibraryCovers %] |
609 |
if ( loaded ) { |
610 |
loaded = KOHA.OpenLibrary.done; |
611 |
} |
612 |
[% END %] |
613 |
|
614 |
[% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] |
615 |
if ( loaded ) { |
616 |
loaded = KOHA.coce.done; |
617 |
} |
618 |
[% END %] |
619 |
|
620 |
if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds |
621 |
window.setTimeout(function(){wait_for_images(cb);}, 100); |
622 |
} else { |
623 |
if (counter_wait >= 50 ) { |
624 |
} |
625 |
cb(); |
626 |
} |
627 |
} |
628 |
|
629 |
$(window).load(function() { |
630 |
wait_for_images(verify_cover_images); |
631 |
}); |
632 |
|
533 |
$(document).ready(function(){ |
633 |
$(document).ready(function(){ |
534 |
|
634 |
|
535 |
$(".moretoggle").click(function(e){ |
635 |
$(".moretoggle").click(function(e){ |
536 |
- |
|
|