PageSourceSearch

https://www.mskagency.ru/js/jquery.ac.js?v=1790624708

js mskagency.ru collected 2026-10-01 08:33:01 UTC 4,497 bytes, 117 lines download raw bytes

1 // ----------------------------------------------------------------------------
2// autoComplete, JQuery plugin
3// v 1.0
4// ----------------------------------------------------------------------------
5// Copyright (C) 2010 recens
6// http://recens.ru/jquery/plugin_auto_complete.html
7// ----------------------------------------------------------------------------
8jQuery.fn.ac = function (o) {
9    var o = $.extend({
10        url: 'ajax.php',
11        onClose: function (suggest) {
12            setTimeout(function () {
13                suggest.slideUp('fast');
14            }, 100);
15        },
16        dataSend: function (input) {
17            return 'suggest_name=' + input.attr('name') + '&query=ac&word=' + word;
18        },
19        wordClick: function (input, link) {
20            input.val(link.attr('href')).focus();
21        },
22        keyboard_navigation : 1,
23        clickElement : ''
24    }, o);
25    return $(this).each(function () {
26        var onClose = o.onClose;
27        var request_processing = false;
28        
29        var input = $(this);
30        input.after('<div class="auto-suggest"></div>');
31        
32        var suggest = input.next();
33        suggest.width(input.width() + 6);
34
35        input.blur(function () {
36            if (suggest.is(':visible')) {
37                input.focus();
38                onClose(suggest);
39            }
40        });
41        
42        suggest.delegate('a', 'click', function() {
43            o.wordClick(input, $(this));
44            if (o.clickElement) {
45                $(o.clickElement).click();
46            }
47            return false;
48        });
49        
50        input.keyup(function (e) {
51            if (e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13 || e.keyCode == 27) return;
52            word = input.val();
53            if (word) {
54                console.log(o.url)
55                console.log(o.dataSend(input))
56                $.ajax( {
57                    url: o.url + '?' + o.dataSend(input),
58                    // dataType: "jsonp",
59                    data: {
60                    },
61                    success: function( data ) {
62                        if (data.length > 0) {
63                            html = ''
64                            for( let i=0; i<data.length; i++ ) {
65                                html += '<a href="javascript:void(0)" data-rel="' + data[i]['value'].replace(/"/g, "&quot;") + '" data-id="' + data[i]['id'] + '" data-timestamp="1635201124">' + data[i]['value'].replace(/"/g, "&quot;") + '</a>'
66                            }
67                            suggest.html(html).show();
68
69                        } else {
70                            onClose(suggest);
71                        }
72                        // data = data.map(function(e){ e.label = e.id + ": " + e.value; return e })
73                        // if ( data.length == 0 ) {
74                        //     data.unshift({
75                        //         label: "создать: " + request.term,
76                        //         value: request.term
77                        //     });
78                        // }
79                        // response( data );
80                    }
81                } );
82            } else {
83                onClose(suggest);
84            }
85        });
86
87        if ( o.keyboard_navigation ) {
88            input.keydown(function (e) {
89                if (e.keyCode == 38 || e.keyCode == 40) {
90                    var tag = suggest.children('a.selected'),
91                        new_tag = suggest.children('a:first');
92                    if (tag.length) {
93                        if (e.keyCode == 38) {
94                            if (suggest.children('a:first').hasClass('selected')) {
95                                new_tag = suggest.children('a:last');
96                            } else {
97                                new_tag = tag.prev('a');
98                            }
99                        } else {
100                            if (!suggest.children('a:last').hasClass('selected')) {
101                                new_tag = tag.next('a');
102                            }
103                        }
104                        tag.removeClass('selected');
105                    }
106                    new_tag.addClass('selected');
107                    o.wordClick(input, new_tag);
108                    return;
109                }
110                if (e.keyCode == 13 || e.keyCode == 27) {
111                    onClose(suggest);
112                    return;
113                }
114            });
115        }
116    });
117}

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.