[Koha-bugs] [Bug 25532] Add a wikipedia-style search suggestion feature to the OPAC

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Jan 31 17:52:50 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25532

--- Comment #15 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
In OpacUserJs:

$(document).ready(function(){
        $("#translControl1").autocomplete({
        source: function(request, response) {
            $.ajax({
                url: "https://en.wikipedia.org/w/api.php",
                dataType: "jsonp",
                data: {
                    'action': "opensearch",
                    'format': "json",
                    'search': request.term
                },
                success: function(data) {
                    response(data[1]);
                }
            });
        },
        open: function() {
            $('.ui-autocomplete').append('<li
style="text-align:right;font-size:80%;padding: 5px
10px;background:rgba(0,0,0,0.1)">Powered by Wikipedia</li>');
       }
    });
});

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list