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