PageSourceSearch

https://animalface.ru/js/frontend/content/search.js?47

js animalface.ru collected 2026-10-08 09:22:31 UTC 3,677 bytes, 116 lines download raw bytes

1// JavaScript Document
2
3$(function() {
4
5	// Header Search chip and NFC
6	$('#searchForm input[type="search"]').keyup(function(event) {
7
8		if(event.which == 13 || /^[1-9]{1}\d{14}$/.test($(this).val().trim()) || /^AF(\-)?\d{7}$/i.test($(this).val().trim())) {
9
10			$('#searchForm button').trigger('click');
11		}
12
13	});
14
15	if($('#h-type').val() === 'nfc') {		
16		ymaps.ready(function() { 
17		    ymaps.geolocation.get().then(function (result) {
18				$.post('/' + page + '/position', {'latitude': result.geoObjects.position[0], 'longitude': result.geoObjects.position[1], 'accuracy': result.geoObjects.accuracy, 'nfc' : $('#h-value').val()});				
19			});
20		});
21	}
22	
23	// Search in External Bases	
24	$(document).on('click', '.no-data a[data-role="international-search"]', function(event) {
25		event.preventDefault();
26		const chip = $(this).parent().find('strong').text();
27		$('#search-extra').show();
28		$('.preloader-circle input').knob();
29		$('.no-data').remove();
30		createRequest(20, 'first', chip);
31		createRequest(20, 'second', chip);
32		createRequest(20, 'third', chip);
33		createRequest(20, 'fourth', chip);
34		createRequest(20, 'fifth', chip);
35	});
36	
37	
38	if($('#search-result .animal-icon a').length > 0) {
39		$('.fancybox').fancybox({
40			protect: true,
41			buttons : ['close'],
42			thumbs : {
43				autoStart : true
44			}
45		});	
46	}
47	
48	// Message Form
49	$(document).on('click', '#search-result .owner-icon a', function(event) { 
50		event.preventDefault();
51		$.post('/' + page + '/message', {'value' : $('#h-value').val(), 'type' : $('#h-type').val()}, function(data) {
52			$('#window').dialog('destroy').remove();
53			$('<div id="window"><div>').html(data).dialog(optDialog, 'open');
54		});
55	});
56		
57	// Submit Message Form
58	$(document).on('submit', '#message', function(event) {
59		event.preventDefault();					
60		$.post('/' + page + '/message/do', $(this).serialize(), function(data) {
61			if(!DefineErrors(data)) { return; }
62			PopUpMessage(data.status, data.message);
63		}, 'json');
64	});
65		
66});
67
68
69
70function createRequest(percentages, type, chip) {
71			
72	$.post('/' + page + '/world', {'chip': chip, 'type': type, 'lang': $('#lang').val()}, function(data) {
73				
74		if(data.status === 'error') {
75			$('#search-block').html('<br /><div class="description"><svg class="icon-small"><use xlink:href="/i/svg/icons.svg#warning-yellow"></use></svg><br/>' + data.text + '<div>');
76			$('#search-extra').hide();
77			return;
78		}
79		
80		$.each(data, function(field, value) {					
81			
82			var block = "<div>" +
83							"<div>" +
84								"<img src='/data/countries/" + value.countryID + "/" + value.countryImg + "-source.png' alt='' /> " +
85							"</div>" +
86							"<div class='data'>" +
87								"<a target='_blank' href='" + value.url + "'>" + value.name + "</a>" +
88								"<div>" + value.country + "</div>" +
89							"</div>" +
90						"</div>";
91			
92			$('#extra-search-result').prepend(block);
93
94		});
95		
96		var total = parseInt($('.preloader-circle input').val()) + percentages;
97
98		$('.preloader-circle span').text(total + ' %');
99		$('.preloader-circle input').val(total).change();
100			
101		if(total === 100) {
102
103			$('#container-preloader, .pp').hide();
104					
105			// Empty resultf
106			if($('#extra-search-result').html() === '') {
107				$('#search-extra').prepend('<div class="no-data no-border"><div class="description"><svg class="icon-small"><use xlink:href="/i/svg/icons.svg#error-yellow"></use></svg><br/>' + $('#notFoundExtra').val() + '<div></div>');
108			}
109
110			else {
111				$('#search-extra').prepend('<div class="no-data no-border border-bottom"><div class="description"><svg class="icon-small"><use xlink:href="/i/svg/icons.svg#ok-white"></use></svg><br/>' + $('#foundExtra').val() + '<div></div>');	
112			}
113		}
114
115	}, 'json');
116}

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.