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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-50 / +46 lines)
Lines 1320-1378 Note that permanent location is a code, and location may be an authval. Link Here
1320
            // Loop over each container in the template which contains covers
1320
            // Loop over each container in the template which contains covers
1321
            $(".cover-slider").each(function(){
1321
            $(".cover-slider").each(function(){
1322
                var lightbox_descriptions = [];
1322
                var lightbox_descriptions = [];
1323
                var first_shown = 0;
1323
                $(this).find(".cover-image").each( function( index ){
1324
                $(this).find(".cover-image").each( function( index ){
1324
                    var div = $(this);
1325
                var div = $(this);
1325
                    // Find the image in the container
1326
                // Find the image in the container
1326
                    var img = div.find("img")[0];
1327
                var img = div.find("img")[0];
1327
                    if( $(img).length > 0 ){
1328
                if( $(img).length > 0 ){
1328
                        var description = "";
1329
                    var description = "";
1329
                        if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
1330
                        // All slides start hidden. If this is the first one, show it.
1330
                            // No image loaded in the container. Remove the slide
1331
                        if( first_shown == 0 ){
1331
                            div.remove();
1332
                            div.show();
1332
                        } else {
1333
                            first_shown = 1;
1333
                            // All slides start hidden. If this is the first one, show it.
1334
                        }
1334
                            if( index == 0 ){
1335
                        // Check if Amazon image is present
1335
                                div.show();
1336
                        if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1336
                            }
1337
                            w = img.width;
1337
                            // Check if Amazon image is present
1338
                            h = img.height;
1338
                            if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1339
                            if ((w == 1) || (h == 1)) {
1339
                                w = img.width;
1340
                                // Amazon returned single-pixel placeholder
1340
                                h = img.height;
1341
                                // Remove the container
1341
                                if ((w == 1) || (h == 1)) {
1342
                                div.remove();
1342
                                    // Amazon returned single-pixel placeholder
1343
                            } else {
1343
                                    // Remove the container
1344
                                lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1344
                                    div.remove();
1345
                                } else {
1346
                                    lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1347
                                }
1348
                            } else if( div.attr("id") == "custom-coverimg" ){
1349
                                if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1350
                                    // No image was loaded via the CustomCoverImages system preference
1351
                                    // Remove the container
1352
                                    div.remove();
1353
                                } else {
1354
                                    lightbox_descriptions.push("Custom cover image");
1355
                                }
1356
                            } else if ( div.attr("id") == "syndetics-bookcoverimg" ){
1357
                                    lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1358
                            }
1345
                            }
1359
                            else if( div.hasClass("coce-coverimg" ) ){
1346
                        } else if( div.attr("id") == "custom-coverimg" ){
1360
                                // Identify which service's image is being loaded by Coce
1347
                            if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1361
                                var coce_description;
1348
                                // No image was loaded via the CustomCoverImages system preference
1362
                                if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1349
                                // Remove the container
1363
                                    coce_description = ("Coce image from Amazon.com");
1350
                                div.remove();
1364
                                } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1365
                                    coce_description = _("Coce image from Google Books");
1366
                                } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1367
                                    coce_description = _("Coce image from Open Library");
1368
                                }
1369
                                div.find(".hint").html(coce_description);
1370
                                lightbox_descriptions.push(coce_description);
1371
                            } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1372
                                lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1373
                            } else {
1351
                            } else {
1374
                                lightbox_descriptions.push(_("Cover image source unknown"));
1352
                                lightbox_descriptions.push("Custom cover image");
1375
                            }
1353
                            }
1354
                        } else if ( div.attr("id") == "syndetics-bookcoverimg" ){
1355
                                lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1356
                        }
1357
                        else if( div.hasClass("coce-coverimg" ) ){
1358
                            // Identify which service's image is being loaded by Coce
1359
                            var coce_description;
1360
                            if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1361
                                coce_description = ("Coce image from Amazon.com");
1362
                            } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1363
                                coce_description = _("Coce image from Google Books");
1364
                            } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1365
                                coce_description = _("Coce image from Open Library");
1366
                            }
1367
                            div.find(".hint").html(coce_description);
1368
                            lightbox_descriptions.push(coce_description);
1369
                        } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1370
                            lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1371
                        } else {
1372
                            lightbox_descriptions.push(_("Cover image source unknown"));
1376
                        }
1373
                        }
1377
                    }
1374
                    }
1378
                });
1375
                });
1379
- 

Return to bug 32307