PageSourceSearch

https://resantashop.ru/index.php?route=common/sphinx/script

js resantashop.ru collected 2026-09-29 13:35:43 UTC 2,983 bytes, 107 lines download raw bytes

1var selector = '#search input';
2var selector2 = '#input-search';
3var queryMinLength = '3';
4var catTitle = 'Категории';
5var prodTitle = 'Товары';
6var viewAllTitle = 'Посмотреть все';
7var noResTitle = 'Ничего не найдено';
8
9$(document).ready(function() {
10  var delay = (function () {
11    var timer = 0;
12    return function (callback, ms) {
13      clearTimeout(timer);
14      timer = setTimeout(callback, ms);
15    };
16  })();
17
18	var timer = null;
19	$(selector2).keyup(function(){
20    delay(function(){
21      sphinxAutocomplete(selector2)
22    }, 300);
23	});
24
25	$(selector).keyup(function(){
26    delay(function(){
27      sphinxAutocomplete(selector)
28    }, 300);
29	});
30
31});
32
33$(document).mouseup(function (e) {
34
35	if (!$('.sphinxsearch').is(e.target) && $('.sphinxsearch').has(e.target).length === 0) {
36		$('.sphinxsearch').hide();
37		$(selector).removeClass('no-bottom-borders');
38		return false;
39	}
40
41	if (!$('.sphinxsearch').is(e.target) && $('.sphinxsearch').has(e.target).length === 0) {
42		$('.sphinxsearch').hide();
43		$(selector2).removeClass('no-bottom-borders');
44		return false;
45	}
46
47});
48
49function sphinxAutocomplete(input) {
50	if($(input).val() == '' || $(input).val().length < queryMinLength) {
51		$('.sphinxsearch').hide();
52		$(selector).removeClass('no-bottom-borders');
53		return false;
54	}
55
56
57	$.ajax({
58		url: 'https://resantashop.ru/index.php?route=common/sphinx/autocompleate&search=' + $(input).val(),
59		dataType: 'json',
60		success: function(json) {
61
62			var html = '';
63
64			//Categories
65			if (json.categories.length) {
66
67				html += '<div class="categories"><span>'+catTitle+'</span>';
68				var categories = json.categories;
69				for (i = 0; i < categories.length; i++) {
70					html += '<a href="' + categories[i]['href'] + '">';
71					if(categories[i]['image'] != '') {
72						html += '<img src="' + categories[i]['image'] + '" />';
73					}
74					html += categories[i]['name'];
75					html += '<br />';
76					html += '</a>';
77				}
78				html += '</div>';
79			}
80
81			//Products
82			if (json.products.length) {
83
84				if (json.categories.length) { html += '<div class="products"><span>'+prodTitle+'</span>'; }
85				var products = json.products;
86				for (i = 0; i < products.length; i++) {
87					html += '<a href="' + products[i]['href'] + '">';
88					html += '<img src="' + products[i]['image'] + '" />';
89					html += products[i]['name'];
90					html += '<br />';
91					html += '</a>';
92				}
93				if (json.categories.length) {  html += '</div>'; }
94				html += '<div class="sphinx-viewall">' +
95                  '<a id="view-all" href="https://resantashop.ru/search?wildcard=true&search='+encodeURIComponent($(input).val())+'"><span>'+viewAllTitle+'</span></a>' +
96                '</div>';
97			} else {
98				html = '<div class="sphinx-viewall-no-res">'+noResTitle+'</div>';
99			}
100
101			$('ul.dropdown-menu, .sphinxsearch').remove();
102			$(input).after('<div class="sphinxsearch">'+ html +'</div>');
103			$('.sphinxsearch').show();
104			$(input).addClass('no-bottom-borders');
105		}
106	});
107}

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.