|
Lines 129-135
Link Here
|
| 129 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" /> |
129 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" /> |
| 130 |
</a> |
130 |
</a> |
| 131 |
[% END %] |
131 |
[% END %] |
| 132 |
<div class="hint">Image from BakerTaylor</div> |
132 |
<div class="hint">Image from Baker & Taylor</div> |
| 133 |
</div> |
133 |
</div> |
| 134 |
[% END %] |
134 |
[% END %] |
| 135 |
|
135 |
|
|
Lines 1388-1393
Link Here
|
| 1388 |
} |
1388 |
} |
| 1389 |
[% END # /IF OpacHighlightedWords %] |
1389 |
[% END # /IF OpacHighlightedWords %] |
| 1390 |
|
1390 |
|
|
|
1391 |
function verify_images() { |
| 1392 |
// Loop over each container in the template which contains covers |
| 1393 |
$(".cover-slider").each(function( index ){ |
| 1394 |
var lightbox_descriptions = []; |
| 1395 |
$(this).find(".cover-image").each( function( index ){ |
| 1396 |
var div = $(this); |
| 1397 |
// Find the image in the container |
| 1398 |
var img = div.find("img")[0]; |
| 1399 |
if( img && $(img).length > 0 ){ |
| 1400 |
var description = ""; |
| 1401 |
if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){ |
| 1402 |
// No image loaded in the container. Remove the slide |
| 1403 |
div.remove(); |
| 1404 |
} else { |
| 1405 |
// All slides start hidden. If this is the first one, show it. |
| 1406 |
if( index == 0 ){ |
| 1407 |
div.show(); |
| 1408 |
} |
| 1409 |
// Check if Amazon image is present |
| 1410 |
if ( div.attr("id") == "amazon-bookcoverimg" ) { |
| 1411 |
w = img.width; |
| 1412 |
h = img.height; |
| 1413 |
if ((w == 1) || (h == 1)) { |
| 1414 |
// Amazon returned single-pixel placeholder |
| 1415 |
// Remove the container |
| 1416 |
div.remove(); |
| 1417 |
} else { |
| 1418 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1419 |
} |
| 1420 |
} else if( div.attr("id") == "custom-coverimg" ){ |
| 1421 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
| 1422 |
// No image was loaded via the CustomCoverImages system preference |
| 1423 |
// Remove the container |
| 1424 |
div.remove(); |
| 1425 |
} else { |
| 1426 |
lightbox_descriptions.push("Custom cover image"); |
| 1427 |
} |
| 1428 |
} else if( div.attr("id") == "syndetics-coverimg" ){ |
| 1429 |
lightbox_descriptions.push("Image from Syndetics") |
| 1430 |
} else if( div.attr("id") == "googlejacket-coverimg" ){ |
| 1431 |
lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1432 |
} else if( div.attr("id") == "openlibrary-coverimg" ){ |
| 1433 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1434 |
} else if( div.attr("id") == "coce-coverimg" ){ |
| 1435 |
// Identify which service's image is being loaded by Coce |
| 1436 |
var coce_description; |
| 1437 |
if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ |
| 1438 |
coce_description = ("Coce image from Amazon.com"); |
| 1439 |
} else if( $(img).attr("src").indexOf('google.com') >= 0 ){ |
| 1440 |
coce_description = _("Coce image from Google Books"); |
| 1441 |
} else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ |
| 1442 |
coce_description = _("Coce image from Open Library"); |
| 1443 |
} |
| 1444 |
div.find(".hint").html(coce_description); |
| 1445 |
lightbox_descriptions.push(coce_description); |
| 1446 |
} else if ( div.attr("id") == "bakertaylor-coverimg" ){ |
| 1447 |
lightbox_descriptions.push(_("Image from Baker & Taylor")); |
| 1448 |
} else if ( div.attr("id") == "adlibris-coverimg" ){ |
| 1449 |
lightbox_descriptions.push(_("Image from Adlibris (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1450 |
} else if ( div.attr("class") == "cover-image local-coverimg" ) { |
| 1451 |
lightbox_descriptions.push(_("Local cover image")); |
| 1452 |
} else { |
| 1453 |
lightbox_descriptions.push(_("Cover image source unknown")); |
| 1454 |
} |
| 1455 |
} |
| 1456 |
} else { |
| 1457 |
div.remove(); |
| 1458 |
} |
| 1459 |
}); |
| 1460 |
|
| 1461 |
// Lightbox for cover images |
| 1462 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
| 1463 |
description: function(){ |
| 1464 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
| 1465 |
} |
| 1466 |
}); |
| 1467 |
|
| 1468 |
}); |
| 1469 |
|
| 1470 |
$(".cover-slider").each(function(){ |
| 1471 |
var coverSlide = this; |
| 1472 |
var coverImages = $(this).find(".cover-image"); |
| 1473 |
if( coverImages.length > 1 ){ |
| 1474 |
coverImages.each(function( index ){ |
| 1475 |
// If more that one image is present, add a navigation link |
| 1476 |
// for activating the slide |
| 1477 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
| 1478 |
if( index == 0 ){ |
| 1479 |
// Set the first navigation link as active |
| 1480 |
$(covernav).addClass("nav-active"); |
| 1481 |
} |
| 1482 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
| 1483 |
$(coverSlide).append( covernav ); |
| 1484 |
}); |
| 1485 |
} |
| 1486 |
|
| 1487 |
if( $(coverSlide).find(".cover-image:visible").length < 1 ){ |
| 1488 |
$(coverSlide).remove(); |
| 1489 |
} else { |
| 1490 |
$(coverSlide).addClass("cover-slides"); |
| 1491 |
} |
| 1492 |
}); |
| 1493 |
|
| 1494 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
| 1495 |
e.preventDefault(); |
| 1496 |
var cover_slider = $(this).parent(); |
| 1497 |
// Adding click handler for cover image navigation links |
| 1498 |
var num = $(this).data("num"); |
| 1499 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
| 1500 |
$(this).addClass("nav-active"); |
| 1501 |
$(cover_slider).find(".cover-image").hide(); |
| 1502 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
| 1503 |
}); |
| 1504 |
|
| 1505 |
$("#editions img").each(function(i){ |
| 1506 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
| 1507 |
w = this.width; |
| 1508 |
h = this.height; |
| 1509 |
if ((w == 1) || (h == 1)) { |
| 1510 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
| 1511 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
| 1512 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
| 1513 |
} |
| 1514 |
} |
| 1515 |
}); |
| 1516 |
} /* /verify_images */ |
| 1517 |
|
| 1518 |
$(window).load(function() { |
| 1519 |
verify_images(); |
| 1520 |
}); |
| 1521 |
|
| 1391 |
$(document).ready(function() { |
1522 |
$(document).ready(function() { |
| 1392 |
|
1523 |
|
| 1393 |
[% IF ( Koha.Preference('OPACDetailQRCode') ) %] |
1524 |
[% IF ( Koha.Preference('OPACDetailQRCode') ) %] |
|
Lines 1529-1662
Link Here
|
| 1529 |
KOHA.OpenLibrary.GetCoverFromIsbn(); |
1660 |
KOHA.OpenLibrary.GetCoverFromIsbn(); |
| 1530 |
[% END %] |
1661 |
[% END %] |
| 1531 |
|
1662 |
|
| 1532 |
function verify_images() { |
|
|
| 1533 |
// Loop over each container in the template which contains covers |
| 1534 |
$(".cover-slider").each(function(){ |
| 1535 |
var lightbox_descriptions = []; |
| 1536 |
$(this).find(".cover-image").each( function( index ){ |
| 1537 |
var div = $(this); |
| 1538 |
// Find the image in the container |
| 1539 |
var img = div.find("img")[0]; |
| 1540 |
if( $(img).length > 0 ){ |
| 1541 |
var description = ""; |
| 1542 |
if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){ |
| 1543 |
// No image loaded in the container. Remove the slide |
| 1544 |
div.remove(); |
| 1545 |
} else { |
| 1546 |
// All slides start hidden. If this is the first one, show it. |
| 1547 |
if( index == 0 ){ |
| 1548 |
div.show(); |
| 1549 |
} |
| 1550 |
// Check if Amazon image is present |
| 1551 |
if ( div.attr("id") == "amazon-bookcoverimg" ) { |
| 1552 |
w = img.width; |
| 1553 |
h = img.height; |
| 1554 |
if ((w == 1) || (h == 1)) { |
| 1555 |
// Amazon returned single-pixel placeholder |
| 1556 |
// Remove the container |
| 1557 |
div.remove(); |
| 1558 |
} else { |
| 1559 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1560 |
} |
| 1561 |
} else if( div.attr("id") == "custom-coverimg" ){ |
| 1562 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
| 1563 |
// No image was loaded via the CustomCoverImages system preference |
| 1564 |
// Remove the container |
| 1565 |
div.remove(); |
| 1566 |
} else { |
| 1567 |
lightbox_descriptions.push("Custom cover image"); |
| 1568 |
} |
| 1569 |
} else if( div.attr("id") == "syndetics-coverimg" ){ |
| 1570 |
lightbox_descriptions.push("Image from Syndetics") |
| 1571 |
} else if( div.attr("id") == "googlejacket-coverimg" ){ |
| 1572 |
lightbox_descriptions.push(_("Image from Google Jacket (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1573 |
} else if( div.attr("id") == "openlibrary-coverimg" ){ |
| 1574 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1575 |
} else if( div.attr("id") == "coce-coverimg" ){ |
| 1576 |
// Identify which service's image is being loaded by Coce |
| 1577 |
var coce_description; |
| 1578 |
if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ |
| 1579 |
coce_description = ("Coce image from Amazon.com"); |
| 1580 |
} else if( $(img).attr("src").indexOf('google.com') >= 0 ){ |
| 1581 |
coce_description = _("Coce image from Google Books"); |
| 1582 |
} else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ |
| 1583 |
coce_description = _("Coce image from Open Library"); |
| 1584 |
} |
| 1585 |
div.find(".hint").html(coce_description); |
| 1586 |
lightbox_descriptions.push(coce_description); |
| 1587 |
} else if ( div.attr("id") == "bakertaylor-coverimg" ){ |
| 1588 |
lightbox_descriptions.push(_("Image from Baker Taylor")); |
| 1589 |
} else if ( div.attr("id") == "adlibris-coverimg" ){ |
| 1590 |
lightbox_descriptions.push(_("Image from Adlibris (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
| 1591 |
} else if ( div.attr("class") == "cover-image local-coverimg" ) { |
| 1592 |
lightbox_descriptions.push(_("Local cover image")); |
| 1593 |
} else { |
| 1594 |
lightbox_descriptins.push(_("Cover image source unknown")); |
| 1595 |
} |
| 1596 |
} |
| 1597 |
} |
| 1598 |
}); |
| 1599 |
|
| 1600 |
// Lightbox for cover images |
| 1601 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
| 1602 |
description: function(){ |
| 1603 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
| 1604 |
} |
| 1605 |
}); |
| 1606 |
|
| 1607 |
}); |
| 1608 |
|
| 1609 |
$(".cover-slider").each(function(){ |
| 1610 |
var coverSlide = this; |
| 1611 |
var coverImages = $(this).find(".cover-image"); |
| 1612 |
if( coverImages.length > 1 ){ |
| 1613 |
coverImages.each(function( index ){ |
| 1614 |
// If more that one image is present, add a navigation link |
| 1615 |
// for activating the slide |
| 1616 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
| 1617 |
if( index == 0 ){ |
| 1618 |
// Set the first navigation link as active |
| 1619 |
$(covernav).addClass("nav-active"); |
| 1620 |
} |
| 1621 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
| 1622 |
$(coverSlide).append( covernav ); |
| 1623 |
}); |
| 1624 |
} |
| 1625 |
|
| 1626 |
if( $(coverSlide).find(".cover-image:visible").length < 1 ){ |
| 1627 |
$(coverSlide).remove(); |
| 1628 |
} else { |
| 1629 |
$(coverSlide).addClass("cover-slides"); |
| 1630 |
} |
| 1631 |
}); |
| 1632 |
|
| 1633 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
| 1634 |
e.preventDefault(); |
| 1635 |
var cover_slider = $(this).parent(); |
| 1636 |
// Adding click handler for cover image navigation links |
| 1637 |
var num = $(this).data("num"); |
| 1638 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
| 1639 |
$(this).addClass("nav-active"); |
| 1640 |
$(cover_slider).find(".cover-image").hide(); |
| 1641 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
| 1642 |
}); |
| 1643 |
|
| 1644 |
$("#editions img").each(function(i){ |
| 1645 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
| 1646 |
w = this.width; |
| 1647 |
h = this.height; |
| 1648 |
if ((w == 1) || (h == 1)) { |
| 1649 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
| 1650 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
| 1651 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
| 1652 |
} |
| 1653 |
} |
| 1654 |
}); |
| 1655 |
} |
| 1656 |
|
| 1657 |
$(window).load(function() { |
| 1658 |
verify_images(); |
| 1659 |
}); |
| 1660 |
[% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %] |
1663 |
[% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %] |
| 1661 |
novSelect.loadContentForQuery( |
1664 |
novSelect.loadContentForQuery( |
| 1662 |
{ |
1665 |
{ |