PageSourceSearch

https://www.avclub.pro/catalog/view/theme/avclub/js/register-brand.js?v=1711356438

js avclub.pro collected 2026-10-02 10:18:45 UTC 4,253 bytes, 156 lines download raw bytes

1
2$(function(){
3
4	$(document).on('change', '.regbrand__fields input', function(){
5		$('.regbrand input[name="b24_company_id"]').val(0);
6	});
7
8	$(document).on('click', '#regbrand-search', function(e){
9		e.preventDefault();
10
11		var 
12		input = $(this).closest('.regbrand__start--inp').find('input[name="brand"]'),
13		selectedCountry = $('input[name="company_country"]:checked'),
14		error = false;
15
16		if(input.val().length < 1 || !selectedCountry.val()) {
17			error = true;
18		}
19
20		console.log(input.val());
21		console.log(selectedCountry.val());
22
23		if(!error) {
24			$.ajax({
25				type: "POST", 
26				url: "index.php?route=register/company/searchCompanies", 
27				dataType: "json",
28				data: {
29					company_name: input.val(),
30					country: selectedCountry.val()
31				},
32				beforeSend: function(json) { $('.reg__load').fadeIn(); },
33				complete: function(json) { $('.reg__load').fadeOut(); $('#button-save').prop("disabled", false)},
34				success: function(json){
35					if(json['template']) {
36						$('.regbrand').html(json['template']);
37					}
38				},
39				error: function(json){
40					console.log('brand search error', json);
41				}
42			});
43		} else {
44			$('.regbrand__country--subtitle__error, .regbrand__company--subtitle__error').hide();
45
46			if (!selectedCountry.val() && input.val().length > 1) {
47				console.log('1')
48				$('.regbrand__country--subtitle__error').text('Выберите название страны').show();
49			}else if(input.val().length < 1 && selectedCountry.val()){
50				console.log('2')
51				$('.regbrand__company--subtitle__error').text('Введите название компании').show();
52			}else{
53				console.log('3')
54				$('.regbrand__company--subtitle__error').text('Введите название компании').show();
55				$('.regbrand__country--subtitle__error').text('Выберите название страны').show();
56			}
57		}
58
59	})
60
61	$(document).on('click', '#regbrand-change', function(e){
62		e.preventDefault();
63
64		var 
65		search = $(this).attr('data-search');
66
67		$('#button-save').prop("disabled",true);
68
69		$.ajax({
70			type: "POST", 
71			url: "index.php?route=register/company/changeSearch", 
72			dataType: "json", 
73			data: {
74				'search': search
75			},
76			beforeSend: function(json) { $('.reg__load').fadeIn(); },
77			complete: function(json) { $('.reg__load').fadeOut(); },
78			success: function(json){
79				if(json['template']) {
80					$('.regbrand').html(json['template']);
81				}
82			},
83			error: function(json){
84				console.log('brand change error', json);
85			}
86		});
87
88	})
89
90	$(document).on('click', '.regbrand--choose', function(e){
91		e.preventDefault();
92
93		var 
94		btn = $(this),
95		b24id = $(this).attr('data-id'),
96		company_name = $(this).attr('data-name'),
97		company_address = $(this).attr('data-address'),
98		company_director = $(this).attr('data-director'),
99		company_inn = $(this).attr('data-inn');
100
101		$.ajax({
102			type: "POST", 
103			url: "index.php?route=register/company/chooseCompany", 
104			dataType: "json", 
105			data: {
106				'b24id': b24id,
107				'company_name': company_name,
108				'company_address': company_address,
109				'company_director': company_director,
110				'company_inn': company_inn,
111			},
112			beforeSend: function(json) { $('.reg__load').fadeIn(); },
113			complete: function(json) { $('.reg__load').fadeOut(); },
114			success: function(json){
115				$('#button-save').prop("disabled",false)
116				if(json['template']) {
117					$('.regbrand').html(json['template']);
118				}
119			},
120			error: function(json){
121				console.log('brand choose error', json);
122			}
123		});
124
125	})
126
127	$(document).on('click', '#regbrand-add', function(e){
128		e.preventDefault();
129
130		var 
131		btn = $(this),
132		search = $(this).attr('data-search'),
133		company_second_choice = $(this).attr('data-choice');
134
135		$.ajax({
136			type: "POST", 
137			url: "index.php?route=register/company/addNewCompany", 
138			dataType: "json", 
139			data: 'search=' + search + '&company_second_choice=' + company_second_choice ,
140			beforeSend: function(json) { $('.reg__load').fadeIn(); },
141			complete: function(json) { $('.reg__load').fadeOut(); },
142			success: function(json){
143				$('#button-save').prop("disabled",false)
144				if(json['template']) {
145					$('.regbrand').html(json['template']);
146				}
147			},
148			error: function(json){
149				console.log('brand add error', json);
150			}
151		});
152
153	})
154
155
156});

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.