PageSourceSearch

https://cdnn.1prime.ru//js/libs/quicksearch.js

js 1prime.ru collected 2026-10-01 08:34:34 UTC 2,827 bytes, 83 lines download raw bytes

1$( function() {
2
3    var quickSearchInterval,
4        quicsearchquery = 0;
5
6    var quickSearchKeyup = function() {
7        clearInterval( quickSearchInterval );
8        quickSearchInterval = setInterval(function() {
9            quickSearch();
10            clearInterval( quickSearchInterval );
11        }, 500 );
12    };
13
14    $('.modal__search-query').off( 'input' );
15    $('.modal__search-query').on( 'input', quickSearchKeyup );
16
17    function quickSearch() {
18
19        var url = '/services/search/getmore/';
20
21        if ( quicsearchquery && typeof( quicsearchquery.abort ) == 'function' ) {
22            quicsearchquery.abort();
23        }
24
25        quicsearchquery = $.ajax({
26            url: url,
27            dataType: 'html',
28            beforeSend: function() {
29                $( '.modal__search-list' ).addClass( 'm-loading' );
30            },
31            data: {
32                query: $( '.modal__search-query' ).val(),
33                limit: 5,
34                offset: 0,
35                tags_limit: 3
36            }
37        }).done( function( response ){
38
39            var items_count = parseInt( $( response ).attr( 'data-count' ) ),
40                new_items = $( response ).html();
41
42            if ( $( response ).hasClass( 'list-items-loaded' ) ) {
43
44                if ( !isNaN( items_count ) && items_count != 0 ) {
45                    $( '.modal__search-all' ).attr( 'href', '/search/?query=' + $( '.modal__search-query' ).val() ).addClass( 'm-active' ).find( 'span' ).text( ( items_count == 1 ? '' : 'все ' ) + items_count + ' ' + ria.declension( items_count, [ 'результат', 'результатов', 'результата' ] ) );
46                } else {
47                    $( '.modal__search-all' ).removeClass( 'm-active' ).find( 'span' ).text( "" );
48                }
49
50                $( '.modal__search-list' )
51                    .html( new_items )
52                    .find( '.stat-tags__list' ).theinCarousel({
53                        nav: false,
54                        itemWidth: 226,
55                        motionType : 'scroll',
56                        outside: 20,
57                        between: 15,
58                        sticked: false,
59                        responsive: {
60                            768: {
61                                outside: 0,
62                                items: 3
63                            }
64                        }
65                    });
66            }
67
68        }).always(function() {
69            $( '.modal__search-list' ).removeClass( 'm-loading' );
70        });
71    }
72
73});
74
75function quickSearchOnOpen() {
76    $('.modal__search-query').focus();
77}
78
79function quickSearchOnClose() {
80    $( '.modal__search-query' ).val( "" );
81    $( '.modal__search-list' ).empty();
82    $( '.modal__search-all' ).removeClass( 'm-active' ).find( 'span' ).text( "" );
83}

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.