PageSourceSearch

https://arrowsoft.ru/bitrix/templates/adaptive_s1/components/bitri…/suggest/script.js?16141945382076

js arrowsoft.ru collected 2026-10-07 23:48:17 UTC 2,076 bytes, 61 lines download raw bytes

1
2var $doc = $(document),
3    oldValue,
4    searchCache = {},
5    timer,
6    interval = 500;
7
8function searchSuggest() {
9    var value = $('[data-search-input]').val(),
10        cacheKey;
11
12    if (value != oldValue) {
13        oldValue = value;
14        if (value.length > searchParams.MIN_QUERY_LEN) {
15            cacheKey = value || searchParams.INPUT_ID;
16            if (searchCache[cacheKey] == null) {
17                $.ajax({
18                        url: searchParams.AJAX_PAGE,
19                        method: 'POST',
20                        data: {
21                            'ajax_call': 'y',
22                            'INPUT_ID': searchParams.INPUT_ID,
23                            'q': value,
24                            'l': searchParams.MIN_QUERY_LEN
25                        },
26                        dataType: 'html'
27                    })
28                    .done(function(data){
29                        if (data.trim().length > 0) {
30                            $('[data-search-suggestions]').html(data).slideDown(300);
31                        } else {
32                            $('[data-search-suggestions]').slideUp(300);
33                        }
34                        searchCache[cacheKey] = data;
35                    });
36            }
37            else {
38                if (searchCache[cacheKey].trim().length > 0) {
39                    $('[data-search-suggestions]').html(searchCache[cacheKey]).slideDown(300);
40                } else {
41                    $('[data-search-suggestions]').slideUp(300);
42                }
43            }
44        }
45    }
46}
47
48$doc.ready(function () {
49    $doc
50        .on('change keyup keypress', '[data-search-input]', function () {
51            if(timer) {
52                clearTimeout(timer);
53            }
54            timer = setTimeout(searchSuggest, interval);
55        })
56        .on('click touchstart', '[data-clear-location]', function () {
57            $('[data-search-input]').val('');
58            $('[data-search-suggestions]').slideUp();
59            $('[data-clear-location]').removeClass('active');
60        });
61});

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.