PageSourceSearch

https://www.sobor-ushakova.ru/js/scripts.js

js sobor-ushakova.ru collected 2026-10-02 11:49:37 UTC 8,921 bytes, 351 lines download raw bytes

1$(document).ready(function() {
2/* select */
3
4$('.slct').click(function(){
5		$('.sltc').removeClass('active');
6		$('.select').find('ul').slideUp(100);
7	var dropBlock = $(this).parent().find('.drop');
8	if( dropBlock.is(':hidden') ) {
9		dropBlock.slideDown(100);
10		$(this).addClass('active');
11		$('.drop:not(.drop-check)').find('li').click(function(){
12			var selectResult = $(this).html();
13			$(this).parent().parent().find('input').val(selectResult);
14			$(this).parent().parent().find('.slct').removeClass('active').html(selectResult);
15			dropBlock.slideUp(100);
16			if(selectResult == 'Î çäðàâèè')
17			{var tip = 0;
18				treba_tip_1();
19			}
20			if(selectResult == 'Î óïîêîåíèè')
21			{var tip = 1;
22				treba_tip_2();
23			}
24		place_limit();		
25		});
26	} else {
27		$(this).removeClass('active');
28		dropBlock.slideUp(100);
29	}
30
31	return false;
32});
33$(document).click(function() {
34	$('.slct').removeClass('active').parent().find('.drop').slideUp(100);
35});
36$('.check-slct').click(function(){
37		$('.sltc').removeClass('active');
38		$('.check-slct').removeClass('active');
39		$('.select').find('ul').slideUp(100);
40	var dropBlock = $(this).parent().find('.drop');
41	if( dropBlock.is(':hidden') ) {
42		dropBlock.slideDown(100);
43		$(this).addClass('active');
44	} else {
45		$(this).removeClass('active');
46		dropBlock.slideUp(100);
47	}
48	return false;
49});
50$(document).click(function(e) {
51	e = e || event;
52	if ($(e.target).closest('.drop-check').length) return;
53	$('.slct').removeClass('active').parent().find('.drop').slideUp(100);
54	$('.check-slct').removeClass('active').parent().find('.drop').slideUp(100);
55});
56
57/* checkbox */
58
59$(document).ready(function(){
60	$('.checkbox:checked').parent().addClass('checkbox-active');
61})
62$('.checkbox').change(function(){
63	var ch = document.querySelectorAll('.checkbox');
64	var arr = [],text;
65		for(i = 0; i < ch.length; i++){
66			if(ch[i].checked){
67				text = ch[i].parentNode.querySelector('span').innerHTML;
68				arr.push(text);
69			}
70		}
71	$(this).closest('.select').find('.check-slct').html(arr.join(', '));
72	var place = arr.join(', ');
73	var placekol = arr.length;	
74	$(this).parent().parent().parent().parent().parent().find('input').val(place);
75	$(this).parent().parent().parent().parent().parent().find('#placekol').val(placekol);		
76	if($(this).prop('checked')){
77		$(this).parent().addClass('checkbox-active');
78	} else{
79		$(this).parent().removeClass('checkbox-active');
80	}
81	place_limit();
82})
83
84/* order-info */
85
86$('#order-info-body-list').blur(orderInfo);
87$('#order-info-body-list').keyup(orderInfo);
88$('#order-info-title').parent().click(orderInfo);
89$('#order-info-tr').parent().click(orderInfo);
90
91function orderInfo(){
92	$('.order-info-title').html($('#order-info-title').html());
93	$('.order-info-tr').html($('#order-info-tr').html());
94	var names = $('#order-info-body-list').val() || $('#order-info-body-list').attr('value');
95	if(names){
96		$('.order-info-body-list').html('')
97		var arr = names.split(',');
98		for(i = 0; i < arr.length; i++){
99			if(arr[i] != '' && arr[i] != ' ' ){
100				var li = document.createElement('li');
101				li.innerHTML = arr[i];
102				document.querySelector('.order-info-body-list').appendChild(li);
103			}
104		}
105	}
106	else{
107	$('.order-info-body-list').html('')
108	}
109}
110orderInfo();
111/*
112var objSel = document.getElementById("tip");
113alert(objSel.options[objSel.selectedIndex].value); */
114
115/* âûðàâíèâàíèå âûñîòû */
116
117function setEqualHeight(columns)
118{
119var tallestcolumn = 0;
120columns.each(
121function()
122{
123currentHeight = $(this).height();
124if(currentHeight > tallestcolumn)
125{
126tallestcolumn = currentHeight;
127}
128}
129);
130columns.height(tallestcolumn);
131}
132$(document).ready(function() {
133setEqualHeight($(".calendar-block"));
134});
135$(document).ready(function() {
136setEqualHeight($(".attention-block"));
137});
138
139
140function facechange (objName) {
141if ( $(objName).css('display') == 'none' ) {
142$(objName).animate({height: 'show'}, 400);
143} else {
144$(objName).animate({height: 'hide'}, 200);
145}
146}
147
148function treba_tip_1(){
149$('#moleben').find('li.zdrav').show();
150$('#moleben').find('li.upokoj').hide();
151}
152function treba_tip_2(){
153$('#moleben').find('li.zdrav').hide();
154$('#moleben').find('li.upokoj').show();
155}
156function place_limit(){
157	var place_limit = $('#treba_name').val();
158	var placekol = $('#placekol').val();
159	if(place_limit.indexOf('3 õ') + 1) {
160		var limit = 2;}
161	if(place_limit.indexOf('7 õ') + 1) {
162		var limit = 6;}	
163	if(limit){
164	if(placekol>limit){
165	$('input[type="checkbox"]:not(:checked)').prop("disabled", true);
166	}
167		else{
168		$('.checkbox').prop("disabled", false);
169		}
170	}
171	else{
172	$('.checkbox').prop("disabled", false);
173	}
174	
175	
176}
177
178$('#btn_submit').click(function(){
179	var err = 0;
180	var limit = 0;
181	var placekol = $('#placekol').val();
182	var place_limit = $('#treba_name').val();
183	if(place_limit.indexOf('3 õ') + 1) {
184	  limit = 3;}
185	if(place_limit.indexOf('7 õ') + 1) {
186	  limit = 7;}	
187	  
188    if(!(/^.+@.+\..+$/i.test($('#mail').val()))){
189	err = 4;}	
190    if($('#typ').val() == ''){
191	err = 1;}
192    if($('#treba_name').val() == ''){
193	err = 1;}
194    if($('#order-info-body-list').val() == ''){
195	err = 1;}
196    if(placekol == ''){
197	err = 1;}
198    if($('#fio').val() == ''){
199	err = 1;}
200    if($('#mail').val() == ''){
201	err = 1;}	
202
203	if(err == 0 && limit != 0){
204		if(placekol<limit){
205		 err = 2;
206		 var d = limit-placekol;}
207		if(placekol>limit){
208			err = 3;
209			var d = placekol-limit;}
210		
211	}
212	
213    if (err == 0){
214 
215       // $('form').submit();
216
217       var typ    = $('#typ').val();
218       var treba_name   = $('#treba_name').val();
219       var names = $('#order-info-body-list').val();	
220       var fio = $('#fio').val();	
221       var mail = $('#mail').val();	
222       var descr = $('[name="descr"]').val();	
223console.log(typ);
224console.log(treba_name);
225console.log(names);
226console.log(fio);
227console.log(mail);
228console.log(descr);
229       $.ajax({
230        type: 'POST',
231        url: '/mailsend.php',
232        // data: {
233        // 	"typ": typ,
234        // 	"treba_name": treba_name,
235        // 	"names": names,
236        // 	"fio" : fio,
237        // 	"mail": mail,
238        // 	"descr": descr,
239        // },
240        data: $("#order").serialize(),
241        success:function(){
242        	alert('Çàÿâêà îòïðâëåíà')
243          // $(".window_body").fadeOut(1)
244          // $("#result").find('.result_text').empty();
245          // $("#result").find('.result_text').append('Çàÿâêà óñïåøíî îòïðàâëåíà.');
246          $('#order-form')[0].reset();
247          // $("#result").fadeIn(500);
248        },
249        error:function (){
250        	alert('Çàÿâêà íå îòïðâëåíà')
251           // $(".window_body").fadeOut(1)
252           // $("#result").find('.result_text').empty();
253           // $("#result").find('.result_text').append('<span class="error">Îøèáêà îòïðàâêè ïî÷òû.<br /> Ïîïðîáóéòå ñíîâà.</span>');
254           $('#order-form')[0].reset();
255           // $("#result").fadeIn(500);
256        }
257      });
258
259      } else {
260		if(err == 1){
261			alert('Çàïîëíèòå âñå íåîáõîäèìûå ïîëÿ, ïåðåä îòïðàâêîé çàêàçà');
262			return false		
263		}
264		if(err == 2){
265			alert('Íåîáõîäèìî âûáðàòü åùå '+(d)+' õðàì(à)');
266			return false		
267		}
268		if(err == 3){
269			alert('Âûáðàíî íà '+(d)+' áîëüøå õðàì(à)');
270			return false		
271		}		
272		if(err == 4){
273			alert('Óêàæèòå êîððåêòíûé email');
274			return false		
275		}				
276      }	
277});
278
279function getCharCode(event) {
280    return null === event.which // IE
281        ? event.keyCode
282        : !(0 === event.which || 0 === event.charCode) ? event.which : -1;
283}
284
285if(document.getElementById('order-info-body-list')){
286	document.getElementById('order-info-body-list').addEventListener('keypress'
287		 , function(event) {
288			  if ( 13 === getCharCode(event) ) // Enter
289					event.preventDefault();
290		 }
291		 , false
292	);
293}
294
295/* ___________________________________ */
296
297/* radio */
298
299$('.radio:checked').closest('.radio-label').addClass('active');
300$('.radio').on('change', function(){
301	var t = $(this),
302		name = t.attr('name');
303	$('[name='+name+']').closest('.radio-label').removeClass('active');
304	if(t.prop('checked')){
305		t.closest('.radio-label').addClass('active');
306	}else{
307		t.closest('.radio-label').removeClass('active');
308	}
309})
310
311$('.pay-select span').on('click',function(){
312	$(this).parent().find('.pay-select-drop').slideToggle(50);
313})
314
315$('.pay-select-drop input').on('change', function(){
316	var t = $(this),
317		text = t.closest('.radio-label').find('span').text();
318	t.closest('.pay-select').children('span').text(text);
319	$('.pay-select-drop').slideToggle(50);
320})
321
322
323$(document).ready(function() {
324	$('.sitebar-open').on('click', function() {
325		$('.sitebar-open').toggleClass('normal').toggleClass('hover');
326		$('.sitebar').slideToggle('fast');
327	});
328});
329
330/* Treby */
331$(document).ready(function() {
332	if($('body').attr('class') == 'option-com_treba view-trebs layout-') {
333		$('.order-quest-block > h2').append('<span class="slide-switch minus"></span>');
334		$('.order-quest-block > h2 + p').slideDown(0);
335		$('.slide-switch').on('click', function() {
336			$(this).toggleClass('minus').toggleClass('plus');
337			$(this).parent().next('p').slideToggle(250);
338		});
339	}
340});
341
342});
343
344
345
346
347
348
349
350
351

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.