PageSourceSearch

https://www.norrtalje.se/Static/js/Abou.autocomplete.js?v=639237714360000000

js norrtalje.se collected 2026-09-24 22:13:42 UTC 2,038 bytes, 52 lines download raw bytes

1// Example of js-plugin; How to extend the Abou namespace
2;(function (window, document, Abou, $, undefined) {
3
4    // Custom namespace (plugin)
5    Abou.autocomplete = (function () {
6
7        var searchBaseUrl = '/sv/find/rest/autocomplete/get/'; //baseUrl to epiFind autocomplete
8        var sizeArgument = '?size=5'; //return max 5 suggestions
9
10        var getDataSource = function (request, response) {
11            var term = encodeURIComponent(request.term.replace('/', ' ').trim());
12            var url = searchBaseUrl + term + sizeArgument;
13            
14            $.get(url, function (data) {
15                var suggestionsArray = [];
16                $.each(data.Hits, function(index, value) {
17                    suggestionsArray.push(value.Query);
18                });
19                response(suggestionsArray);
20            }, "jsonp");            
21        };
22
23        var applyAutocomplete = function($sourceElement) {
24
25            $sourceElement.autocomplete({
26                source: getDataSource,
27                minLength: 2, //must specify at least two characters
28                delay: 250, //delay before trying to autocomplete, saves requests to the server
29                select: function (event, ui) {
30                    // Populate the tag with the value to make a user click on autocomplete list work
31                    var searchVal = ui == null || ui.item == null ? "" : ui.item.value;
32                    $sourceElement.val(searchVal);
33
34                    $sourceElement.closest("form").submit();
35                }
36            });
37
38        };
39
40        // Public properties
41        return {
42
43            /**
44             * Applies autocomplete to supplied jquery input object. The jQuery ui object will be appended to the body
45             */
46            applyAutocomplete: function ($sourceElement) {
47                applyAutocomplete($sourceElement);
48            }
49        };
50    }());
51
52}(this, this.document, window.Abou = window.Abou || {}, jQuery));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.