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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-243 / +263 lines)
Lines 1700-1713 Link Here
1700
    [% END %]
1700
    [% END %]
1701
    <script>
1701
    <script>
1702
        window.emojiPicker = new EmojiPicker({
1702
        window.emojiPicker = new EmojiPicker({
1703
        emojiable_selector: '[data-emojiable=true]',
1703
            emojiable_selector: "[data-emojiable=true]",
1704
        assetsPath: `${interface}/lib/emoji-picker/img/`,
1704
            assetsPath: `${interface}/lib/emoji-picker/img/`,
1705
        popupButtonClasses: 'fa-solid fa-face-smile'
1705
            popupButtonClasses: "fa-solid fa-face-smile",
1706
        });
1706
        });
1707
        window.emojiPicker.discover();
1707
        window.emojiPicker.discover();
1708
1708
1709
        if (prefs.OpacHighlightedWords){
1709
        if (prefs.OpacHighlightedWords) {
1710
            var q_array = new Array();  // holds search terms if available
1710
            var q_array = new Array(); // holds search terms if available
1711
1711
1712
            function highlightOff() {
1712
            function highlightOff() {
1713
                $("#catalogue_detail_biblio").removeHighlight();
1713
                $("#catalogue_detail_biblio").removeHighlight();
Lines 1716-1726 Link Here
1716
            function highlightOn() {
1716
            function highlightOn() {
1717
                var x;
1717
                var x;
1718
                for (x in q_array) {
1718
                for (x in q_array) {
1719
                    if ( q_array[x].length > 0 ) {
1719
                    if (q_array[x].length > 0) {
1720
                        q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
1720
                        q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
1721
                        q_array[x] = q_array[x].toLowerCase();
1721
                        q_array[x] = q_array[x].toLowerCase();
1722
                        var myStopwords = prefs.NotHighlightedWords.toLowerCase().split('|');
1722
                        var myStopwords = prefs.NotHighlightedWords.toLowerCase().split("|");
1723
                        if( $.inArray(q_array[x], myStopwords) == -1 ) {
1723
                        if ($.inArray(q_array[x], myStopwords) == -1) {
1724
                            $("#marcnotes").highlight(q_array[x]);
1724
                            $("#marcnotes").highlight(q_array[x]);
1725
                            $(".title").highlight(q_array[x]);
1725
                            $(".title").highlight(q_array[x]);
1726
                            $(".author").highlight(q_array[x]);
1726
                            $(".author").highlight(q_array[x]);
Lines 1734-1848 Link Here
1734
1734
1735
        function verify_cover_images() {
1735
        function verify_cover_images() {
1736
            // Loop over each container in the template which contains covers
1736
            // Loop over each container in the template which contains covers
1737
            $(".cover-slider").each(function( index ){
1737
            $(".cover-slider").each(function (index) {
1738
                var lightbox_descriptions = [];
1738
                var lightbox_descriptions = [];
1739
                var first_shown = 0;
1739
                var first_shown = 0;
1740
                $(this).find(".cover-image").each( function( index ){
1740
                $(this)
1741
                    var div = $(this);
1741
                    .find(".cover-image")
1742
                    // Find the image in the container
1742
                    .each(function (index) {
1743
                    var img = div.find("img")[0];
1743
                        var div = $(this);
1744
                    if( img && $(img).length > 0 ){
1744
                        // Find the image in the container
1745
                        var description = "";
1745
                        var img = div.find("img")[0];
1746
                        if( img.naturalHeight == 0 && div.attr("id") != "googlejacket-coverimg" && div.hasClass('coce-coverimg') ){
1746
                        if (img && $(img).length > 0) {
1747
                            // No image loaded in the container. Remove the slide
1747
                            var description = "";
1748
                            div.remove();
1748
                            if (img.naturalHeight == 0 && div.attr("id") != "googlejacket-coverimg" && div.hasClass("coce-coverimg")) {
1749
                        } else {
1749
                                // No image loaded in the container. Remove the slide
1750
                            // All slides start hidden. If this is the first one, show it.
1750
                                div.remove();
1751
                            if( first_shown == 0 ){
1751
                            } else {
1752
                                div.show();
1752
                                // All slides start hidden. If this is the first one, show it.
1753
                                first_shown = 1;
1753
                                if (first_shown == 0) {
1754
                            }
1754
                                    div.show();
1755
                            // Check if Amazon image is present
1755
                                    first_shown = 1;
1756
                            if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1757
                                w = img.width;
1758
                                h = img.height;
1759
                                if ((w == 1) || (h == 1)) {
1760
                                    // Amazon returned single-pixel placeholder
1761
                                    // Remove the container
1762
                                    div.remove();
1763
                                } else {
1764
                                    lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1765
                                }
1756
                                }
1766
                            } else if( div.attr("id") == "custom-coverimg" ){
1757
                                // Check if Amazon image is present
1767
                                if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1758
                                if (div.attr("id") == "amazon-bookcoverimg") {
1768
                                    // No image was loaded via the CustomCoverImages system preference
1759
                                    w = img.width;
1769
                                    // Remove the container
1760
                                    h = img.height;
1770
                                    div.remove();
1761
                                    if (w == 1 || h == 1) {
1762
                                        // Amazon returned single-pixel placeholder
1763
                                        // Remove the container
1764
                                        div.remove();
1765
                                    } else {
1766
                                        lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data("link")));
1767
                                    }
1768
                                } else if (div.attr("id") == "custom-coverimg") {
1769
                                    if ((img.complete != null && !img.complete) || img.naturalHeight == 0) {
1770
                                        // No image was loaded via the CustomCoverImages system preference
1771
                                        // Remove the container
1772
                                        div.remove();
1773
                                    } else {
1774
                                        lightbox_descriptions.push(_("Custom cover image"));
1775
                                    }
1776
                                } else if (div.attr("id") == "syndetics-coverimg") {
1777
                                    lightbox_descriptions.push(_("Image from Syndetics"));
1778
                                } else if (div.attr("id") == "googlejacket-coverimg") {
1779
                                    lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data("link")));
1780
                                } else if (div.attr("id") == "openlibrary-coverimg") {
1781
                                    lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data("link")));
1782
                                } else if (div.hasClass("coce-coverimg")) {
1783
                                    // Identify which service's image is being loaded by Coce
1784
                                    var coce_description;
1785
                                    if ($(img).attr("src").indexOf("amazon.com") >= 0) {
1786
                                        coce_description = _("Coce image from Amazon.com");
1787
                                    } else if ($(img).attr("src").indexOf("google.com") >= 0) {
1788
                                        coce_description = _("Coce image from Google Books");
1789
                                    } else if ($(img).attr("src").indexOf("openlibrary.org") >= 0) {
1790
                                        coce_description = _("Coce image from Open Library");
1791
                                    }
1792
                                    div.find(".hint").html(coce_description);
1793
                                    lightbox_descriptions.push(coce_description);
1794
                                } else if (div.attr("id") == "bakertaylor-coverimg") {
1795
                                    lightbox_descriptions.push(_("Image from Baker &amp; Taylor"));
1796
                                } else if (div.attr("class") == "cover-image local-coverimg") {
1797
                                    lightbox_descriptions.push(_("Local cover image"));
1771
                                } else {
1798
                                } else {
1772
                                    lightbox_descriptions.push(_("Custom cover image"));
1799
                                    lightbox_descriptions.push(_("Cover image source unknown"));
1773
                                }
1774
                            } else if( div.attr("id") == "syndetics-coverimg" ){
1775
                                lightbox_descriptions.push(_("Image from Syndetics"))
1776
                            } else if( div.attr("id") == "googlejacket-coverimg" ){
1777
                                lightbox_descriptions.push(_("Image from Google Books (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1778
                            } else if( div.attr("id") == "openlibrary-coverimg" ){
1779
                                lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1780
                            } else if( div.hasClass("coce-coverimg" ) ){
1781
                                // Identify which service's image is being loaded by Coce
1782
                                var coce_description;
1783
                                if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1784
                                    coce_description = _("Coce image from Amazon.com");
1785
                                } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1786
                                    coce_description = _("Coce image from Google Books");
1787
                                } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1788
                                    coce_description = _("Coce image from Open Library");
1789
                                }
1800
                                }
1790
                                div.find(".hint").html(coce_description);
1791
                                lightbox_descriptions.push(coce_description);
1792
                            } else if ( div.attr("id") == "bakertaylor-coverimg" ){
1793
                                lightbox_descriptions.push(_("Image from Baker &amp; Taylor"));
1794
                            } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1795
                                lightbox_descriptions.push(_("Local cover image"));
1796
                            } else {
1797
                                lightbox_descriptions.push(_("Cover image source unknown"));
1798
                            }
1801
                            }
1802
                        } else {
1803
                            div.remove();
1799
                        }
1804
                        }
1800
                    } else {
1805
                    });
1801
                        div.remove();
1802
                    }
1803
                });
1804
1806
1805
                // Lightbox for cover images
1807
                // Lightbox for cover images
1806
                Chocolat(this.querySelectorAll('.cover-image a'), {
1808
                Chocolat(this.querySelectorAll(".cover-image a"), {
1807
                    description: function(){
1809
                    description: function () {
1808
                        return lightbox_descriptions[this.settings.currentImageIndex];
1810
                        return lightbox_descriptions[this.settings.currentImageIndex];
1809
                    }
1811
                    },
1810
                });
1812
                });
1811
1812
            });
1813
            });
1813
1814
1814
            $(".cover-slider").each(function(){
1815
            $(".cover-slider").each(function () {
1815
                var coverSlide = this;
1816
                var coverSlide = this;
1816
                var coverImages = $(this).find(".cover-image");
1817
                var coverImages = $(this).find(".cover-image");
1817
                if( coverImages.length > 1 ){
1818
                if (coverImages.length > 1) {
1818
                    coverImages.each(function( index ){
1819
                    coverImages.each(function (index) {
1819
                        // If more that one image is present, add a navigation link
1820
                        // If more that one image is present, add a navigation link
1820
                        // for activating the slide
1821
                        // for activating the slide
1821
                        var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>");
1822
                        var covernav = $('<a href="#" data-num="' + index + '" class="cover-nav"></a>');
1822
                        if( index == 0 ){
1823
                        if (index == 0) {
1823
                            // Set the first navigation link as active
1824
                            // Set the first navigation link as active
1824
                            $(covernav).addClass("nav-active");
1825
                            $(covernav).addClass("nav-active");
1825
                        }
1826
                        }
1826
                        $(covernav).html("<i class=\"fa fa-circle\"></i>");
1827
                        $(covernav).html('<i class="fa fa-circle"></i>');
1827
                        $(coverSlide).append( covernav );
1828
                        $(coverSlide).append(covernav);
1828
                    });
1829
                    });
1829
                }
1830
                }
1830
1831
1831
                if( $(coverSlide).find(".cover-image:visible").length < 1 ){
1832
                if ($(coverSlide).find(".cover-image:visible").length < 1) {
1832
                    $(coverSlide).remove();
1833
                    $(coverSlide).remove();
1833
                } else {
1834
                } else {
1834
                    // This is a suboptimal workaround; we should do this via load, but
1835
                    // This is a suboptimal workaround; we should do this via load, but
1835
                    // the image code is scattered all over now. We come here now after
1836
                    // the image code is scattered all over now. We come here now after
1836
                    // window load and wait_for_images (so load completed).
1837
                    // window load and wait_for_images (so load completed).
1837
                    var check_complete = 1;
1838
                    var check_complete = 1;
1838
                    $(coverSlide).find("img").each( function() {
1839
                    $(coverSlide)
1839
                        if( !this.complete || this.naturalHeight == 0 ) check_complete = 0;
1840
                        .find("img")
1840
                    });
1841
                        .each(function () {
1841
                    if( check_complete ) $(coverSlide).removeClass('cover-slides');
1842
                            if (!this.complete || this.naturalHeight == 0) check_complete = 0;
1843
                        });
1844
                    if (check_complete) $(coverSlide).removeClass("cover-slides");
1842
                }
1845
                }
1843
            });
1846
            });
1844
1847
1845
            $(".cover-slider").on("click",".cover-nav", function(e){
1848
            $(".cover-slider").on("click", ".cover-nav", function (e) {
1846
                e.preventDefault();
1849
                e.preventDefault();
1847
                var cover_slider = $(this).parent();
1850
                var cover_slider = $(this).parent();
1848
                // Adding click handler for cover image navigation links
1851
                // Adding click handler for cover image navigation links
Lines 1850-1913 Link Here
1850
                $(cover_slider).find(".cover-nav").removeClass("nav-active");
1853
                $(cover_slider).find(".cover-nav").removeClass("nav-active");
1851
                $(this).addClass("nav-active");
1854
                $(this).addClass("nav-active");
1852
                $(cover_slider).find(".cover-image").hide();
1855
                $(cover_slider).find(".cover-image").hide();
1853
                $(cover_slider).find(".cover-image").eq( num ).show();
1856
                $(cover_slider).find(".cover-image").eq(num).show();
1854
            });
1857
            });
1855
1858
1856
            $("#editions img").each(function(i){
1859
            $("#editions img").each(function (i) {
1857
                if ( this.src.indexOf('amazon.com') >= 0 ) {
1860
                if (this.src.indexOf("amazon.com") >= 0) {
1858
                    w = this.width;
1861
                    w = this.width;
1859
                    h = this.height;
1862
                    h = this.height;
1860
                    if ((w == 1) || (h == 1)) {
1863
                    if (w == 1 || h == 1) {
1861
                        this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1864
                        this.src = "https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif";
1862
                    } else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) {
1865
                    } else if ((this.complete != null && !this.complete) || this.naturalHeight == 0) {
1863
                        this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1866
                        this.src = "https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif";
1864
                    }
1867
                    }
1865
                }
1868
                }
1866
            });
1869
            });
1867
        } /* /verify_images */
1870
        } /* /verify_images */
1868
1871
1869
        let counter_wait = 0;
1872
        let counter_wait = 0;
1870
        function wait_for_images(cb){
1873
        function wait_for_images(cb) {
1871
1872
            var loaded = 1;
1874
            var loaded = 1;
1873
            counter_wait++;
1875
            counter_wait++;
1874
1876
1875
            if (prefs.GoogleJackets){
1877
            if (prefs.GoogleJackets) {
1876
                if ( loaded ) {
1878
                if (loaded) {
1877
                    loaded = KOHA.Google.done;
1879
                    loaded = KOHA.Google.done;
1878
                }
1880
                }
1879
            }
1881
            }
1880
1882
1881
            if (prefs.OpenLibraryCovers){
1883
            if (prefs.OpenLibraryCovers) {
1882
                if ( loaded ) {
1884
                if (loaded) {
1883
                    loaded = KOHA.OpenLibrary.done;
1885
                    loaded = KOHA.OpenLibrary.done;
1884
                }
1886
                }
1885
            }
1887
            }
1886
1888
1887
            if (prefs.OpacCoce && prefs.CoceProviders){
1889
            if (prefs.OpacCoce && prefs.CoceProviders) {
1888
                if ( loaded ) {
1890
                if (loaded) {
1889
                    loaded = KOHA.coce.done;
1891
                    loaded = KOHA.coce.done;
1890
                }
1892
                }
1891
            }
1893
            }
1892
1894
1893
            if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds
1895
            if (!loaded && counter_wait < 50) {
1894
                window.setTimeout(function(){wait_for_images(cb);}, 100);
1896
                // Do not wait more than 5 seconds
1897
                window.setTimeout(function () {
1898
                    wait_for_images(cb);
1899
                }, 100);
1895
            } else {
1900
            } else {
1896
                if (counter_wait >= 50 ) {
1901
                if (counter_wait >= 50) {
1897
                    console.log("Could not retrieve the images")
1902
                    console.log("Could not retrieve the images");
1898
                }
1903
                }
1899
                cb();
1904
                cb();
1900
            }
1905
            }
1901
        }
1906
        }
1902
1907
1903
        $(window).load(function() {
1908
        $(window).load(function () {
1904
            wait_for_images(verify_cover_images);
1909
            wait_for_images(verify_cover_images);
1905
        });
1910
        });
1906
1911
1907
        $(document).ready(function() {
1912
        $(document).ready(function () {
1908
1913
            if (prefs.OPACDetailQRCode) {
1909
            if (prefs.OPACDetailQRCode){
1910
1911
                var link_canonical = document.querySelector("link[rel=canonical]");
1914
                var link_canonical = document.querySelector("link[rel=canonical]");
1912
1915
1913
                var qrcode = kjua({
1916
                var qrcode = kjua({
Lines 1918-1930 Link Here
1918
                    text: link_canonical ? link_canonical.href : location.href,
1921
                    text: link_canonical ? link_canonical.href : location.href,
1919
                });
1922
                });
1920
                if (qrcode) {
1923
                if (qrcode) {
1921
                    document.getElementById("qrcode").appendChild( qrcode );
1924
                    document.getElementById("qrcode").appendChild(qrcode);
1922
                }
1925
                }
1923
1926
1924
                $(".show_qrcode").on("click", function(e){
1927
                $(".show_qrcode").on("click", function (e) {
1925
                    e.preventDefault();
1928
                    e.preventDefault();
1926
                    var qrcodeImg = $("#qrcode");
1929
                    var qrcodeImg = $("#qrcode");
1927
                    if( qrcodeImg.hasClass("d-none") ){
1930
                    if (qrcodeImg.hasClass("d-none")) {
1928
                        qrcodeImg.removeClass("d-none");
1931
                        qrcodeImg.removeClass("d-none");
1929
                    } else {
1932
                    } else {
1930
                        qrcodeImg.addClass("d-none");
1933
                        qrcodeImg.addClass("d-none");
Lines 1932-1946 Link Here
1932
                });
1935
                });
1933
            }
1936
            }
1934
1937
1935
            switch (defaulttab){
1938
            switch (defaulttab) {
1936
                case 'holdings':
1939
                case "holdings":
1937
                case 'components':
1940
                case "components":
1938
                case 'descriptions':
1941
                case "descriptions":
1939
                case 'subscriptions':
1942
                case "subscriptions":
1940
                case 'serialcollection':
1943
                case "serialcollection":
1941
                    showBsTab("bibliodescriptions", defaulttab);
1944
                    showBsTab("bibliodescriptions", defaulttab);
1942
                    break;
1945
                    break;
1943
                case 'media':
1946
                case "media":
1944
                    showBsTab("bibliodescriptions", "html5media");
1947
                    showBsTab("bibliodescriptions", "html5media");
1945
                    break;
1948
                    break;
1946
                default:
1949
                default:
Lines 1948-1968 Link Here
1948
            }
1951
            }
1949
1952
1950
            let urlParams = new URLSearchParams(window.location.search);
1953
            let urlParams = new URLSearchParams(window.location.search);
1951
            if ( urlParams.has('tab') ) {
1954
            if (urlParams.has("tab")) {
1952
                let tab = urlParams.get('tab');
1955
                let tab = urlParams.get("tab");
1953
                if ( tab == 'comment' ) {
1956
                if (tab == "comment") {
1954
                    showBsTab("bibliodescriptions", "comments");
1957
                    showBsTab("bibliodescriptions", "comments");
1955
                }
1958
                }
1956
            }
1959
            }
1957
1960
1958
            if (prefs.OpacBrowseResults && busc){
1961
            if (prefs.OpacBrowseResults && busc) {
1959
                $(".l_Results").show();
1962
                $(".l_Results").show();
1960
                $("#a_listResults").on("click", function(e){
1963
                $("#a_listResults").on("click", function (e) {
1961
                    e.preventDefault();
1964
                    e.preventDefault();
1962
                    $(".results-pagination, .close_pagination, .pg_menu").toggle();
1965
                    $(".results-pagination, .close_pagination, .pg_menu").toggle();
1963
                });
1966
                });
1964
1967
1965
                $(".close_pagination").on("click", function(e){
1968
                $(".close_pagination").on("click", function (e) {
1966
                    e.preventDefault();
1969
                    e.preventDefault();
1967
                    $(".results-pagination, .close_pagination, .pg_menu").toggle();
1970
                    $(".results-pagination, .close_pagination, .pg_menu").toggle();
1968
                });
1971
                });
Lines 1978-1988 Link Here
1978
                        details: {
1981
                        details: {
1979
                            display: responsive_display,
1982
                            display: responsive_display,
1980
                            type: "column",
1983
                            type: "column",
1981
                            target: -1
1984
                            target: -1,
1982
                        },
1985
                        },
1983
                    },
1986
                    },
1984
                },
1987
                },
1985
                holdingst_table_settings,
1988
                holdingst_table_settings
1986
            );
1989
            );
1987
            $("#otherholdingst").kohaTable(
1990
            $("#otherholdingst").kohaTable(
1988
                {
1991
                {
Lines 1992-2002 Link Here
1992
                        details: {
1995
                        details: {
1993
                            display: responsive_display,
1996
                            display: responsive_display,
1994
                            type: "column",
1997
                            type: "column",
1995
                            target: -1
1998
                            target: -1,
1996
                        },
1999
                        },
1997
                    },
2000
                    },
1998
                },
2001
                },
1999
                otherholdingst_table_settings,
2002
                otherholdingst_table_settings
2000
            );
2003
            );
2001
2004
2002
            $(".subscriptionst").kohaTable(
2005
            $(".subscriptionst").kohaTable(
Lines 2008-2014 Link Here
2008
                        details: {
2011
                        details: {
2009
                            display: responsive_display,
2012
                            display: responsive_display,
2010
                            type: "column",
2013
                            type: "column",
2011
                            target: -1
2014
                            target: -1,
2012
                        },
2015
                        },
2013
                    },
2016
                    },
2014
                },
2017
                },
Lines 2016-2188 Link Here
2016
            );
2019
            );
2017
2020
2018
            var dTables = $("#holdingst,.subscriptionst,#otherholdingst");
2021
            var dTables = $("#holdingst,.subscriptionst,#otherholdingst");
2019
            $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (event) {
2022
            $('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (event) {
2020
                dTables.DataTable().responsive.recalc();
2023
                dTables.DataTable().responsive.recalc();
2021
            } );
2024
            });
2022
2025
2023
            if (prefs.TagsInputEnabled && loggedinusername){
2026
            if (prefs.TagsInputEnabled && loggedinusername) {
2024
                    $(".tag_add").click(function(){
2027
                $(".tag_add").click(function () {
2025
                        var thisid = $(this).attr("id");
2028
                    var thisid = $(this).attr("id");
2026
                        thisid = thisid.replace("tag_add","");
2029
                    thisid = thisid.replace("tag_add", "");
2027
                        $(this).hide();
2030
                    $(this).hide();
2028
                        $("#tagform"+thisid).show();
2031
                    $("#tagform" + thisid).show();
2029
                        $("#newtag"+thisid).focus();
2032
                    $("#newtag" + thisid).focus();
2030
                        $("#newtag"+thisid+"_status").empty().hide();
2033
                    $("#newtag" + thisid + "_status")
2031
                        return false;
2034
                        .empty()
2032
                    });
2035
                        .hide();
2033
                    $(".cancel_tag_add").click(function(){
2036
                    return false;
2034
                        var thisid = $(this).attr("id");
2037
                });
2035
                        thisid = thisid.replace("cancel","");
2038
                $(".cancel_tag_add").click(function () {
2036
                        $("#tagform"+thisid).hide();
2039
                    var thisid = $(this).attr("id");
2037
                        $("#tag_add"+thisid).show();
2040
                    thisid = thisid.replace("cancel", "");
2038
                        $("#newtag"+thisid).val("");
2041
                    $("#tagform" + thisid).hide();
2039
                        $("#newtag"+thisid+"_status").empty().hide();
2042
                    $("#tag_add" + thisid).show();
2040
                        return false;
2043
                    $("#newtag" + thisid).val("");
2041
                    });
2044
                    $("#newtag" + thisid + "_status")
2042
                    $(".tagbutton").click(function(){
2045
                        .empty()
2043
                        var thisid = $(this).attr("title");
2046
                        .hide();
2044
                        var tag = $("#newtag"+thisid).val();
2047
                    return false;
2045
                        if (!tag || (tag == "")) {
2048
                });
2046
                            alert( _("No tag was specified.") );
2049
                $(".tagbutton").click(function () {
2047
                            return false;
2050
                    var thisid = $(this).attr("title");
2048
                        }
2051
                    var tag = $("#newtag" + thisid).val();
2049
                        KOHA.Tags.add_tag_button(thisid, tag);
2052
                    if (!tag || tag == "") {
2053
                        alert(_("No tag was specified."));
2050
                        return false;
2054
                        return false;
2051
                    });
2055
                    }
2056
                    KOHA.Tags.add_tag_button(thisid, tag);
2057
                    return false;
2058
                });
2052
            }
2059
            }
2053
2060
2054
            if (query_desc !==""){
2061
            if (query_desc !== "") {
2055
                if (prefs.OpacHighlightedWords){
2062
                if (prefs.OpacHighlightedWords) {
2056
                    var query_desc_replaced = query_desc.replace("'", "\'").replace('\n', '\\n').replace('\r', '\\r');
2063
                    var query_desc_replaced = query_desc.replace("'", "\'").replace("\n", "\\n").replace("\r", "\\r");
2057
                    q_array = query_desc_replaced.split(" ");
2064
                    q_array = query_desc_replaced.split(" ");
2058
                    q_array = q_array.filter(function(n){ return n }); // Remove empty strings
2065
                    q_array = q_array.filter(function (n) {
2066
                        return n;
2067
                    }); // Remove empty strings
2059
                    highlightOn();
2068
                    highlightOn();
2060
                    $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ; return false;});
2069
                    $("#highlight_toggle_on")
2061
                    $("#highlight_toggle_off").show().click(function() {highlightOff(); return false;});
2070
                        .hide()
2071
                        .click(function () {
2072
                            highlightOn();
2073
                            return false;
2074
                        });
2075
                    $("#highlight_toggle_off")
2076
                        .show()
2077
                        .click(function () {
2078
                            highlightOff();
2079
                            return false;
2080
                        });
2062
                }
2081
                }
2063
            }
2082
            }
2064
2083
2065
            if (prefs.GoogleJackets){
2084
            if (prefs.GoogleJackets) {
2066
                KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2085
                KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2067
            }
2086
            }
2068
2087
2069
            if (prefs.OpacCoce && prefs.CoceProviders){
2088
            if (prefs.OpacCoce && prefs.CoceProviders) {
2070
                KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $('#biblio-cover-slider') );
2089
                KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#biblio-cover-slider"));
2071
            }
2090
            }
2072
2091
2073
            if (prefs.OpenLibraryCovers){
2092
            if (prefs.OpenLibraryCovers) {
2074
                KOHA.OpenLibrary.GetCoverFromIsbn();
2093
                KOHA.OpenLibrary.GetCoverFromIsbn();
2075
            }
2094
            }
2076
2095
2077
            if (prefs.OPACShelfBrowser){
2096
            if (prefs.OPACShelfBrowser) {
2078
                // Focus on shelf browser if present
2097
                // Focus on shelf browser if present
2079
                var shelfbrowser = $("#shelfbrowser");
2098
                var shelfbrowser = $("#shelfbrowser");
2080
                if (shelfbrowser.length > 0) {
2099
                if (shelfbrowser.length > 0) {
2081
                    $('html,body').animate({
2100
                    $("html,body").animate(
2082
                        scrollTop: shelfbrowser.first().offset().top
2101
                        {
2083
                    },
2102
                            scrollTop: shelfbrowser.first().offset().top,
2084
                    'slow');
2103
                        },
2085
                    shelfbrowser.first().find(':focusable').eq(0).focus();
2104
                        "slow"
2105
                    );
2106
                    shelfbrowser.first().find(":focusable").eq(0).focus();
2086
                }
2107
                }
2087
2108
2088
                (function prepareShelfBrowser(){
2109
                (function prepareShelfBrowser() {
2089
2110
                    $(".main").on("click", ".close_shelf", function (e) {
2090
                    $(".main").on("click",".close_shelf",function(e){
2091
                        e.preventDefault();
2111
                        e.preventDefault();
2092
                        $("#shelfbrowser").toggle();
2112
                        $("#shelfbrowser").toggle();
2093
                    });
2113
                    });
2094
                    $(".main").on("click", "#browser_previous a", function(e){
2114
                    $(".main").on("click", "#browser_previous a", function (e) {
2095
                        e.preventDefault();
2115
                        e.preventDefault();
2096
                        $.ajax({
2116
                        $.ajax({
2097
                            url: "/cgi-bin/koha/svc/shelfbrowser.pl",
2117
                            url: "/cgi-bin/koha/svc/shelfbrowser.pl",
2098
                            data: {
2118
                            data: {
2099
                                "shelfbrowse_itemnumber": $("#browser_previous a").data( "prev-itemnumber" )
2119
                                shelfbrowse_itemnumber: $("#browser_previous a").data("prev-itemnumber"),
2100
                            },
2120
                            },
2101
                            success: function(data){
2121
                            success: function (data) {
2102
                                $("#shelfbrowser").replaceWith(data);
2122
                                $("#shelfbrowser").replaceWith(data);
2103
                                if (prefs.GoogleJackets){
2123
                                if (prefs.GoogleJackets) {
2104
                                    KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2124
                                    KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2105
                                }
2125
                                }
2106
                                if (prefs.OpacCoce && prefs.CoceProviders){
2126
                                if (prefs.OpacCoce && prefs.CoceProviders) {
2107
                                    KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#bibliodescriptions"));
2127
                                    KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#bibliodescriptions"));
2108
                                }
2128
                                }
2109
                                if (prefs.OpenLibraryCovers){
2129
                                if (prefs.OpenLibraryCovers) {
2110
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2130
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2111
                                }
2131
                                }
2112
                                if (prefs.OPACLocalCoverImages){
2132
                                if (prefs.OPACLocalCoverImages) {
2113
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2133
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2114
                                }
2134
                                }
2115
                            }
2135
                            },
2116
                        });
2136
                        });
2117
                    });
2137
                    });
2118
2138
2119
                    $(".main").on("click", "#browser_next a", function(e){
2139
                    $(".main").on("click", "#browser_next a", function (e) {
2120
                        e.preventDefault();
2140
                        e.preventDefault();
2121
                        $.ajax({
2141
                        $.ajax({
2122
                            url: "/cgi-bin/koha/svc/shelfbrowser.pl",
2142
                            url: "/cgi-bin/koha/svc/shelfbrowser.pl",
2123
                            data: {
2143
                            data: {
2124
                                "shelfbrowse_itemnumber": $("#browser_next a").data( "next-itemnumber" )
2144
                                shelfbrowse_itemnumber: $("#browser_next a").data("next-itemnumber"),
2125
                            },
2145
                            },
2126
                            success: function(data){
2146
                            success: function (data) {
2127
                                $("#shelfbrowser").replaceWith(data);
2147
                                $("#shelfbrowser").replaceWith(data);
2128
                                if (prefs.GoogleJackets){
2148
                                if (prefs.GoogleJackets) {
2129
                                    KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2149
                                    KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2130
                                }
2150
                                }
2131
                                if (prefs.OpacCoce && prefs.CoceProviders){
2151
                                if (prefs.OpacCoce && prefs.CoceProviders) {
2132
                                    KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#bibliodescriptions"));
2152
                                    KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#bibliodescriptions"));
2133
                                }
2153
                                }
2134
                                if (prefs.OpenLibraryCovers){
2154
                                if (prefs.OpenLibraryCovers) {
2135
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2155
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2136
                                }
2156
                                }
2137
                                if (prefs.OPACLocalCoverImages){
2157
                                if (prefs.OPACLocalCoverImages) {
2138
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2158
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2139
                                }
2159
                                }
2140
                            }
2160
                            },
2141
                        });
2161
                        });
2142
                    });
2162
                    });
2143
            }());
2163
                })();
2144
        }
2164
            }
2145
2165
2146
            $(".edit_comment").on("click", function(e){
2166
            $(".edit_comment").on("click", function (e) {
2147
                e.preventDefault();
2167
                e.preventDefault();
2148
                Dopop( this.href );
2168
                Dopop(this.href);
2149
            });
2169
            });
2150
        });
2170
        });
2151
2171
2152
        $(document).ready(function() {
2172
        $(document).ready(function () {
2153
            if( prefs.OPACPopupAuthorsSearch ){
2173
            if (prefs.OPACPopupAuthorsSearch) {
2154
                var terms = {
2174
                var terms = {
2155
                    contributors : {
2175
                    contributors: {
2156
                        "label" : "author",
2176
                        label: "author",
2157
                        "keyword_search" : "au:",
2177
                        keyword_search: "au:",
2158
                    },
2178
                    },
2159
                    subject : {
2179
                    subject: {
2160
                        "label" : "subject",
2180
                        label: "subject",
2161
                        "keyword_search" : "su:",
2181
                        keyword_search: "su:",
2162
                    }
2182
                    },
2163
                }
2183
                };
2164
                $(".contributors,.subject").on("click", function(e){
2184
                $(".contributors,.subject").on("click", function (e) {
2165
                    e.preventDefault();
2185
                    e.preventDefault();
2166
                    var term = $(this).attr("class");
2186
                    var term = $(this).attr("class");
2167
                    var selected_term = $(this).text();
2187
                    var selected_term = $(this).text();
2168
                    var term_links = $("." + term );
2188
                    var term_links = $("." + term);
2169
                    if( term_links.length > 1 ){
2189
                    if (term_links.length > 1) {
2170
                        term_links.each(function( index ){
2190
                        term_links.each(function (index) {
2171
                            var authid = "";
2191
                            var authid = "";
2172
                            var preselected = false;
2192
                            var preselected = false;
2173
                            var search_label = $(this).text().trim();
2193
                            var search_label = $(this).text().trim();
2174
                            if( $(this).text() == selected_term ){ preselected = true }
2194
                            if ($(this).text() == selected_term) {
2175
                            if( $(this).hasClass("authority_link") ){
2195
                                preselected = true;
2196
                            }
2197
                            if ($(this).hasClass("authority_link")) {
2176
                                authid = $(this).data("authid");
2198
                                authid = $(this).data("authid");
2177
                                search_string = "an:" + authid;
2199
                                search_string = "an:" + authid;
2178
                            } else {
2200
                            } else {
2179
                                search_string = terms[term]["keyword_search"] + '"' + encodeURIComponent( search_label ) + '"';
2201
                                search_string = terms[term]["keyword_search"] + '"' + encodeURIComponent(search_label) + '"';
2180
                            }
2202
                            }
2181
                            var termLink = $("<li>")
2203
                            var termLink = $("<li>")
2182
                                .append( $("<input>", { type: "checkbox", class: "select_term", value: search_string, id: terms[term]["label"] + index } ).prop("checked", preselected ) )
2204
                                .append($("<input>", { type: "checkbox", class: "select_term", value: search_string, id: terms[term]["label"] + index }).prop("checked", preselected))
2183
                                .append("&nbsp;")
2205
                                .append("&nbsp;")
2184
                                .append( $("<label>", { for: terms[term]["label"] + index, text: search_label } ) )
2206
                                .append($("<label>", { for: terms[term]["label"] + index, text: search_label }));
2185
                            $("#termsList").append( termLink );
2207
                            $("#termsList").append(termLink);
2186
                            $("#multiSearch").modal("show");
2208
                            $("#multiSearch").modal("show");
2187
                        });
2209
                        });
2188
                    } else {
2210
                    } else {
Lines 2190-2262 Link Here
2190
                    }
2212
                    }
2191
                });
2213
                });
2192
2214
2193
                $("#multiSearch").on("hide.bs.modal", function(){
2215
                $("#multiSearch").on("hide.bs.modal", function () {
2194
                    $("#termsList").html("");
2216
                    $("#termsList").html("");
2195
                });
2217
                });
2196
2218
2197
                $(".check_all").on("click", function(e){
2219
                $(".check_all").on("click", function (e) {
2198
                    e.preventDefault();
2220
                    e.preventDefault();
2199
                    $(".select_term").each(function(){
2221
                    $(".select_term").each(function () {
2200
                        $(this).prop("checked", true );
2222
                        $(this).prop("checked", true);
2201
                    });
2223
                    });
2202
                });
2224
                });
2203
2225
2204
                $(".check_none").on("click", function(e){
2226
                $(".check_none").on("click", function (e) {
2205
                    e.preventDefault();
2227
                    e.preventDefault();
2206
                    $(".select_term").each(function(){
2228
                    $(".select_term").each(function () {
2207
                        $(this).prop("checked", false );
2229
                        $(this).prop("checked", false);
2208
                    });
2230
                    });
2209
                });
2231
                });
2210
2232
2211
                $("#validMultiSearch").on("click", function(e){
2233
                $("#validMultiSearch").on("click", function (e) {
2212
                    e.preventDefault();
2234
                    e.preventDefault();
2213
                    multiSearchRequest();
2235
                    multiSearchRequest();
2214
                });
2236
                });
2215
            }
2237
            }
2216
2238
2217
            $(".library_info").on("click", function(e){
2239
            $(".library_info").on("click", function (e) {
2218
                e.preventDefault();
2240
                e.preventDefault();
2219
                var library_name = $(this).data("name");
2241
                var library_name = $(this).data("name");
2220
                var index = $(this).data("index");
2242
                var index = $(this).data("index");
2221
                var url = $(this).attr("href");
2243
                var url = $(this).attr("href");
2222
                let library_info = $("#library_info_" + index).html();
2244
                let library_info = $("#library_info_" + index).html();
2223
                $("#libraryInfoModalLabel").html( library_name );
2245
                $("#libraryInfoModalLabel").html(library_name);
2224
                $("#libraryInfo").html( library_info );
2246
                $("#libraryInfo").html(library_info);
2225
                if( url ){
2247
                if (url) {
2226
                    $("#libraryInfoLink").attr("href", url );
2248
                    $("#libraryInfoLink").attr("href", url);
2227
                    $("#libraryInfoLink").show();
2249
                    $("#libraryInfoLink").show();
2228
                } else {
2250
                } else {
2229
                    $("#libraryInfoLink").hide();
2251
                    $("#libraryInfoLink").hide();
2230
                }
2252
                }
2231
                $("#libraryInfoModal").modal("show");
2253
                $("#libraryInfoModal").modal("show");
2232
            });
2254
            });
2233
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2255
            $("#libraryInfoModal").on("hide.bs.modal", function () {
2234
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2256
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2235
                $("#libraryInfoLink").attr("href", "");
2257
                $("#libraryInfoLink").attr("href", "");
2236
            });
2258
            });
2237
        });
2259
        });
2238
2260
2239
        function showBsTab( container, panelid ){
2261
        function showBsTab(container, panelid) {
2240
            if( $( "#" + panelid + "_panel" ).length == 1 ){
2262
            if ($("#" + panelid + "_panel").length == 1) {
2241
                $("#" + container + " a[href='#" + panelid + "_panel']").tab("show");
2263
                $("#" + container + " a[href='#" + panelid + "_panel']").tab("show");
2242
            } else {
2264
            } else {
2243
                $("#" + container + " a:first").tab("show");
2265
                $("#" + container + " a:first").tab("show");
2244
            }
2266
            }
2245
        }
2267
        }
2246
2268
2247
        function multiSearchRequest(){
2269
        function multiSearchRequest() {
2248
            var values = [];
2270
            var values = [];
2249
            $(".select_term").each(function(){
2271
            $(".select_term").each(function () {
2250
                if( $(this).prop("checked") ){
2272
                if ($(this).prop("checked")) {
2251
                    values.push( $(this).val() );
2273
                    values.push($(this).val());
2252
                }
2274
                }
2253
            });
2275
            });
2254
2276
2255
            if (values.length > 0) {
2277
            if (values.length > 0) {
2256
                var request = "/cgi-bin/koha/opac-search.pl?q=" + values.join(' and ');
2278
                var request = "/cgi-bin/koha/opac-search.pl?q=" + values.join(" and ");
2257
                location.href = request;
2279
                location.href = request;
2258
            }
2280
            }
2259
2260
        }
2281
        }
2261
    </script>
2282
    </script>
2262
    [% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %]
2283
    [% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %]
2263
- 

Return to bug 41582