PageSourceSearch

https://kogdaeda.ru/assets/js/common.js?t=1791390710

js kogdaeda.ru collected 2026-10-07 16:32:17 UTC 16,118 bytes, 569 lines download raw bytes

1function doPopupSubmit(form,yandex_id,yandex_goal){
2	var required=form.find('[required="required"]');
3	var error=false;
4	$(required).each(function(){
5		if($(this).val()==''){
6			$(this).css('border-color','#e03c42');
7			if(!error){
8				$(this).focus();
9			}
10			error=true;
11		}
12		else{
13			$(this).css('border-color','#c1c1c1');
14		}
15	});
16	if(error){
17		return false;
18	}
19	if(yandex_id!=''&&yandex_goal!=''){
20		//window['yaCounter'+yandex_id].reachGoal(yandex_goal);
21		ym(yandex_id,'reachGoal',yandex_goal);
22		//ga('send','event','form',yandex_goal);
23		//gtag('event',yandex_goal);
24		//dataLayer.push({'event':yandex_goal});
25	}
26	$.ajax({
27		url			:	form.attr('action'),
28		type		:	form.attr('method'),
29		processData	:	false,
30		contentType	:	false,
31		cache		:	false,
32		data		:	new FormData(form[0]),
33		beforeSend	:	function(){$.fancybox.showLoading();},
34		success		:	function(r){
35							if(window.ExitSurvey&&/class=["'][^"']*\bmess_ok\b/.test(r)){
36								window.ExitSurvey.setConverted();
37							}
38							$.fancybox({
39								'content':r,
40								beforeShow:function(){
41									$("input[name=phone]").mask("+7 (999) 999-99-99");
42									check_phone();
43									//form_onsubmit();
44								}
45							});
46							form.find('input[type=text]').val('');
47							form.find('input[type=email]').val('');
48							form.find('textarea').val('');
49						},
50		complete	:	function(){$.fancybox.hideLoading();}
51	});
52	return false;
53}
54function animate_picture(el,to){
55	var image=el.offset();
56	var cart=$(to).offset();
57	var fly_el_attrs=' id="tmp_image" style="position:absolute;top:'+image.top+'px;left:'+image.left+'px;width:'+el.width()+'px;z-index:999;"';
58	if(el.attr('src')){
59		var fly_el='<img src="'+el.attr('src')+'"'+fly_el_attrs+'/>';
60	}
61	else{
62		var fly_el='<i class="'+el.attr('class')+'"'+fly_el_attrs+'></i>';
63	}
64	$('footer').after(fly_el);
65	params={
66		top:cart.top+10+'px',
67		left:cart.left+80+'px',
68		opacity:0.1,
69		width:20
70	};
71	$('#tmp_image').animate(params,900,false,function(){
72		$('#tmp_image').remove();
73	});
74}
75function setEqualHeight(columns){
76	var tallestcolumn=0;
77	columns.each(function(){
78		currentHeight=$(this).height();
79		if(currentHeight>tallestcolumn){
80			tallestcolumn=currentHeight;
81		}
82	});
83	columns.height(tallestcolumn);
84}
85function setEqualHeightBlock(columns,block){
86	columns.each(function(){
87		var tallestcolumn=0;
88		var column=$(this);
89		column.find(block).each(function(){
90			currentHeight=$(this).height();
91			if(currentHeight>tallestcolumn){
92				tallestcolumn=currentHeight;
93			}
94		});
95		column.find(block).height(tallestcolumn);
96	});
97}
98function check_phone(){
99	$('input[name=phone]').on('change',function(){
100		if($(this).val().indexOf('+7 (89')!=-1){
101			alert('Номер телефона указан неверно');
102			$(this).css('border-color','#e03c42');
103			$(this).val('');
104		}
105		else{
106			$(this).css('border-color','#cccccc');
107		}
108	});
109}
110function form_onsubmit(){
111	$('form').on('submit',function(){
112		var required=$(this).find('[required="required"]');
113		var error=false;
114		$(required).each(function(){
115			if($(this).val()==''){
116				$(this).css('border-color','#e03c42');
117				if(!error){
118					$(this).focus();
119				}
120				error=true;
121			}
122			else{
123				$(this).css('border-color','#c1c1c1');
124			}
125		});
126		if(error){
127			return false;
128		}
129		if($(this).hasClass('fp')){
130			doPopupSubmit($(this),$(this).data('counter'),$(this).data('goal'));
131			return false;
132		}
133	});
134}
135function canUseWebp(){
136	let elem=document.createElement('canvas');
137	if(!!(elem.getContext&&elem.getContext('2d'))){
138		return elem.toDataURL('image/webp').indexOf('data:image/webp')==0;
139	}
140	return false;
141}
142window.onload=function(){
143	let images=document.querySelectorAll('[data-bg]');
144	for(let i=0;i<images.length;i++){
145		let image=images[i].getAttribute('data-bg');
146		images[i].style.backgroundImage='url('+image+')';
147	}
148	let isitFirefox=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./);
149	let firefoxVer=isitFirefox?parseInt(isitFirefox[1]):0;
150	if(canUseWebp()||firefoxVer>=65){
151		let imagesWebp=document.querySelectorAll('[data-bg-webp]');
152		for(let i=0;i<imagesWebp.length;i++){
153			let imageWebp=imagesWebp[i].getAttribute('data-bg-webp');
154			imagesWebp[i].style.backgroundImage='url('+imageWebp+')';
155		}
156	}
157};
158$(window).load(function(){
159	setEqualHeightBlock($(".catalog"),$(".item .photo"));
160	setEqualHeightBlock($(".catalog"),$(".item .name"));
161	//setEqualHeight($(".razdels_2 .item"));
162	setEqualHeight($(".razdels_4 .item"));
163	setEqualHeight($(".lists_1 .item .photo"));
164	setEqualHeight($(".lists_1 .item"));
165	setEqualHeight($(".lists_4 .item .inner"));
166	//setEqualHeight($(".catalog_page .announce .nav ul li a"));
167	setEqualHeightBlock($(".catalog_page .announce .nav ul"),$("li a"));
168});
169$.fn.setCursorPosition=function(pos){
170	if($(this).get(0).setSelectionRange){
171		$(this).get(0).setSelectionRange(pos,pos);
172	}
173	else if($(this).get(0).createTextRange){
174		var range=$(this).get(0).createTextRange();
175		range.collapse(true);
176		range.moveEnd('character',pos);
177		range.moveStart('character',pos);
178		range.select();
179	}
180};
181function set_mask_cursor(){
182	$('input[name="phone"]').on('click',function(){
183		$(this).setCursorPosition(4);
184	});
185	$('input[name="code"]').on('click',function(){
186		$(this).setCursorPosition(0);
187	});
188}
189$(document).ready(function(){
190	$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.png'],a[href$='.gif']").fancybox({helpers:{title:{type:'over'}},padding:'0'});
191	$('.popup').not('#nf_link').fancybox({
192		helpers:{title:null},
193		padding:'0',
194		width:'800',
195		beforeShow:function(){
196			$("input[name=phone]").mask("+7 (999) 999-99-99");
197			check_phone();
198			form_onsubmit();
199			set_mask_cursor();
200		}
201	});
202	$("input[name=phone],input.phone").mask("+7 (999) 999-99-99");
203	$("input[name=code]").mask("9999");
204	$("input[name=birthdate]").mask("99.99.9999");
205	set_mask_cursor();
206	$('.catalog_form,.details_form,.checkout form,.fc,.auth_form').on('submit',function(){
207		var yandex_id=$(this).data('counter');
208		var yandex_goal=$(this).data('goal')
209		if(yandex_id!=''&&yandex_goal!=''){
210			//window['yaCounter'+yandex_id].reachGoal(yandex_goal);
211			ym(yandex_id,'reachGoal',yandex_goal);
212			//ga('send','event','cart',yandex_goal);
213			//gtag('event',yandex_goal);
214			console.log(yandex_goal);
215		}
216	});
217	$('.checkout form').on('submit',function(){
218		var error=false;
219		var required_text=$(this).find('input[type=text].required,input[type=tel].required,input[type=email].required');
220		$(required_text).each(function(){
221			if($(this).val()==''){
222				$(this).css('border-color','#e03c42');
223				if(!error){
224					$(this).focus();
225				}
226				error=true;
227			}
228			else{
229				$(this).css('border-color','#c1c1c1');
230			}
231		});
232		var required_radio=$(this).find('input.required_payment');
233		if(!required_radio.is(':checked')){
234			console.log('!required_radio');
235			required_radio.next('span').css('border-color','#e03c42');
236			error=true;
237		}
238		else{
239			console.log('required_radio');
240			required_radio.next('span').css('border-color','#c1c1c1');
241		}
242		if(error){
243			return false;
244		}
245	});
246	$('input[type=text].required,input[type=tel].required,input[type=email].required').on('change',function(){
247		if($(this).val()==''){
248			$(this).css('border-color','#e03c42');
249		}
250		else{
251			$(this).css('border-color','#c1c1c1');
252		}
253	});
254	$('input.required_payment').on('change',function(){
255		$('input.required_payment').next('span').css('border-color','#c1c1c1');
256	});
257	//$("select").not('.classic').selectBoxIt();
258	$('.tabs .navigation ul li').on('click',function(){
259		$(this).closest('.tabs').find('.navigation ul li,.contents .tab').removeClass('active');
260		$(this).addClass('active');
261		$(this).closest('.tabs').find('.contents .tab[data-tab='+$(this).data('tab')+']').addClass('active');
262	});
263	$('.tabs2 .navigation2 ul li').on('click',function(){
264		$(this).closest('.tabs2').find('.navigation2 ul li,.contents2 .tab2').removeClass('active');
265		$(this).addClass('active');
266		$(this).closest('.tabs2').find('.contents2 .tab2[data-tab='+$(this).data('tab')+']').addClass('active');
267	});
268	$('.tabs .tabtitle').on('click',function(){
269		$(this).toggleClass('active').find('i').toggleClass('fa-angle-up fa-angle-down');
270		$(this).next().toggleClass('active');
271	});
272	$("#back_top").hide();
273	var header=$('header');
274	var placeholder=$('#header-placeholder');
275	var headerHeight=header.outerHeight();
276	$(window).scroll(function(){
277		if($(this).scrollTop()>parseInt(headerHeight)){
278			$('#back_top').fadeIn();
279			header.addClass('fixed');
280			placeholder.height(headerHeight);
281		}
282		else{
283			$('#back_top').fadeOut();
284			header.removeClass('fixed');
285			placeholder.height(0);
286		}
287	});
288	$('#back_top a').click(function(){
289		$('body,html').animate({
290			scrollTop:0
291		},800);
292		return false;
293	});
294	form_onsubmit();
295	$('.pricelist .name').on('click',function(){
296		$(this).next('.data').slideToggle();
297		$(this).find('i').toggleClass('fa-chevron-down fa-chevron-up');
298		$(this).toggleClass('active');
299	});
300	$('.questions_1 .sub ul li').on('click',function(){
301		$('.questions_1 .sub ul li,.questions_1 .questions').removeClass('active');
302		$(this).addClass('active');
303		$('.questions_1 .questions[data-id='+$(this).data('id')+']').addClass('active');
304	});
305	$('.question.full').on('click',function(){
306		$(this).toggleClass('active');
307		//$(this).find('i').toggleClass('fa-chevron-down fa-chevron-up');
308		$(this).next('.answer').slideToggle();
309	});
310	$('.catalog_1 .sub ul li').on('click',function(){
311		$('.catalog_1 .sub ul li,.catalog_1 .items').removeClass('active');
312		$(this).addClass('active');
313		$('.catalog_1 .items[data-id='+$(this).data('id')+']').addClass('active');
314	});
315	$(".autocomplete").autocomplete({
316		source:"/ajax.php?lang=def&page_type=search",
317		minLength:4,
318		position:{my:"right top",at:"right bottom"},
319		select:function(event,ui){
320			$(this).val(ui.item.value);
321			$(this).parent('form').submit();
322		}
323	});
324	$('.search i').on('click',function(){
325		$(this).closest('form').submit();
326	});
327	$('.cookie_policy a.accept').on('click',function(){
328		$.ajax({
329			url:'/ajax.php',
330			type:'get',
331			data:{cookie_policy_hide:1},
332			success:function(response){
333				$('.cookie_policy').remove();
334			}
335		});
336	});
337	$('.cookie_policy a.reject').on('click',function(){
338		$.ajax({
339			url:'/ajax.php',
340			type:'get',
341			data:{cookie_policy_reject:1},
342			success:function(response){
343				$('.cookie_policy').remove();
344			}
345		});
346	});
347	$('a[href^="/#"]').on('click',function(){
348		elementClick=$(this).attr("href").substring(1);
349		if($(elementClick).length){
350			destination=$(elementClick).offset().top;
351			$('body,html').animate({scrollTop:destination},1100);
352			return false;
353		}
354	});
355	$('.starrr').each(function(){
356		var el=$(this);
357		$(el).starrr({
358			rating:el.data('rating'),
359			readOnly:el.data('readonly'),
360			max:5,
361			change:function(e,value){
362				$.post('/index.php?ajax_action=rating',{item_id:el.data('id'),rate:value});
363			}
364		});
365	});
366	$('.wish_link').on('click',function(){
367		var item_id=$(this).attr('data-id');
368		var act=$(this).attr('data-action');
369		$.ajax({
370			type:'post',
371			url:'/index.php?ajax_action=wish',
372			data:{id:item_id,act:act},
373			beforeSend:function(){
374			},
375			success:function(r){
376				$('header .wish span').html(r);
377			}
378		});
379		if($(this).attr('data-action')=='add'){
380			$(this).attr('data-action','del');
381			$(this).find('span').html('Убрать из закладок');
382			$(this).addClass('active');
383		}
384		else if($(this).attr('data-action')=='del'){
385			$(this).attr('data-action','add');
386			$(this).find('span').html('Добавить в закладки');
387			$(this).removeClass('active');
388		}
389		if($(this).data('detail')==1){
390			picture=$('#detail_photo');
391		}
392		else{
393			picture=$('.image_'+item_id);
394		}
395		animate_picture(picture,'header .wish');
396		$(this).find('i').toggleClass('fa-heart fa-heart-o');
397		return false;
398	});
399	check_phone();
400	var count_pages=$('#more_pages').val();
401	var more_url=$('#more_url').val();
402	next_page=2;
403	$('#more').on('click',function(){
404		var vm=$('#vm').val();
405		$.ajax({
406			type:"GET",
407			url:more_url+"page="+next_page+'&vm='+vm+'&ajax=1',
408			cache:false,
409			beforeSend:function(){$.fancybox.showLoading();},
410			success:function(html){
411				$(".catalog").append(html);
412			},
413			complete:function(){$.fancybox.hideLoading();}
414		});
415		next_page++;
416		if(next_page>count_pages){
417			$('#more').fadeOut("slow");
418		}
419	});
420	$('.form .vars .check input').on('change',function(){
421		$(this).closest('.vars').find('input').each(function(){
422			var inp=$(this);
423			var label=inp.closest('label');
424			if(inp.is(":checked")){
425				label.addClass('active');
426			}
427			else{
428				label.removeClass('active');
429			}
430		});
431	});
432	/*
433	$('.grid').masonry({
434		itemSelector:'.item',
435	});
436	*/
437	$('.promo .close').on('click',function(){
438		$(this).parent().remove();
439	});
440	$('.gb_form .add .btn').on('click',function(){
441		$(this).parent().next().slideToggle();
442	});
443	$('#gb_images').owlCarousel({
444		loop:true,
445		autoplay:false,
446		margin:0,
447		items:1,
448		navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
449		responsive:{
450			0:{
451				nav:false,
452				dots:true,
453				autoHeight:true,
454			},
455			480:{
456				nav:false,
457				dots:true,
458				autoHeight:true,
459			},
460			768:{
461				nav:true,
462				dots:false,
463				autoHeight:false,
464			}
465		}
466	});
467	$('.menu .td > .name').on('click',function(){
468		$(this).toggleClass('active');
469		$(this).find('i').toggleClass('fa-angle-down fa-angle-up');
470		$(this).closest('.tr').find('.info').slideToggle();
471		//$(this).next('.info').slideToggle();
472	});
473	$('.menu > .name').on('click',function(){
474		$(this).toggleClass('active');
475		$(this).find('i').toggleClass('fa-angle-down fa-angle-up');
476		$(this).closest('.menu').find('.info_all').slideToggle();
477	});
478	$('label.pass i,label.pass2 i').on('click',function(){
479		var inp=$(this).prev('input');
480		if(inp.prop('type')=='password'){
481			inp.prop('type','text');
482			$(this).removeClass('fa-eye').addClass('fa-eye-slash');
483		}
484		else{
485			inp.prop('type','password');
486			$(this).removeClass('fa-eye-slash').addClass('fa-eye');
487		}
488	});
489	$('.balance_history .title span').on('click',function(){
490		$('.balance_history .type,.balance_history .title span').removeClass('active');
491		$('.balance_history .type_'+$(this).data('type')).addClass('active');
492		$(this).addClass('active');
493	});
494	$('.address_list input[type=radio]').on('change',function(){
495		$(this).closest('form').submit();
496	});
497	$('.menu_tabs ul li').on('click',function(){
498		var id=$(this).data('id');
499		$('.menu_s35 .tr').addClass('hide');
500		$('.menu_s35 .tr'+id).removeClass('hide');
501		$('.menu_tabs ul li').removeClass('active');
502		$(this).addClass('active');
503	});
504	$('.owl_actions').owlCarousel({
505		loop:true,
506		autoplay:false,
507		items:1,
508		dots:true,
509		navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
510		nav:true,
511		autoWidth:false,
512		margin:10,
513		responsive:{
514			0:{
515				items:1,
516			},
517			480:{
518				items:5,
519			},
520			768:{
521				items:5,
522			}
523		}
524	});
525	$('.auth_form input[type=submit]').on('click',function(){
526		const form=$(this).closest('form');
527		const token=form.find('input[name=eda]').data('check');
528		form.find('input[name=eda]').val(token);
529	});
530	$('#after_header').owlCarousel({
531		loop:true,
532		autoplay:true,
533		items:1,
534		dots:true,
535		navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
536		nav:true,
537		autoWidth:false,
538		margin:0,
539		items:1,
540		responsive:{
541			0:{
542			},
543			480:{
544			},
545			768:{
546			}
547		}
548	});
549	var $wa = $('.fixed_wa,.fixed_max');
550	function updatePosition() {
551		var scrollTop = $(window).scrollTop();
552		var windowHeight = $(window).height();
553		var targetTop = scrollTop + windowHeight / 2 - $wa.outerHeight() / 2;
554		$wa.stop().animate({ top: targetTop }, 300);
555	}
556	$(window).on('scroll resize', updatePosition);
557	updatePosition();
558	$('.inside_id205 .block_24 .bufet .inner .selects .item .name').on('click', function () {
559		var $item = $(this).closest('.item');
560		$item.siblings().removeClass('active');
561		$item.toggleClass('active');
562	});
563	$('.form_3 label soan').on('click',function(e){
564		e.preventDefault();
565	});
566	$('.form_3 .label_district > span').on('click',function(e){
567		e.preventDefault();
568		$(this).closest('label').toggleClass('active');
569	});});

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.