PageSourceSearch

https://profashion.ru/local/layout/js/tools.js

js profashion.ru collected 2026-10-02 06:31:39 UTC 35,733 bytes, 1,104 lines download raw bytes

1/*
2изменения помечены словом customfix
3*/
4
5$(document).ready(function() {
6
7	$.validator.addMethod('phoneRU',
8		function(phone_number, element) {
9			return this.optional(element) || phone_number.match(/^\+7 \(\d{3}\) \d{3}\-\d{2}\-\d{2}$/);
10		},
11		'Ошибка заполнения'
12	);
13
14	$('form').each(function() {
15		initForm($(this));
16	});
17
18	$('.table-scroll').mCustomScrollbar({
19		axis: 'x'
20	});
21
22	$('body').on('click', '.window-link', function(e) {
23		windowOpen($(this).attr('href'));
24		e.preventDefault();
25	});
26
27	$('body').on('keyup', function(e) {
28		if (e.keyCode == 27) {
29			windowClose();
30		}
31	});
32
33	$(document).click(function(e) {
34		if ($(e.target).hasClass('window')) {
35			windowClose();
36		}
37	});
38
39	$(window).resize(function() {
40		windowPosition();
41	});
42
43	$('body').on('click', '.window-close, .window-btn-close', function(e) {
44		windowClose();
45		e.preventDefault();
46	});
47
48	$('.main-popular .main-popular-content').each(function() {
49		var curBlock = $(this);
50		var curBig = curBlock.find('.main-big');
51		if (curBig.length == 1) {
52			curBlock.find('.main-mini-list').prepend('<div class="main-mini main-mini-mobile">' +
53														'<a href="' + curBig.find('a').attr('href') + '">' +
54															'<div class="main-mini-photo"><img src="' + curBig.find('.main-big-photo img').attr('data-src') + '" alt="" /></div>' +
55															'<div class="main-mini-type">' + curBig.find('.main-big-type').html() + '</div>' +
56															'<div class="main-mini-date-mobile">' + curBig.find('.main-big-date-mobile').html() + '</div>' +
57															'<div class="main-mini-title">' + curBig.find('.main-big-title').html() + '</div>' +
58															'<div class="main-mini-anonce">' + curBig.find('.main-big-anonce').html() + '</div>' +
59															'<div class="main-mini-info">' +
60																'<div class="main-mini-info-date">' + curBig.find('.main-big-info-date').html() + '</div>' +
61																'<div class="main-mini-info-view">' + curBig.find('.main-big-info-view').html() + '</div>' +
62															'</div>' +
63														'</a>' +
64														'<div class="main-mini-type-links">' + curBig.find('.main-big-type-links').html() + '</div>' +
65													'</div>');
66		}
67	});
68
69	$('body').on('click', '.main-news-more .btn', function(e) {
70		var curLink = $(this);
71		if (!curLink.hasClass('loading')) {
72			curLink.addClass('loading');
73			$.ajax({
74				type: 'POST',
75				url: curLink.attr('href'),
76				dataType: 'html',
77				cache: false
78			}).done(function(html) {
79				var newHTML = $(html);
80				$('.main-news-list').append(newHTML.find('.main-news-list').html());
81				$('.main-news-list .lzy_img').each(function() {
82					var lazyImage = $(this);
83					lazyImage.attr('src', lazyImage.attr('data-src'));
84					lazyImage.removeClass('lzy_img');
85				});
86				if (newHTML.find('.main-news-more .btn').length > 0) {
87					curLink.attr('href', newHTML.find('.main-news-more .btn').attr('href'));
88					curLink.removeClass('loading');
89				} else {
90					curLink.parent().remove();
91				}
92				$(window).trigger('scroll');
93			});
94		}
95		e.preventDefault();
96	});
97
98	$('body').on('click', '.main-popular-more .btn', function(e) {
99		var curLink = $(this);
100		if (!curLink.hasClass('loading')) {
101			curLink.addClass('loading');
102			$.ajax({
103				type: 'POST',
104				url: curLink.attr('href'),
105				dataType: 'html',
106				cache: false
107			}).done(function(html) {
108				var newHTML = $(html);
109				$('.main-popular .main-mini-list').append(newHTML.find('.main-mini-list').html());
110				$('.main-popular .main-mini-list .lzy_img').each(function() {
111					var lazyImage = $(this);
112					lazyImage.attr('src', lazyImage.attr('data-src'));
113					lazyImage.removeClass('lzy_img');
114				});
115				if (newHTML.find('.main-popular-more .btn').length > 0) {
116					curLink.attr('href', newHTML.find('.main-popular-more .btn').attr('href'));
117					curLink.removeClass('loading');
118				} else {
119					curLink.parent().remove();
120				}
121				$(window).trigger('scroll');
122			});
123		}
124		e.preventDefault();
125	});
126
127	$('.main-projects-list').slick({
128		infinite: false,
129		slidesToShow: 5,
130		slidesToScroll: 5,
131		prevArrow: '<button type="button" class="slick-prev" aria-label="Previous project"><svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.22379 10L13 18.3777L11.6371 20L-4.37114e-07 10L11.6371 -5.08674e-07L13 1.62234L3.22379 10Z" /></svg></button>',
132		nextArrow: '<button type="button" class="slick-next" aria-label="Next project"><svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.77621 10L8.8276e-07 1.62234L1.3629 -5.08674e-07L13 10L1.3629 20L1.50361e-07 18.3777L9.77621 10Z" /></svg></button>',
133		dots: false,
134		responsive: [
135			{
136				breakpoint: 1159,
137				settings: {
138					slidesToShow: 4,
139					slidesToScroll: 4,
140					arrows: false,
141					dots: true
142				}
143			},
144			{
145				breakpoint: 1024,
146				settings: {
147					slidesToShow: 3,
148					slidesToScroll: 3,
149					arrows: false,
150					dots: true
151				}
152			},
153			{
154				breakpoint: 767,
155				settings: {
156					slidesToShow: 2,
157					slidesToScroll: 2,
158					arrows: false,
159					dots: true
160				}
161			}
162		]
163	});
164
165	$('.menu-link').click(function(e) {
166		if ($('html').hasClass('menu-open')) {
167			$('.wrapper').css({'top': 'auto'});
168			$('html').removeClass('menu-open');
169			$(window).scrollTop($('.wrapper').data('curScroll'));
170		} else {
171			$('.wrapper').css({'top': -$(window).scrollTop()});
172			$('.wrapper').data('curScroll', $(window).scrollTop());
173			$('html').addClass('menu-open');
174		}
175		e.preventDefault();
176	});
177
178	$(document).click(function(e) {
179		if ($(e.target).hasClass('header-inner')) {
180			if ($('html').hasClass('menu-open')) {
181				$('.wrapper').css({'top': 'auto'});
182				$('html').removeClass('menu-open');
183				$(window).scrollTop($('.wrapper').data('curScroll'));
184			}
185		}
186	});
187
188	$('.header-search-link').click(function(e) {
189		$('.header-search').addClass('open');
190		$('.header-search-input input').trigger('focus');
191		e.preventDefault();
192	});
193
194	$(document).click(function(e) {
195		if ($(e.target).parents().filter('.header-search').length == 0) {
196			$('.header-search').removeClass('open');
197		}
198	});
199
200	$('.marketing-media-select-title').click(function() {
201		$(this).parent().toggleClass('open');
202	});
203
204	$(document).click(function(e) {
205		if ($(e.target).parents().filter('.marketing-media-select').length == 0) {
206			$('.marketing-media-select').removeClass('open');
207		}
208	});
209
210	$('.gallery').each(function() {
211		var curGallery = $(this);
212		curGallery.find('.gallery-list').slick({
213			infinite: true,
214			slidesToShow: 1,
215			slidesToScroll: 1,
216			adaptiveHeight: true,
217			prevArrow: '<button type="button" class="slick-prev"><svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.22379 10L13 18.3777L11.6371 20L-4.37114e-07 10L11.6371 -5.08674e-07L13 1.62234L3.22379 10Z" /></svg></button>',
218			nextArrow: '<button type="button" class="slick-next"><svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.77621 10L8.8276e-07 1.62234L1.3629 -5.08674e-07L13 10L1.3629 20L1.50361e-07 18.3777L9.77621 10Z" /></svg></button>',
219			dots: false,
220			responsive: [
221				{
222					breakpoint: 1159,
223					settings: {
224						arrows: false,
225						dots: true
226					}
227				}
228			]
229		}).on('setPosition', function(event, slick) {
230			var currentSlide = curGallery.find('.gallery-list').slick('slickCurrentSlide') + 1;
231			curGallery.find('.gallery-ctrl-current').html(currentSlide);
232		});
233	});
234
235	$('.brand-footer-close').click(function(e) {
236		$('.brand-footer').fadeOut();
237		e.preventDefault();
238	});
239
240	$('body').on('click', '.form-reset input', function() {
241		window.setTimeout(function() {
242			$('.form-select select').trigger('chosen:updated');
243			$('.form-file input').each(function() {
244				var curInput = $(this);
245				var curField = curInput.parent();
246				if (curInput.val() == '') {
247					curField.find('.form-file-name').html('');
248					curField.removeClass('success');
249				}
250			});
251		}, 100);
252	});
253
254	$('.menu-section').each(function() {
255		var curSection = $(this);
256		if (curSection.next().hasClass('menu-section-list')) {
257			curSection.addClass('with-submenu');
258			curSection.append('<span></span>');
259		}
260	});
261
262	$('.menu-section span').click(function(e) {
263		if ($(window).width() < 1160) {
264			if ($(this).parent().hasClass('with-submenu')) {
265				$(this).parent().toggleClass('open');
266				e.preventDefault();
267			}
268		}
269	});
270
271	$('body').on('click', '.article-social a', function(e) {
272		var curLink = $(this);
273		var curSocial = curLink.parent();
274		var curTitle = encodeURIComponent(curSocial.data('title'));
275		var curDescription = encodeURIComponent(curSocial.data('description'));
276		var curUrl = encodeURIComponent(curSocial.data('url'));
277
278		switch (curLink.data('id')) {
279			case 'tg':
280				popupCenter('https:///t.me/share/url?url=' + curUrl + '&text=' + curTitle + '. ' + curDescription, curTitle);
281				break;
282
283			case 'fb':
284				popupCenter('https://www.facebook.com/sharer/sharer.php?u=' + curUrl, curTitle);
285				break;
286
287			case 'vk':
288				popupCenter('https://vk.com/share.php?url=' + curUrl + '&description=' + curTitle + '. ' + curDescription, curTitle);
289				break;
290
291			case 'tw':
292				var text = curTitle || curDescription || '';
293				if (curTitle.length > 0 && curDescription.length > 0) text = curTitle + ' - ' + curDescription;
294				if (curDescription.length > 0) text = '&text=' + text;
295				popupCenter('https://twitter.com/intent/tweet?url=' + curUrl + text, curTitle);
296				break;
297
298			default:
299				break;
300		}
301
302		e.preventDefault();
303	});
304
305	$('body').on('change', '.window-policy-checkbox input', function() {
306		if ($(this).prop('checked')) {
307			$(this).parents().filter('form').find('.window-policy-error').removeClass('visible');
308			$(this).parents().filter('form').find('.form-submit .btn').prop('diabled', false).removeClass('disabled');
309		} else {
310			$(this).parents().filter('form').find('.window-policy-error').addClass('visible');
311			$(this).parents().filter('form').find('.form-submit .btn').prop('diabled', true).addClass('disabled');
312		}
313	});
314
315	$('.page-404-menu ul li a').click(function(e) {
316		var curLi = $(this).parent();
317		if (!curLi.hasClass('active')) {
318			$('.page-404-menu ul li.active').removeClass('active');
319			curLi.addClass('active');
320
321			var curIndex = $('.page-404-menu ul li').index(curLi);
322			$('.page-404-tab').stop(true, true);
323			$('.page-404-tab:visible').fadeOut(100, function() {
324				$('.page-404-tab').eq(curIndex).fadeIn(100);
325			});
326		}
327		e.preventDefault();
328	});
329
330	$('nav ul li').each(function() {
331		if ($(this).find('ul').length > 0) {
332			$(this).addClass('with-submenu');
333		}
334	});
335
336	$('.up-link').click(function(e) {
337		$('html, body').animate({'scrollTop': 0});
338		e.preventDefault();
339	});
340
341	$('body').on('change', '#activity-other', function(e) {
342		if ($(this).prop('checked')) {
343			$('#activity-other-text').addClass('visible');
344		} else {
345			$('#activity-other-text').removeClass('visible');
346		}
347	});
348
349	if ($('.article-infinity').length > 0) {
350		$('.article-infinity').data('loading', false);
351		$('.article-infinity').find('.article-infinity-item').eq(0).addClass('active');
352
353		$(window).on('load resize scroll', function() {
354			var curInifinity = $('.article-infinity');
355			var curScroll = $(window).scrollTop();
356			var curHeight = $(window).height();
357			var curArticle = curInifinity.find('.article-infinity-item.active');
358			if (curArticle.length > 0) {
359				if (!curInifinity.data('loading')) {
360					if ((curScroll + curHeight) >
360 ((curArticle.offset().top + curArticle.height()) / 2)) {
361						if (curArticle.attr('data-next') !== undefined) {
362							curInifinity.data('loading', true);
363							$.ajax({
364								type: 'POST',
365								url: curArticle.attr('data-next'),
366								dataType: 'html',
367								cache: false
368							}).done(function(html) {
369								curInifinity.append(html);
370								curInifinity.find('.article-infinity-item:last').addClass('next');
371								$('.article-infinity .lzy_img').each(function() {
372									var lazyImage = $(this);
373									lazyImage.attr('src', lazyImage.attr('data-src'));
374									lazyImage.removeClass('lzy_img');
375								});
376
377								curInifinity.find('.article-infinity-item:last .gallery').each(function() {
378									var curGallery = $(this);
379									curGallery.find('img').eq(0).on('load', function() {
380										curGallery.find('.gallery-list').slick({
381											infinite: true,
382											slidesToShow: 1,
383											slidesToScroll: 1,
384											adaptiveHeight: true,
385											prevArrow: '<button type="button" class="slick-prev"><svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.22379 10L13 18.3777L11.6371 20L-4.37114e-07 10L11.6371 -5.08674e-07L13 1.62234L3.22379 10Z" /></svg></button>',
386											nextArrow: '<button type="button" class="slick-next"><svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.77621 10L8.8276e-07 1.62234L1.3629 -5.08674e-07L13 10L1.3629 20L1.50361e-07 18.3777L9.77621 10Z" /></svg></button>',
387											dots: false,
388											responsive: [
389												{
390													breakpoint: 1159,
391													settings: {
392														arrows: false,
393														dots: true
394													}
395												}
396											]
397										}).on('setPosition', function(event, slick) {
398											var currentSlide = curGallery.find('.gallery-list').slick('slickCurrentSlide') + 1;
399											curGallery.find('.gallery-ctrl-current').html(currentSlide);
400										});
401									});
402								});
403
404								$('.to-link').each(function() {
405									var curItem = $(this);
406									curItem.replaceWith('<a href="' + curItem.attr('data-href') + '" target="_blank">' + curItem.html() + '</a>');
407								});
408							});
409						}
410					}
411				}
412				if ((curScroll + curHeight / 2) > (curArticle.offset().top + curArticle.height())) {
413					var nextArticle = curArticle.next();
414					if (nextArticle.length > 0) {
415						curArticle.removeClass('active');
416						nextArticle.addClass('active').removeClass('next');
417						curInifinity.data('loading', false);
418					}
419				}
420			}
421			var visibleArticle = curInifinity.find('.article-infinity-item').eq(0);
422			curInifinity.find('.article-infinity-item').each(function() {
423				var checkArticle = $(this);
424				if ((curScroll + curHeight / 2) > (checkArticle.offset().top)) {
425					visibleArticle = checkArticle;
426				}
427			});
428			var visibleTitle = visibleArticle.attr('data-title');
429			var visibleURL = visibleArticle.attr('data-url');
430			if ($('title').text() != visibleTitle) {
431				if (typeof (history.pushState) != 'undefined') {
432					history.pushState(null, null, visibleURL);
433					$('title').text(visibleTitle);
434				}
435			}
436		});
437	}
438
439	$('.to-link').each(function() {
440		var curItem = $(this);
441		curItem.replaceWith('<a href="' + curItem.attr('data-href') + '" target="_blank">' + curItem.html() + '</a>');
442	});
443
444	window.setInterval(function(e) {
445		$('.main-big:visible').each(function() {
446            if ($(this).find('.main-big-type').length == 1) {
447                $(this).find('.main-big-type-links').css({'top': $(this).find('.main-big-type').offset().top - $(this).offset().top, 'opacity': 1});
448                $(this).find('.main-big-type').css({'opacity': 0});
449            }
450		});
451
452		$('.main-mini').each(function() {
453			if ($(this).find('.main-mini-type').length > 0) {
454				$(this).find('.main-mini-type-links').css({'top': $(this).find('.main-mini-type').offset().top - $(this).offset().top, 'opacity': 1});
455				$(this).find('.main-mini-type').css({'opacity': 0});
456			}
457		});
458
459		$('.page-404-tab-item').each(function() {
460			$(this).find('.main-mini-type-links').css({'top': $(this).find('.main-mini-type').offset().top - $(this).offset().top, 'opacity': 1});
461			$(this).find('.main-mini-type').css({'opacity': 0});
462		});
463
464		$('.category-wrap').each(function() {
465			$(this).find('.category-content-type-links').css({'top': $(this).find('.category-content-type').offset().top - $(this).offset().top, 'opacity': 1});
466			$(this).find('.category-content-type').css({'opacity': 0});
467		});
468	}, 100);
469
470	$('body').on('click', '.article-info-item-authors span', function() {
471		if ($(this).hasClass('open')) {
472			$(this).removeClass('open');
473		} else {
474			$('.article-info-item-authors span.open').removeClass('open');
475			$(this).addClass('open');
476			if ($(window).width() < 1160) {
477				var curBlock = $(this).find('strong');
478				curBlock.css({'transform': 'none'});
479				if (curBlock.offset().left < 0) {
480					curBlock.css({'transform': 'translateX(' + (-curBlock.offset().left) + 'px)'});
481				}
482				if ((curBlock.offset().left + curBlock.outerWidth()) > $(window).width()) {
483					curBlock.css({'transform': 'translateX(' + ($(window).width() - (curBlock.offset().left + curBlock.outerWidth())) + 'px)'});
484				}
485			}
486		};
487	});
488
489	$(document).click(function(e) {
490		if ($(e.target).parents().filter('.article-info-item-authors span').length == 0 && !($(e.target).parent().hasClass('article-info-item-authors'))) {
491			$('.article-info-item-authors span.open').removeClass('open');
492		}
493	});
494
495	$('body').on('click', '.main-partners-item > a', function(e) {
496		if ($(window).width() < 1170) {
497			var curBlock = $(this).parent();
498			if (curBlock.find('.main-partners-item-window').length > 0) {
499				if (curBlock.hasClass('open')) {
500					curBlock.removeClass('open');
501				} else {
502					$('.main-partners-item.open').removeClass('open');
503					curBlock.addClass('open');
504				}
505				e.preventDefault();
506			}
507		}
508	});
509
510	$('body').on('click', '.main-partners-item-window-close', function(e) {
511		$('.main-partners-item.open').removeClass('open');
512		e.preventDefault();
513	});
514
515	$(document).click(function(e) {
516		if ($(e.target).parents().filter('.main-partners-item').length == 0) {
517			$('.main-partners-item.open').removeClass('open');
518		}
519	});
520
521	$('.guide-sort-title').click(function() {
522		$('.guide-sort').toggleClass('open');
523	});
524
525	$('.guide-filter-dropdown-current').click(function() {
526		$('.guide-filter-dropdown-current').toggleClass('open');
527		$('.guide-filter-dropdown-list').toggleClass('open');
528	});
529
530	$(document).click(function(e) {
531		if ($(e.target).parents().filter('.guide-sort').length == 0) {
532			$('.guide-sort').removeClass('open');
533		}
534	});
535
536	$('.guide-sort-item a').click(function(e) {
537		var curItem = $(this).parent();
538		var curGroup = curItem.parent();
539		if (!curItem.hasClass('active')) {
540			$('.guide-sort-item.active').removeClass('active');
541			curItem.addClass('active');
542			$('.guide-sort-group.active').removeClass('active');
543			curGroup.addClass('active');
544		} else {
545			curGroup.find('.guide-sort-item').addClass('active dir-active');
546			curItem.removeClass('active dir-active');
547		}
548		$('.guide-sort').removeClass('open');
549		filterGuide();
550		e.preventDefault();
551	});
552
553	$('.guide-filter-search .form-input input').keyup(function() {
554		if ($(window).width() > 1159) {
555			filterGuide();
556		}
557	});
558
559	$('.guide-filter-type-list .form-radio input').change(function() {
560		if ($(window).width() > 1159) {
561			filterGuide();
562		}
563	});
564
565	$('.guide-filter-mobile-link').click(function() {
566		var curWidth = $(window).width();
567		var curScroll = $(window).scrollTop();
568		$('.wrapper').data('curScroll', curScroll);
569		$('html').addClass('guide-filter-open');
570		if (curWidth < 480) {
571			curWidth = 480;
572		}
573		$('meta[name="viewport"]').attr('content', 'width=' + curWidth);
574	});
575
576	$('.guide-filter-mobile-close').click(function(e) {
577		$('html').removeClass('guide-filter-open');
578		$('meta[name="viewport"]').attr('content', 'width=device-width');
579		$(window).scrollTop($('.wrapper').data('curScroll'));
580		e.preventDefault();
581	});
582
583	$('.guide-filter-mobile-reset').click(function(e) {
584		$('.guide-filter-search .form-input input').val('');
585		$('.guide-filter-type-list .form-radio input').eq(0).prop('checked', true);
586		e.preventDefault();
587	});
588
589	$('.guide-filter-submit a').click(function(e) {
590		$('.guide-filter-mobile-close').trigger('click');
591		filterGuide();
592		e.preventDefault();
593	});
594
595	$('.guide-filter form').each(function() {
596		var curForm = $(this);
597		var validator = curForm.validate();
598		if (validator) {
599			validator.destroy();
600		}
601		curForm.validate({
602			ignore: '',
603			submitHandler: function(form) {
604				filterGuide();
605			}
606		});
607	});
608
609	$('body').on('click', '.guide-list-container .pager a', function(e) {
610		var curLink = $(this);
611		if (!curLink.hasClass('active')) {
612			$('.guide-list-container .pager a.active').removeClass('active');
613			curLink.addClass('active');
614			if (e.originalEvent === undefined) {
615				filterGuide();
616			} else {
617				filterGuide(true);
618			}
619		}
620		e.preventDefault();
621	});
622
623	$('body').on('click', '[data-href]', function(e) {
624		window.location = $(this).attr('data-href');
625		e.preventDefault();
626	});
627
628});
629
630$(window).on('load', function() {
631	if (window.location.hash != '') {
632		var curBlock = $(window.location.hash);
633		if (curBlock.length > 0) {
634			$('html, body').animate({'scrollTop': curBlock.offset().top - $('header').height()}, 100);
635		}
636	}
637});
638
639function popupCenter(url, title) {
640	var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left;
641	var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top;
642	var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
643	var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
644	var left = ((width / 2) - (480 / 2)) + dualScreenLeft;
645	var top = ((height / 3) - (360 / 3)) + dualScreenTop;
646	var newWindow = window.open(url, title, 'scrollbars=yes, width=' + 480 + ', height=' + 360 + ', top=' + top + ', left=' + left);
647	if (window.focus) {
648		newWindow.focus();
649	}
650}
651
652const $html = $('html');
653const $window = $(window);
654const $header = $('header');
655const $headerTop = $('.header-top', $header);
656const $headerInner = $('.header-inner', $header);
657let headerTopHeight = $headerInner.height();
658$window.on('load resize scroll', function() {
659	if (!$html.hasClass('fixed')) {
660		headerTopHeight = $headerInner.height();
661		document.documentElement.style.cssText = `--header-height: ${headerTopHeight}px`;
662	}
663	var curScroll = $window.scrollTop();
664
665	var headerHeight = 132;
666	if ($window.width() < 1160) {
667		headerHeight = 55;
668	}
669	headerHeight = headerTopHeight;
670	if (curScroll > $header.offset().top + headerHeight) {
671		$html.addClass('fixed');
672	} else {
673		$html.removeClass('fixed');
674	}
675
676	$('.banner-side').each(function() {
677		var curBanner = $(this);
678		if (curBanner.hasClass('banner-side-static')) {
679			return;
680		}
681		curBanner.height(curBanner.find('.banner-side-wrap').height());
682		var curSide = curBanner.parent();
683		var curBlock = curSide.parent();
684		var curHeader = 0;
685		if ($html.hasClass('fixed')) {
686			curHeader = $headerInner.height();
687		}
688		if (curScroll + curHeader > curBlock.offset().top + (curSide.offset().top - curBlock.offset().top)) {
689			var newTop = curScroll + curHeader - curBlock.offset().top;
690			var curBottom = 39;
691			if (curBlock.hasClass('main-popular-container')) {
692				curBottom = -16;
693			}
694			if (curBlock.hasClass('main-popular-container') && curBlock.find('.pager').length > 0) {
695				curBottom = -33;
696			}
697			if (curBlock.hasClass('main-news-container') && curBlock.find('.pager').length > 0) {
698				curBottom = 22;
699			}
700			if (curBlock.hasClass('main-news-companies')) {
701				curBottom = 64;
702			}
703			if (curBlock.find('.magazine-archive-list').length > 0) {
704				curBottom = -11;
705			}
706			if (curBlock.find('.magazines-list').length > 0) {
707				curBottom = -3;
708			}
709			if (curBlock.hasClass('project')) {
710				curBottom = -27;
711			}
712			if (curBlock.hasClass('search')) {
713				curBottom = -33;
714			}
715			if (curBlock.find('.publishers-team').length > 0) {
716				curBottom = -28;
717			}
718			if (curBlock.find('.marketing-list').length > 0) {
719				curBottom = -1;
720			}
721			if (curBlock.find('.article-subscribe').length > 0) {
722				curBottom = -25;
723			}
724			if (newTop + curBanner.height() < curBlock.height() + (curSide.offset().top - curBlock.offset().top - curBottom)) {
725				curBanner.css({'top': curHeader, 'position': 'fixed', 'left': curBanner.offset().left});
726			} else {
727				curBanner.css({'top': curBlock.height() - curBanner.height() - curBottom, 'position': 'relative', 'left': 'auto'});
728			}
729		} else {
730			curBanner.css({'top': 'auto', 'position': 'relative', 'left': 'auto'});
731		}
732	});
733
734	if (curScroll > $window.height()) {
735		$('.up-link').addClass('visible');
736	} else {
737		$('.up-link').removeClass('visible');
738	}
739
740	if (curScroll + $window.height() > $('footer').offset().top) {
741		$('.up-link').css({'margin-bottom': (curScroll + $window.height()) - $('footer').offset().top});
742	} else {
743		$('.up-link').css({'margin-bottom': 0});
744	}
745});
746
747$(window).on('resize', function() {
748	$('.form-select select').chosen('destroy');
749	$('.form-select select').chosen({disable_search: true});
750});
751
752$(window).on('load resize', function() {
753	$('.main-calendar-list').each(function() {
754		var curList = $(this);
755
756		curList.find('.main-calendar-item-inner').css({'min-height': '0px'});
757
758		curList.find('.main-calendar-item-inner').each(function() {
759			var curBlock = $(this);
760			var curHeight = curBlock.outerHeight();
761			var curTop = curBlock.offset().top;
762
763			curList.find('.main-calendar-item-inner').each(function() {
764				var otherBlock = $(this);
765				if (otherBlock.offset().top == curTop) {
766					var newHeight = otherBlock.outerHeight();
767					if (newHeight > curHeight) {
768						curBlock.css({'min-height': newHeight + 'px'});
769					} else {
770						otherBlock.css({'min-height': curHeight + 'px'});
771					}
772				}
773			});
774		});
775	});
776
777	if ($(window).width() > 1159) {
778		$('.main-calendar-list, .main-navigator-list, .magazine-archive-years, .page-404-tab-list').each(function() {
779			var curList = $(this);
780			if (curList.hasClass('slick-slider')) {
781				curList.slick('unslick');
782			}
783		});
784	} else {
785		$('.main-calendar-list, .magazine-archive-years, .page-404-tab-list').each(function() {
786			var curList = $(this);
787			if (!curList.hasClass('slick-slider')) {
788				curList.slick({
789					infinite: false,
790					slidesToShow: 1,
791					slidesToScroll: 1,
792					arrows: false,
793					dots: false
794				});
795			}
796		});
797
798		$('.main-navigator-list').each(function() {
799			var curList = $(this);
800			if (!curList.hasClass('slick-slider')) {
801				curList.slick({
802					infinite: false,
803					slidesToShow: 4,
804					slidesToScroll: 4,
805					arrows: false,
806					dots: true,
807					responsive: [
808						{
809							breakpoint: 1024,
810							settings: {
811								slidesToShow: 3,
812								slidesToScroll: 3
813							}
814						},
815						{
816							breakpoint: 767,
817							settings: {
818								slidesToShow: 2,
819								slidesToScroll: 2
820							}
821						}
822					]
823				});
824			}
825		});
826	}
827
828});
829
830function initForm(curForm) {
831	curForm.find('.form-select select').chosen({disable_search: true});
832
833	curForm.find('input.phoneRU').mask('+7 (000) 000-00-00');
834
835	curForm.find('.form-file input').change(function() {
836		var curInput = $(this);
837		var curField = curInput.parent();
838		curField.find('.form-file-name').html(curInput.val().replace(/.*(\/|\\)/, ''));
839		curField.addClass('success');
840	});
841
842	curForm.validate({
843		ignore: '',
844		showErrors: function(errorMap, errorList) {
845			if (curForm.find('.window-policy-checkbox').length > 0) {
846				if (curForm.find('.window-policy-checkbox input').prop('checked')) {
847					curForm.find('.window-policy-error').removeClass('visible');
848					curForm.find('.form-submit .btn').prop('diabled', false).removeClass('disabled');
849				} else {
850					curForm.find('.window-policy-error').addClass('visible');
851					curForm.find('.form-submit .btn').prop('diabled', true).addClass('disabled');
852				}
853				if (this.numberOfInvalids() == 0) {
854					curForm.find('.form-submit .btn').prop('diabled', false).removeClass('disabled');
855				} else {
856					curForm.find('.form-submit .btn').prop('diabled', true).addClass('disabled');
857				}
858			}
859			this.defaultShowErrors();
860		},
861		submitHandler: function(form) {
862			if ($(form).hasClass('ajax-form')) {
863				var formData = new FormData(form);
864
865				if ($(form).find('[type=file]').length != 0) {
866					var file = $(form).find('[type=file]')[0].files[0];
867					formData.append('file', file);
868				}
869
870				windowOpen($(form).attr('action'), formData);
871			} else {
872				form.submit();
873			}
874		}
875	});
876}
877
878function windowOpen(linkWindow, dataWindow) {
879	if ($('html').hasClass('menu-open')) {
880		$('.wrapper').css({'top': 'auto'});
881		$('html').removeClass('menu-open');
882		$(window).scrollTop($('.wrapper').data('curScroll'));
883	}
884
885	if ($('.window').length > 0) {
886		windowClose();
887	}
888
889	var curPadding = $('.wrapper').width();
890	var curWidth = $(window).width();
891	if (curWidth < 480) {
892		curWidth = 480;
893	}
894	var curScroll = $(window).scrollTop();
895	$('html').addClass('window-open');
896	curPadding = $('.wrapper').width() - curPadding;
897	$('body').css({'margin-right': curPadding + 'px'});
898	$('body').append('<div class="window"><div class="window-loading"></div></div>')
899	$('.wrapper').css({'top': -curScroll});
900	$('.wrapper').data('curScroll', curScroll);
901	$('meta[name="viewport"]').attr('content', 'width=' + curWidth);
902
903	$.ajax({
904		type: 'POST',
905		url: linkWindow,
906		processData: false,
907		contentType: false,
908		dataType: 'html',
909		data: dataWindow,
910		cache: false
911	}).done(function(html) {
912		$('.window').append('<div class="window-container window-container-preload"><div class="window-content">' + html + '<a href="#" class="window-close"></a></div></div>')
913
914		windowPosition();
915
916		$('.window-container-preload').removeClass('window-container-preload');
917
918		$('.window form').each(function() {
919			initForm($(this));
920		});
921
922		$('.window #activity-other').each(function() {
923			if ($(this).prop('checked')) {
924				$('#activity-other-text').addClass('visible');
925			} else {
926				$('#activity-other-text').removeClass('visible');
927			}
928		});
929
930	});
931}
932
933function windowPosition() {
934	if ($('.window').length > 0) {
935		$('.window-container').css({'left': '50%', 'margin-left': -$('.window-container').width() / 2});
936
937		$('.window-container').css({'top': '50%', 'margin-top': -$('.window-container').height() / 2, 'padding-bottom': 0});
938		if ($('.window-container').height() > $('.window').height() - 80) {
939			$('.window-container').css({'top': 40, 'margin-top': 0, 'padding-bottom': 40});
940		}
941	}
942}
943
944function windowClose() {
945	if ($('.window').length > 0) {
946		$('.window').remove();
947		$('html').removeClass('window-open');
948		$('body').css({'margin-right': 0});
949		$('.side-developer, .side-copyrights').css({'margin-right': 0});
950		$('.wrapper').css({'top': 0});
951		$(window).scrollTop($('.wrapper').data('curScroll'));
952		$('meta[name="viewport"]').attr('content', 'width=device-width');
953	}
954}
955
956var arr = document.querySelectorAll('img.lzy_img');
957
958if ('IntersectionObserver' in window) {
959	document.addEventListener('DOMContentLoaded', function() {
960
961		const imageObserver = new IntersectionObserver(function(entries, imgObserver) {
962			entries.forEach(function(entry) {
963				if (entry.isIntersecting) {
964					const lazyImage = entry.target
965					lazyImage.src = lazyImage.dataset.src
966					lazyImage.classList.remove('lzy_img');
967					imgObserver.unobserve(lazyImage);
968				}
969			})
970		});
971		for (var i = 0; i < arr.length; i++) {
972			imageObserver.observe(arr[i]);
973		}
974	})
975} else {
976	for (var i = 0; i < arr.length; i++) {
977		var lazyImage = arr[i];
978		lazyImage.src = lazyImage.dataset.src
979		lazyImage.classList.remove('lzy_img');
980	}
981}
982
983function filterGuide(isScroll) {
984	$('.guide-list-container').addClass('loading');
985	var curForm = $('.guide-filter form');
986	var curData = curForm.serialize();
987	curData += '&PAGEN_1=' + $('.pager a.active').attr('data-value'); // customfix - PAGEN_1
988	curData += '&sort=' + $('.guide-sort-item.active').attr('data-value') + '&sortdir=' + $('.guide-sort-item.active').attr('data-dir');
989	var countParameters = 0;
990	if ($('.guide-filter-search .form-input input').val() != '') {
991		countParameters++;
992	}
993	if (!$('.guide-filter-type .form-radio input').eq(0).prop('checked')) {
994		countParameters++;
995	}
996	$('.guide-filter-mobile-link span').remove();
997	if (countParameters > 0) {
998		$('.guide-filter-mobile-link').append('<span>' + countParameters + '</span>');
999	}
1000	$.ajax({
1001		type: 'POST',
1002		url: curForm.attr('action'),
1003		dataType: 'html',
1004		data: curData,
1005		cache: false
1006	}).done(function(html) {
1007		$('.guide-list-container .main-news-list').html($(html).find('.main-news-list').html());
1008		$('.guide-list-container .pager').html($(html).find('.pager').html());
1009
1010		// customfix
1011		if ( $( html ).find( '.pager' ).length )
1012		{
1013			$( '.guide-list-container .pager' ).show();
1014		}
1015		else
1016		{
1017			$( '.guide-list-container .pager' ).hide();
1018		}
1019		//----------
1020
1021
1022		// customfix
1023
1024		/*$('.guide-header-status-from').html($(html).find('.main-news-list').attr('data-statusfrom'));
1025		$('.guide-header-status-to').html($(html).find('.main-news-list').attr('data-statusto'));
1026		$('.guide-header-status-count').html($(html).find('.main-news-list').attr('data-statuscount'));*/
1027
1028		if ( $( html ).find( '.pager' ).length )
1029		{
1030			$('.guide-header-status-from').html($(html).find('.pager').attr('data-statusfrom'));
1031			$('.guide-header-status-to').html($(html).find('.pager').attr('data-statusto'));
1032			$('.guide-header-status-count').html($(html).find('.pager').attr('data-statuscount'));
1033		}
1034		else
1035		{
1036			var itemsCount = $( '.main-news-item' ).length;
1037
1038			if ( itemsCount )
1039			{
1040				$('.guide-header-status-from').html(1);
1041			}
1042			else
1043			{
1044				$('.guide-header-status-from').html(0);
1045			}
1046
1047			$('.guide-header-status-to').html(itemsCount);
1048			$('.guide-header-status-count').html(itemsCount);
1049		}
1050
1051
1052		//----------
1053
1054
1055		$('.guide-list-container').removeClass('loading');
1056		if (isScroll) {
1057			$('html, body').animate({'scrollTop': $('.guide-filter').offset().top});
1058		}
1059	});
1060}
1061
1062
1063$(document).ready(function() {
1064
1065    $('.menu-section-list-business-title span').click(function(e) {
1066        $(this).parent().parent().toggleClass('open');
1067        e.preventDefault();
1068    });
1069    
1070    $('.magazine-archive-item').mouseenter(function() {
1071        const curItem = $(this);
1072        let newHeight = curItem.outerHeight() + 40;
1073        if (curItem.outerHeight() < curItem.find('.magazine-archive-item-preview-text').outerHeight() + 59) {
1074            newHeight = curItem.find('.magazine-archive-item-preview-text').outerHeight() + 59 + 40;
1075        }
1076        curItem.find('.magazine-archive-item-bg').css({'height': newHeight});
1077    });
1078
1079    $('.magazine-archive-item-contain-title span').click(function(e) {
1080        let curWidth = $(window).width();
1081        if (curWidth < 1160) {
1082            if (curWidth < 480) {
1083                curWidth = 480;
1084            }
1085            const curScroll = $(window).scrollTop();
1086            $('html').addClass('magazine-archive-item-mobile-open');
1087            $('.wrapper').css({'top': -curScroll});
1088            $('.wrapper').data('curScroll', curScroll);
1089            $('meta[name="viewport"]').attr('content', 'width=' + curWidth);
1090            $(this).parents().filter('.magazine-archive-item').addClass('mobile-open');
1091        }
1092    });
1093
1094    $('.magazine-archive-item-preview-text-close').click(function(e) {
1095        if ($('html').hasClass('magazine-archive-item-mobile-open')) {
1096            $('html').removeClass('magazine-archive-item-mobile-open');
1097            $('.wrapper').css({'top': 0});
1098            $(window).scrollTop($('.wrapper').data('curScroll'));
1099            $('meta[name="viewport"]').attr('content', 'width=device-width');
1100            $('.magazine-archive-item.mobile-open').removeClass('mobile-open');
1101        }
1102    });
1103
1104});

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.