PageSourceSearch

https://lermontovka-spb.ru/local/templates/library/js/search.js?time=1790290988

js lermontovka-spb.ru collected 2026-09-24 23:03:20 UTC 4,971 bytes, 192 lines download raw bytes

1$(document).ready(function(){
2
3	let search = location.search;
4	console.log(location.href);
5	
6	if (search.trim().length > 0) {	
7
8		let $all = 0;
9		/*const result = search.slice(search.indexOf('?') + 1).split('&').reduce((params, hash) => {
10			let [key, val] = hash.split('=');
11
12			if (key == 'ALL') {
13				$all = val;
14			}
15
16			return Object.assign(params, {[key]: decodeURIComponent(val)});
17		}, {});*/
18
19		//console.log($all);
20
21		
22		/*$.ajax({
23			url : '/ajax/search_irbis.php',
24			method:'POST',
25			data: result,
26			dataType : "html",
27			success : function(res) {				
28				$('.search-step1').hide();
29				$('.search-step2').show();
30				$('#books').html(res);
31				
32			}, error: function(h1,h2,h3){
33				console.log(h1);
34				console.log(h2);
35				console.log(h3);
36			}
37		});*/
38
39		/*if ($all == 1) {
40			$.ajax({
41				url : '/ajax/search_biblio.php',
42				method:'POST',
43				data: result,
44				dataType : "html",
45				success : function(res) {				
46					$('#profile-tab').show();		
47					$('#electronics').html(res);
48					
49				}, error: function(h1,h2,h3){
50					console.log(h1);
51					console.log(h2);
52					console.log(h3);
53				}
54			});
55		}*/
56
57	}	
58
59	$('.order_form_ajax').submit(function(event){
60		event.preventDefault();
61        event.stopPropagation();
62		let $that = $(this);
63		let $action = $that.attr('action');
64		formData = new FormData($that.get(0)); // создаем новый экземпляр объекта и передаем ему нашу форму (*)
65
66		if ($('#USER_ID').val() == 0) {
67			$('#modal-res').find('.modal-body').html('Бронирование книг доступно только зарегистрированным пользователям<br/><a target="_blank" href="/personal/" class="btn btn-dark">Зарегистрироваться</a>');
68			$('#modal-res').modal('show');
69
70			return false;
71		}
72
73		$.ajax({
74			url : $action,
75			method:'POST',
76			contentType: false, // важно - убираем форматирование данных по умолчанию
77			processData: false, // важно - убираем преобразование строк по умолчанию
78			data: formData,
79			dataType : "html",
80			success : function(res) {
81				
82				$('#modal-res').find('.modal-body').html('Ваш запрос успешно отправлен! После предоставления доступа данные можно увидеть во вкладке Электронные ресурсы');
83				$('#modal-res').modal('show');
84				//$('#faq-my-layer').html(res);
85
86				$('.search-step2').hide();
87				$('.search-step1').show();
88				$('input').val('');
89				
90				
91			}, error: function(h1,h2,h3){
92				console.log(h1);
93				console.log(h2);
94				console.log(h3);
95			}
96		});
97	});
98
99    $('.order_search_form').submit(function(event) {
100        event.preventDefault();
101        event.stopPropagation();
102		
103		let $that = $(this);
104		let $data = {};
105		let $data_array = [];
106		let $action = $that.attr('action');
107		$('#profile-tab').hide();
108
109		$that.find ('input, textarea, select').each(function() {
110			
111			if ($(this).attr('type') != 'checkbox') {
112				$data[this.name] = $(this).val();
113				if ($(this).val() != '') { 
114					$data_array.push(this.name + '=' + $(this).val());
115				}	
116			} else {
117				if($(this).prop('checked') === true) {
118					$data[this.name] = $(this).val();
119					$data_array.push(this.name + '=' + $(this).val());
120				}
121			}	
122		});
123		
124		let $data_string = $data_array.join('&');
125		console.log($data_string);
126		
127		window.history.replaceState(
128			{},
129			'',
130			'?' + $data_string
131		)
132		
133		if ($('#ETYPE').val() !== 'paper') {
134			$.ajax({
135				url : '/ajax/search_biblio.php?' + $data_string,
136				method:'POST',
137				data: {},
138				dataType : "html",
139				success : function(res) {			
140					console.log(res);	
141					$('.search-step1').hide();
142					$('.search-step2').show();
143					$('#profile-tab').show();		
144					$('#electronics').html(res);
145					//$('.order_form_ajax').hide();
146					
147				}, error: function(h1,h2,h3){
148					console.log(h1);
149					console.log(h2);
150					console.log(h3);
151				}
152			});
153		} else {
154			$('#profile-tab').hide();
155			$.ajax({
156				url : '/ajax/search_irbis.php',
157				method:'POST',
158				data: $data,
159				dataType : "html",
160				success : function(res) {				
161					$('.search-step1').hide();
162					$('.search-step2').show();
163					$('#books').html(res);
164					//$('.order_form_ajax').show();
165					
166				}, error: function(h1,h2,h3){
167					console.log(h1);
168					console.log(h2);
169					console.log(h3);
170				}
171			});
172		}
173		
174		return false;
175
176    });
177});
178
179function clearResults() {
180	$('.search-step2').hide();
181	$('.search-step1').show();
182
183	$('#profile-tab').html('');		
184	$('#books').html('');		
185
186	let search = location.search;
187
188	console.log(window.location.hash);
189
190	window.location.href = location.origin + location.pathname;
191
192}

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.