Lines 140-146
Link Here
|
140 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" /> |
140 |
<img alt="See Baker & Taylor" src="[% BakerTaylorImageURL | url %][% bt_id | uri %]" /> |
141 |
</a> |
141 |
</a> |
142 |
[% END %] |
142 |
[% END %] |
143 |
<div class="hint">Image from BakerTaylor</div> |
143 |
<div class="hint">Image from Baker & Taylor</div> |
144 |
</div> |
144 |
</div> |
145 |
[% END %] |
145 |
[% END %] |
146 |
|
146 |
|
Lines 1548-1553
Link Here
|
1548 |
} |
1548 |
} |
1549 |
[% END # /IF OpacHighlightedWords %] |
1549 |
[% END # /IF OpacHighlightedWords %] |
1550 |
|
1550 |
|
|
|
1551 |
function verify_images() { |
1552 |
// Loop over each container in the template which contains covers |
1553 |
$(".cover-slider").each(function( index ){ |
1554 |
var lightbox_descriptions = []; |
1555 |
$(this).find(".cover-image").each( function( index ){ |
1556 |
var div = $(this); |
1557 |
// Find the image in the container |
1558 |
var img = div.find("img")[0]; |
1559 |
if( img && $(img).length > 0 ){ |
1560 |
var description = ""; |
1561 |
if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){ |
1562 |
// No image loaded in the container. Remove the slide |
1563 |
div.remove(); |
1564 |
} else { |
1565 |
// All slides start hidden. If this is the first one, show it. |
1566 |
if( index == 0 ){ |
1567 |
div.show(); |
1568 |
} |
1569 |
// Check if Amazon image is present |
1570 |
if ( div.attr("id") == "amazon-bookcoverimg" ) { |
1571 |
w = img.width; |
1572 |
h = img.height; |
1573 |
if ((w == 1) || (h == 1)) { |
1574 |
// Amazon returned single-pixel placeholder |
1575 |
// Remove the container |
1576 |
div.remove(); |
1577 |
} else { |
1578 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1579 |
} |
1580 |
} else if( div.attr("id") == "custom-coverimg" ){ |
1581 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
1582 |
// No image was loaded via the CustomCoverImages system preference |
1583 |
// Remove the container |
1584 |
div.remove(); |
1585 |
} else { |
1586 |
lightbox_descriptions.push("Custom cover image"); |
1587 |
} |
1588 |
} else if( div.attr("id") == "syndetics-coverimg" ){ |
1589 |
lightbox_descriptions.push("Image from Syndetics") |
1590 |
} else if( div.attr("id") == "googlejacket-coverimg" ){ |
1591 |
lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1592 |
} else if( div.attr("id") == "openlibrary-coverimg" ){ |
1593 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1594 |
} else if( div.attr("id") == "coce-coverimg" ){ |
1595 |
// Identify which service's image is being loaded by Coce |
1596 |
var coce_description; |
1597 |
if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ |
1598 |
coce_description = ("Coce image from Amazon.com"); |
1599 |
} else if( $(img).attr("src").indexOf('google.com') >= 0 ){ |
1600 |
coce_description = _("Coce image from Google Books"); |
1601 |
} else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ |
1602 |
coce_description = _("Coce image from Open Library"); |
1603 |
} |
1604 |
div.find(".hint").html(coce_description); |
1605 |
lightbox_descriptions.push(coce_description); |
1606 |
} else if ( div.attr("id") == "bakertaylor-coverimg" ){ |
1607 |
lightbox_descriptions.push(_("Image from Baker & Taylor")); |
1608 |
} else if ( div.attr("id") == "adlibris-coverimg" ){ |
1609 |
lightbox_descriptions.push(_("Image from Adlibris (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1610 |
} else if ( div.attr("class") == "cover-image local-coverimg" ) { |
1611 |
lightbox_descriptions.push(_("Local cover image")); |
1612 |
} else { |
1613 |
lightbox_descriptions.push(_("Cover image source unknown")); |
1614 |
} |
1615 |
} |
1616 |
} else { |
1617 |
div.remove(); |
1618 |
} |
1619 |
}); |
1620 |
|
1621 |
// Lightbox for cover images |
1622 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
1623 |
description: function(){ |
1624 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
1625 |
} |
1626 |
}); |
1627 |
|
1628 |
}); |
1629 |
|
1630 |
$(".cover-slider").each(function(){ |
1631 |
var coverSlide = this; |
1632 |
var coverImages = $(this).find(".cover-image"); |
1633 |
if( coverImages.length > 1 ){ |
1634 |
coverImages.each(function( index ){ |
1635 |
// If more that one image is present, add a navigation link |
1636 |
// for activating the slide |
1637 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
1638 |
if( index == 0 ){ |
1639 |
// Set the first navigation link as active |
1640 |
$(covernav).addClass("nav-active"); |
1641 |
} |
1642 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
1643 |
$(coverSlide).append( covernav ); |
1644 |
}); |
1645 |
} |
1646 |
|
1647 |
if( $(coverSlide).find(".cover-image:visible").length < 1 ){ |
1648 |
$(coverSlide).remove(); |
1649 |
} else { |
1650 |
$(coverSlide).addClass("cover-slides"); |
1651 |
} |
1652 |
}); |
1653 |
|
1654 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
1655 |
e.preventDefault(); |
1656 |
var cover_slider = $(this).parent(); |
1657 |
// Adding click handler for cover image navigation links |
1658 |
var num = $(this).data("num"); |
1659 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
1660 |
$(this).addClass("nav-active"); |
1661 |
$(cover_slider).find(".cover-image").hide(); |
1662 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
1663 |
}); |
1664 |
|
1665 |
$("#editions img").each(function(i){ |
1666 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
1667 |
w = this.width; |
1668 |
h = this.height; |
1669 |
if ((w == 1) || (h == 1)) { |
1670 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
1671 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
1672 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
1673 |
} |
1674 |
} |
1675 |
}); |
1676 |
} /* /verify_images */ |
1677 |
|
1678 |
$(window).load(function() { |
1679 |
verify_images(); |
1680 |
}); |
1681 |
|
1551 |
$(document).ready(function() { |
1682 |
$(document).ready(function() { |
1552 |
|
1683 |
|
1553 |
[% IF ( Koha.Preference('OPACDetailQRCode') ) %] |
1684 |
[% IF ( Koha.Preference('OPACDetailQRCode') ) %] |
Lines 1689-1822
Link Here
|
1689 |
KOHA.OpenLibrary.GetCoverFromIsbn(); |
1820 |
KOHA.OpenLibrary.GetCoverFromIsbn(); |
1690 |
[% END %] |
1821 |
[% END %] |
1691 |
|
1822 |
|
1692 |
function verify_images() { |
|
|
1693 |
// Loop over each container in the template which contains covers |
1694 |
$(".cover-slider").each(function(){ |
1695 |
var lightbox_descriptions = []; |
1696 |
$(this).find(".cover-image").each( function( index ){ |
1697 |
var div = $(this); |
1698 |
// Find the image in the container |
1699 |
var img = div.find("img")[0]; |
1700 |
if( $(img).length > 0 ){ |
1701 |
var description = ""; |
1702 |
if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){ |
1703 |
// No image loaded in the container. Remove the slide |
1704 |
div.remove(); |
1705 |
} else { |
1706 |
// All slides start hidden. If this is the first one, show it. |
1707 |
if( index == 0 ){ |
1708 |
div.show(); |
1709 |
} |
1710 |
// Check if Amazon image is present |
1711 |
if ( div.attr("id") == "amazon-bookcoverimg" ) { |
1712 |
w = img.width; |
1713 |
h = img.height; |
1714 |
if ((w == 1) || (h == 1)) { |
1715 |
// Amazon returned single-pixel placeholder |
1716 |
// Remove the container |
1717 |
div.remove(); |
1718 |
} else { |
1719 |
lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1720 |
} |
1721 |
} else if( div.attr("id") == "custom-coverimg" ){ |
1722 |
if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { |
1723 |
// No image was loaded via the CustomCoverImages system preference |
1724 |
// Remove the container |
1725 |
div.remove(); |
1726 |
} else { |
1727 |
lightbox_descriptions.push("Custom cover image"); |
1728 |
} |
1729 |
} else if( div.attr("id") == "syndetics-coverimg" ){ |
1730 |
lightbox_descriptions.push("Image from Syndetics") |
1731 |
} else if( div.attr("id") == "googlejacket-coverimg" ){ |
1732 |
lightbox_descriptions.push(_("Image from Google Jacket (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1733 |
} else if( div.attr("id") == "openlibrary-coverimg" ){ |
1734 |
lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1735 |
} else if( div.attr("id") == "coce-coverimg" ){ |
1736 |
// Identify which service's image is being loaded by Coce |
1737 |
var coce_description; |
1738 |
if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ |
1739 |
coce_description = ("Coce image from Amazon.com"); |
1740 |
} else if( $(img).attr("src").indexOf('google.com') >= 0 ){ |
1741 |
coce_description = _("Coce image from Google Books"); |
1742 |
} else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ |
1743 |
coce_description = _("Coce image from Open Library"); |
1744 |
} |
1745 |
div.find(".hint").html(coce_description); |
1746 |
lightbox_descriptions.push(coce_description); |
1747 |
} else if ( div.attr("id") == "bakertaylor-coverimg" ){ |
1748 |
lightbox_descriptions.push(_("Image from Baker Taylor")); |
1749 |
} else if ( div.attr("id") == "adlibris-coverimg" ){ |
1750 |
lightbox_descriptions.push(_("Image from Adlibris (<a href='%s'>see the original image</a>)").format($(img).data('link'))); |
1751 |
} else if ( div.attr("class") == "cover-image local-coverimg" ) { |
1752 |
lightbox_descriptions.push(_("Local cover image")); |
1753 |
} else { |
1754 |
lightbox_descriptins.push(_("Cover image source unknown")); |
1755 |
} |
1756 |
} |
1757 |
} |
1758 |
}); |
1759 |
|
1760 |
// Lightbox for cover images |
1761 |
Chocolat(this.querySelectorAll('.cover-image a'), { |
1762 |
description: function(){ |
1763 |
return lightbox_descriptions[this.settings.currentImageIndex]; |
1764 |
} |
1765 |
}); |
1766 |
|
1767 |
}); |
1768 |
|
1769 |
$(".cover-slider").each(function(){ |
1770 |
var coverSlide = this; |
1771 |
var coverImages = $(this).find(".cover-image"); |
1772 |
if( coverImages.length > 1 ){ |
1773 |
coverImages.each(function( index ){ |
1774 |
// If more that one image is present, add a navigation link |
1775 |
// for activating the slide |
1776 |
var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>"); |
1777 |
if( index == 0 ){ |
1778 |
// Set the first navigation link as active |
1779 |
$(covernav).addClass("nav-active"); |
1780 |
} |
1781 |
$(covernav).html("<i class=\"fa fa-circle\"></i>"); |
1782 |
$(coverSlide).append( covernav ); |
1783 |
}); |
1784 |
} |
1785 |
|
1786 |
if( $(coverSlide).find(".cover-image:visible").length < 1 ){ |
1787 |
$(coverSlide).remove(); |
1788 |
} else { |
1789 |
$(coverSlide).addClass("cover-slides"); |
1790 |
} |
1791 |
}); |
1792 |
|
1793 |
$(".cover-slider").on("click",".cover-nav", function(e){ |
1794 |
e.preventDefault(); |
1795 |
var cover_slider = $(this).parent(); |
1796 |
// Adding click handler for cover image navigation links |
1797 |
var num = $(this).data("num"); |
1798 |
$(cover_slider).find(".cover-nav").removeClass("nav-active"); |
1799 |
$(this).addClass("nav-active"); |
1800 |
$(cover_slider).find(".cover-image").hide(); |
1801 |
$(cover_slider).find(".cover-image").eq( num ).show(); |
1802 |
}); |
1803 |
|
1804 |
$("#editions img").each(function(i){ |
1805 |
if ( this.src.indexOf('amazon.com') >= 0 ) { |
1806 |
w = this.width; |
1807 |
h = this.height; |
1808 |
if ((w == 1) || (h == 1)) { |
1809 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
1810 |
} else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) { |
1811 |
this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; |
1812 |
} |
1813 |
} |
1814 |
}); |
1815 |
} |
1816 |
|
1817 |
$(window).load(function() { |
1818 |
verify_images(); |
1819 |
}); |
1820 |
[% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %] |
1823 |
[% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %] |
1821 |
novSelect.loadContentForQuery( |
1824 |
novSelect.loadContentForQuery( |
1822 |
{ |
1825 |
{ |