View | Details | Raw Unified | Return to bug 26933
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/_responsive.scss (-4 / +6 lines)
Lines 301-306 Link Here
301
        border: 0;
301
        border: 0;
302
        box-shadow: none;
302
        box-shadow: none;
303
    }
303
    }
304
305
    .cover-image {
306
        img {
307
            margin: .7rem;
308
        }
309
    }
304
}
310
}
305
311
306
@media only screen and ( min-width: 608px ) and ( max-width: 767px ) {
312
@media only screen and ( min-width: 608px ) and ( max-width: 767px ) {
Lines 310-319 Link Here
310
        margin: 10px 0;
316
        margin: 10px 0;
311
    }
317
    }
312
318
313
    .row-fluid input.span6 {
314
        width: 48.9362%;
315
    }
316
317
    #wrapper {
319
    #wrapper {
318
        padding: 0 15px;
320
        padding: 0 15px;
319
    }
321
    }
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (-14 / +23 lines)
Lines 180-189 tr { Link Here
180
}
180
}
181
181
182
td {
182
td {
183
    img {
184
        max-width: none;
185
    }
186
187
    &.bookcover {
183
    &.bookcover {
188
        background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
184
        background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
189
        min-width: 120px;
185
        min-width: 120px;
Lines 767-783 th { Link Here
767
    }
763
    }
768
}
764
}
769
765
770
#biblio-cover-slider {
771
    background-color: #FFF;
772
    border: 1px solid #B9D8D9;
773
    border-radius: 3px;
774
    margin: 0 1em .5em 0;
775
    min-height: 175px;
776
    padding: 10px 5px 5px 5px;
777
}
778
779
.cover-slider {
766
.cover-slider {
780
    background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
767
    background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
768
    margin: 0 1em .5em 0;
769
    min-height: 175px;
770
    min-width: 100px;
771
    padding: 10px 15px 5px 5px;
781
772
782
    .hint {
773
    .hint {
783
        font-size: 80%;
774
        font-size: 80%;
Lines 794-805 th { Link Here
794
    }
785
    }
795
}
786
}
796
787
788
.covercol {
789
    .cover-slider {
790
        background: transparent none;
791
        margin: 0;
792
        padding: 5px;
793
    }
794
}
795
797
.cover-image {
796
.cover-image {
798
    display: none;
797
    display: none;
799
798
800
    img {
799
    img {
801
        height: auto;
800
        margin: .2rem;
802
        max-width: 100%;
801
        max-width: 100%;
802
        width: auto;
803
    }
803
    }
804
}
804
}
805
805
Lines 3002-3007 $star-selected: #EDB867; Link Here
3002
    .chocolat-bottom {
3002
    .chocolat-bottom {
3003
        background: rgba( 0, 0, 0, .7 );
3003
        background: rgba( 0, 0, 0, .7 );
3004
    }
3004
    }
3005
3006
    .chocolat-description {
3007
        a:link,
3008
        a:visited,
3009
        a:hover,
3010
        a:active {
3011
            color: desaturate( lighten( $base-theme-color, 40 ), 30 )
3012
        }
3013
    }
3005
}
3014
}
3006
3015
3007
@import "responsive";
3016
@import "responsive";
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/cover-images.inc (+86 lines)
Line 0 Link Here
1
[% USE raw %]
2
<div class="bookcover">
3
    <div class="cover-slider cover-slides itemtype_[% SEARCH_RESULT.itemtype | html %]" data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]" data-title="[% SEARCH_RESULT.title | html %]" data-isbn="[% SEARCH_RESULT.normalized_isbn | html %]" data-isbn="[% To.json(SEARCH_RESULT.normalized_isbn) | $raw %]">
4
        [% IF ( OPACLocalCoverImages && SEARCH_RESULT.has_local_cover_image ) %]
5
            <div class="cover-image local-coverimg">
6
                <a href="/cgi-bin/koha/opac-image.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
7
                    <span class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" data-link="/cgi-bin/koha/opac-image.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]"></span>
8
                </a>
9
                <div class="hint">Local cover image</div>
10
            </div>
11
        [% END %]
12
13
        [% IF ( OPACAmazonCoverImages && SEARCH_RESULT.normalized_isbn) %]
14
            <div class="cover-image amazon-coverimg">
15
                <a href="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | uri %].01.LZZZZZZZ.jpg">
16
                    <img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | uri %].01.MZZZZZZZ.jpg" alt="Amazon cover image" id="amazon-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" data-link="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% SEARCH_RESULT.normalized_isbn | html %][% AmazonAssocTag | html %]#reader-link"/>
17
                </a>
18
                <div class="hint">Image from Amazon.com</div>
19
            </div>
20
        [% END %]
21
22
        [% IF ( SyndeticsCoverImages ) %]
23
            [% IF ( content_identifier_exists ) %]
24
                <div class="cover-image syndetics-coverimg">
25
                    <a href="https://secure.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | uri %]&amp;type=xw10&amp;upc=[% normalized_upc | uri %]&amp;oclc=[% normalized_oclc | uri %]">
26
                        <img src="https://secure.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | uri %]&amp;type=xw10&amp;upc=[% normalized_upc | uri %]&amp;oclc=[% normalized_oclc | uri %]" id="syndetics-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" alt="Syndetics cover image" />
27
                    </a>
28
                    <div class="hint">Image from Syndetics</div>
29
                </div>
30
            [% END %]
31
        [% END %]
32
33
        [% IF ( GoogleJackets ) %]
34
            <div class="cover-image googlejacket-coverimg">
35
                <div class="[% SEARCH_RESULT.normalized_isbn | html %]" id="gbs-thumbnail-preview" data-use-data-link="1"></div>
36
                <div class="hint">Image from Google Jackets</div>
37
            </div>
38
        [% END %]
39
40
        [% IF ( OPACCoce && SEARCH_RESULT.normalized_isbn ) %]
41
            [% coce_id = normalized_ean || SEARCH_RESULT.normalized_isbn %]
42
            <div class="cover-image coce-coverimg">
43
                [% IF ( coce_id ) %]
44
                    <a class="[% coce_id | html %]" id="coce-thumbnail-[% SEARCH_RESULT.biblionumber | html %]"></a>
45
                [% END %]
46
                <div class="hint">Image from Coce</div>
47
            </div>
48
        [% END %]
49
50
        [% IF OpenLibraryCovers %]
51
            <div class="cover-image openlibrary-coverimg">
52
                <div class="[% SEARCH_RESULT.normalized_isbn | html %]" id="openlibrary-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" data-use-data-link="1"></div>
53
                <div class="hint">Image from OpenLibrary</div>
54
            </div>
55
        [% END %]
56
57
        [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
58
        [% IF ( BakerTaylorEnabled && bt_id ) %]
59
            <div class="cover-image bakertaylor-coverimg">
60
                [% IF BakerTaylorBookstoreURL %]
61
                    <a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]">
62
                        <img alt="See Baker &amp; Taylor" id="bakertaylor-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" />
63
                    </a>
64
                [% ELSE %]
65
                    <a href="[% BakerTaylorImageURL | url %][% bt_id | uri%]">
66
                        <img alt="See Baker &amp; Taylor" id="bakertaylor-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" />
67
                    </a>
68
                [% END %]
69
                <div class="hint">Image from Baker &amp; Taylor</div>
70
            </div>
71
        [% END %]
72
73
        [% IF OPACCustomCoverImages %]
74
            [% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]
75
            [% IF custom_cover_image_url %]
76
                <div class="cover-image custom-coverimg">
77
                    <a class="custom_cover_image" href="[% custom_cover_image_url | url %]">
78
                        <img id="custom-thumbnail-[% SEARCH_RESULT.biblionumber | html %]" alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
79
                    </a>
80
                    <div class="hint">Custom cover image</div>
81
                </div>
82
            [% END %]
83
        [% END %]
84
    </div> <!-- /.cover-slider -->
85
86
</div><!-- / .bookcover -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-89 / +187 lines)
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 %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;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 %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;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&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% SEARCH_RESULT.normalized_upc | html %]&amp;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 &amp; 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 &amp; 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 &amp; 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
- 

Return to bug 26933