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