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 156-165 tr { Link Here
156
}
156
}
157
157
158
td {
158
td {
159
    img {
160
        max-width: none;
161
    }
162
163
    &.bookcover {
159
    &.bookcover {
164
        background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
160
        background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
165
        min-width: 120px;
161
        min-width: 120px;
Lines 737-753 th { Link Here
737
    }
733
    }
738
}
734
}
739
735
740
#biblio-cover-slider {
741
    background-color: #FFF;
742
    border: 1px solid #B9D8D9;
743
    border-radius: 3px;
744
    margin: 0 1em .5em 0;
745
    min-height: 175px;
746
    padding: 10px 5px 5px 5px;
747
}
748
749
.cover-slider {
736
.cover-slider {
750
    background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
737
    background: #FFF url( "../images/spinner-small.gif" ) center center no-repeat;
738
    margin: 0 1em .5em 0;
739
    min-height: 175px;
740
    min-width: 100px;
741
    padding: 10px 15px 5px 5px;
751
742
752
    .hint {
743
    .hint {
753
        font-size: 80%;
744
        font-size: 80%;
Lines 764-775 th { Link Here
764
    }
755
    }
765
}
756
}
766
757
758
.covercol {
759
    .cover-slider {
760
        background: transparent none;
761
        margin: 0;
762
        padding: 5px;
763
    }
764
}
765
767
.cover-image {
766
.cover-image {
768
    display: none;
767
    display: none;
769
768
770
    img {
769
    img {
771
        height: auto;
770
        margin: .2rem;
772
        max-width: 100%;
771
        max-width: 100%;
772
        width: auto;
773
    }
773
    }
774
}
774
}
775
775
Lines 2906-2911 $star-selected: #EDB867; Link Here
2906
    .chocolat-bottom {
2906
    .chocolat-bottom {
2907
        background: rgba( 0, 0, 0, .7 );
2907
        background: rgba( 0, 0, 0, .7 );
2908
    }
2908
    }
2909
2910
    .chocolat-description {
2911
        a:link,
2912
        a:visited,
2913
        a:hover,
2914
        a:active {
2915
            color: desaturate( lighten( $base-theme-color, 40 ), 30 )
2916
        }
2917
    }
2909
}
2918
}
2910
2919
2911
#patronconsents h2 {
2920
#patronconsents h2 {
(-)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 (-91 / +190 lines)
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 %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;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 %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;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&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>
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 &amp; 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 &amp; 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 &amp; 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
- 

Return to bug 26933