PageSourceSearch

https://xn--80auifgidwa.xn--p1ai/t/v33/images/js/title.js

js xn--80auifgidwa.xn--p1ai collected 2026-10-05 00:20:44 UTC 82,531 bytes, 2,697 lines download raw bytes

1;(function($) {
2	// wrap tables in content for swipe on mobile devices
3	$(function() {
4		var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(navigator.userAgent);
5
6		$('article.content').find('table').wrap('<div class="for-mobile-view"></div>');
7
8		if(isMobile){
9			$('html').addClass('mobile');
10		}
11
12	});
13}(jQuery));$(function () {
14	$(document).click(function (event) {
15		$('.contacts-block').each(function() {
16			if ($(event.target).closest($(this)).length) {
17				return;
18			} else {
19				$(this).find('.tgl-but').prop("checked", false);
20				$(this).find('.icon').removeClass('active');
21			}
22		});
23	});
24
25	function setMargin($block) {
26		if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
27			$block.find(".block-body-drop").css({
28				"margin-left": "0px"
29			});
30		} else {
31			var left = $block.offset().left * -1;
32			$block.find(".block-body-drop").css({
33				"margin-left": left + "px"
34			});
35		}
36	}
37
38	$('.contacts-block').each(function() {
39		var $block = $(this),
40			allClasses = $block.attr("class").split(" "),
41			mainClass = allClasses[0],
42			mainSelector = ".side-panel ."+mainClass+" .block-body-drop",
43			styles = document.styleSheets;
44
45		for(var i = 0; i < styles.length; i++) {
46			if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
47				for(var j = 0; j < styles[i].cssRules.length; j++) {
48					if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
49						$block.data("fullwidth", 1);
50						setMargin($block);
51						break;
52					}
53				}
54				break;
55			}
56		}
57	});
58
59	$(window).resize(function() {
60		$('.contacts-block').each(function() {
61			var $block = $(this);
62			if ($block.data("fullwidth") == 1) {
63				setMargin($block);
64			}
65		});
66	});
67
68	$('.contacts-block').each(function() {
69		var $block = $(this);
70		$block.find('.icon').click(function() {
71			if ($block.data("fullwidth") == 1) {
72				setMargin($block);
73			}
74			if ($block.find('.tgl-but').prop("checked")) {
75				$(this).removeClass('active');
76			} else {
77				$(this).addClass('active');
78			}
79		});
80	});
81});
82$(function () {
83	$(document).click(function (event) {
84		$('.contacts-block').each(function() {
85			if ($(event.target).closest($(this)).length) {
86				return;
87			} else {
88				$(this).find('.tgl-but').prop("checked", false);
89				$(this).find('.icon').removeClass('active');
90			}
91		});
92	});
93
94	function setMargin($block) {
95		if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
96			$block.find(".block-body-drop").css({
97				"margin-left": "0px"
98			});
99		} else {
100			var left = $block.offset().left * -1;
101			$block.find(".block-body-drop").css({
102				"margin-left": left + "px"
103			});
104		}
105	}
106
107	$('.contacts-block').each(function() {
108		var $block = $(this),
109			allClasses = $block.attr("class").split(" "),
110			mainClass = allClasses[0],
111			mainSelector = ".side-panel ."+mainClass+" .block-body-drop",
112			styles = document.styleSheets;
113
114		for(var i = 0; i < styles.length; i++) {
115			if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
116				for(var j = 0; j < styles[i].cssRules.length; j++) {
117					if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
118						$block.data("fullwidth", 1);
119						setMargin($block);
120						break;
121					}
122				}
123				break;
124			}
125		}
126	});
127
128	$(window).resize(function() {
129		$('.contacts-block').each(function() {
130			var $block = $(this);
131			if ($block.data("fullwidth") == 1) {
132				setMargin($block);
133			}
134		});
135	});
136
137	$('.contacts-block').each(function() {
138		var $block = $(this);
139		$block.find('.icon').click(function() {
140			if ($block.data("fullwidth") == 1) {
141				setMargin($block);
142			}
143			if ($block.find('.tgl-but').prop("checked")) {
144				$(this).removeClass('active');
145			} else {
146				$(this).addClass('active');
147			}
148		});
149	});
150});
151/*
152 *  wmS3Menu v1.0.0
153 *  K.I. 433
154 */
155;(function ($, window, document, undefined ) {
156	var pluginName = 'wmS3Menu',
157		defaults = {
158			screenButton: false,
159			responsiveTl: false,
160			responsiveTp: false,
161			responsiveMl: false,
162			moreText: '...',
163			childIcons: false,
164			childIconsClass: 'has-child-icon'
165		};
166	// Проверка на касание
167	var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
168	var $win = $(window);
169	var winWidth = $win.width();
170	var $doc = $(document);
171
172	var pluginObj = {
173		_events: {
174			hover: function(menuWrap, item, settings){
175				var link = item.find('> a');
176				var linkIcon = link.find('.' + settings.childIconsClass);
177				var iconLen = linkIcon.length;
178				var subMenu = item.find('> ul');
179				var showTimeout;
180				// Отображение
181				function menuShow() {
182					clearTimeout(showTimeout);
183					item.siblings().find('> ul').css('display', '');
184					// Определение положения выпадашки чтобы не выводилось за пределы окна
185					pluginObj._menuPosition(subMenu);
186
187					link.addClass('hover');
188					if (iconLen) {
189						linkIcon.addClass('hover');
190					}
191				}
192				// Скрытие
193				function menuHide() {
194					showTimeout = setTimeout(function(){
195						link.removeClass('hover');
196						subMenu.css('display', '');
197						if (iconLen) {
198							linkIcon.removeClass('hover');
199						}
200					}, 500);
201				}
202				// Отключение и подключение событий
203				item.off({
204					'mouseenter.wmS3Menu': menuShow,
205					'mouseleave.wmS3Menu': menuHide
206				});
207				item.on({
208					'mouseenter.wmS3Menu': menuShow,
209					'mouseleave.wmS3Menu': menuHide
210				});
211			},
212			click: function(menuWrap, item, settings){
213				var link = item.find('> a');
214				var linkIcon = link.find('.' + settings.childIconsClass);
215				var iconLen = linkIcon.length;
216				var subMenu = item.find('> ul');
217				// Переключение отображения
218				function menuToggle() {
219					if (subMenu.is(':visible')) {
220						if (isTouchable) {
221							document.location = link.attr('href');
222						}
223						link.removeClass('hover');
224						subMenu.css('display', '');
225						item.removeClass('submenu-opened');
226						if (iconLen) {
227							linkIcon.removeClass('hover');
228						}
229					} else {
230						item.siblings().find('> ul').css('display', '');
231						item.siblings().find('> a').removeClass('hover');
232						item.siblings().find('> a .' + settings.childIconsClass).removeClass('hover');
233						// Определение положения выпадашки чтобы не выводилось за пределы окна
234						pluginObj._menuPosition(subMenu);
235
236						link.addClass('hover');
237						item.addClass('submenu-opened');
238						if (iconLen) {
239							linkIcon.addClass('hover');
240						}
241					}
242					return false;
243				}
244				// Отключение и подключение событий
245				link.off('click.wmS3Menu');
246				link.on('click.wmS3Menu', menuToggle);
247			},
248			click_tree: function(menuWrap, item, settings){
249				var link = item.find('> a');
250				var linkIcon = link.find('.' + settings.childIconsClass);
251				var subMenu = item.find('> ul');
252				// Переключение отображения
253				function menuToggle(event) {
254					var targ = $(event.target);
255
256					if (targ.closest(linkIcon).length) {
257						if (subMenu.is(':visible')) {
258							link.removeClass('hover');
259							subMenu.css('display', '');
260							item.removeClass('submenu-opened');
261							linkIcon.removeClass('hover');
262						} else {
263							// Определение положения выпадашки чтобы не выводилось за пределы окна
264							pluginObj._menuPosition(subMenu);
265
266							link.addClass('hover');
267							item.addClass('submenu-opened');
268							linkIcon.addClass('hover');
269						}
270						return false;
271					}
272				}
273				// Отключение и подключение событий
274				link.off('click.wmS3Menu');
275				link.on('click.wmS3Menu', menuToggle);
276			}
277		},
278		_menuPosition: function(subMenu) {
279			// Определение положения выпадашки чтобы не выводилось за пределы окна
280			winWidth = $win.width();
281
282			subMenu.css('display', 'block');
283
284			if (subMenu.parent().hasClass('first-level') === false) {
285				subMenu.css({
286					'visibility': 'hidden',
287					'opacity': 0
288				});
289
290				var menuRect = subMenu[0].getBoundingClientRect();
291				var marginR = parseInt(subMenu.css('margin-right'));
292				var parentWidth = subMenu.parent().width();
293
294				if (marginR > parentWidth) {
295					subMenu.css('margin-right', parentWidth);
296				}
297
298				if (menuRect.right >= winWidth) {
299					subMenu.css({
300						'left': '-100%',
301						'margin-left': 0
302					});
303				}
304				subMenu.css({
305					'visibility': '',
306					'opacity': ''
307				});
308			}
309		}
310	};
311	function Plugin(element, options) {
312		this.element = element;
313
314		this.options = $.extend({}, defaults, options, $(this.element).data()) ;
315
316		this._defaults = defaults;
317		this._name = pluginName;
318
319		this.init();
320	}
321	Plugin.prototype = {
322		init: function () {
323			var settings = this.options;
324			// Определение ширины медиа
325			var moreButFlag = false;
326			if (window.matchMedia('all and (max-width: 480px)').matches) {
327				moreButFlag = settings.responsiveMl;
328			} else if (window.matchMedia('all and (max-width: 640px)').matches) {
329				//moreButFlag = settings.responsiveTp;
330			} else if (window.matchMedia('all and (max-width: 768px)').matches) {
331				moreButFlag = settings.responsiveTl;
332			} else {
333				moreButFlag = settings.screenButton;
334			}
335			// Обертка меню
336			var menuWrap = $(this.element);
337			var menuClass = menuWrap.attr('class');
338			var menuMainUl = $(this.element.querySelector('ul'));
339			var widgetClass = menuClass.match(/widget-\d+/)[0];
340			// Проверка на наличие меню в Side panel
341			if (window.side_panel_controller && side_panel_controller.inPanel(widgetClass)) {
342				moreButFlag = false;
343			}
344
345			menuMainUl.children().addClass('first-level');
346			// Настройки для горизонтального меню
347			if (!!menuClass.match(/horizontal/i)) {
348				var menuWidth = menuMainUl.width();
349				var itemsWidth = 0, hideArr = [], hideLength;
350				// Кнопка More
351				var moreBut = menuMainUl.find('.more-button');
352				if (!moreBut.length) {
353					moreBut = $('<li class="more-button"><a href="#"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click"
354					menuMainUl.append(moreBut);
355				}
356				// Меню More
357				var moreMenu = moreBut.find('> ul');
358				if (!moreMenu.length) {
359					moreMenu = $('<ul></ul>');
360					moreBut.append(moreMenu);
361				}
362
363				moreBut.removeClass('removed').attr('data-trigger', 'hover');
364				menuMainUl.children().css('display', '');
365
366				var firstLevelItems = menuMainUl.children(':visible').not('.more-button');
367				moreMenu.html('');
368
369				if (moreButFlag === 'more' || moreButFlag === 'button') {
370					moreBut.removeClass('disabled');
371
372					menuWidth -= moreBut.outerWidth();
373
374					firstLevelItems.each(function(){
375						var thisItem = $(this);
376						itemsWidth += thisItem.outerWidth(true);
377						if (itemsWidth >= menuWidth) {
378							hideArr.push(thisItem.clone());
379							thisItem.hide();
380						}
381					});
382
383					hideLength = hideArr.length;
384					if (hideLength) {
385						for (var ind = 0; ind < hideLength; ind++) {
386							moreMenu.append(hideArr[ind]);
387						}
388						moreBut.removeClass('disabled');
389					} else {
390						moreBut.addClass('disabled');
391					}
392				} else {
393					moreBut.addClass('disabled');
394				}
395			}
396			// Вложенные подуровни меню
397			var menuInner = menuMainUl.find('ul');
398			var menuItems = menuInner.parent();
399			var menuLinks = menuItems.find('> a');
400			// Стрелочки для подуровней
401			var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass);
402			var childIconLen = menuLinksIcons.length;
403			// Тип отображения меню
404			var mShow = 'popup';
405			if (!!menuClass.match(/dropdown/i)) {
406				mShow = 'dropdown';
407			} else if (!!menuClass.match(/treemenu/i)) {
408				mShow = 'treemenu';
409			}
410			if (mShow === 'popup') {
411				menuInner.hide();
412			}
413			if (childIconLen) {
414				menuLinksIcons.remove();
415			}
416			if (!!settings.childIcons) {
417				// Добавление стрелочек для подуровней
418				var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>';
419
420				if (mShow === 'treemenu') {
421					childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>';
422				}
423
424				var childIconTag = $(childIconHTML);
425				menuLinks.append(childIconTag.clone());
426
427				menuLinksIcons = menuLinks.find('.' + settings.childIconsClass);
428				childIconLen = menuLinksIcons.length;
429			}
430			// Удаление всех событий на ссылках
431			menuLinks.removeClass('hover').off('click.wmS3Menu');
432			menuInner.css('display', '');
433			if (childIconLen) {
434				menuLinksIcons.removeClass('hover');
435			}
436
437			menuItems.each(function() {
438				var thisItem = $(this);
439				var trigger = thisItem.data('trigger') || 'hover';
440
441				if (mShow === 'dropdown' || isTouchable) {
442					trigger = 'click';
443				} else if (mShow === 'treemenu') {
444					trigger = 'click_tree';
445				}
446				pluginObj._events[trigger](menuWrap, thisItem, settings);
447			});
448			// Клик по документу
449			if (isTouchable) {
450				function docClick(e) {
451					var target = $(e.target);
452					if (target.closest(menuWrap).length === 0) {
453						menuLinks.removeClass('hover');
454						menuInner.css('display', '');
455						menuItems.removeClass('submenu-opened');
456
457						if (childIconLen) {
458							menuLinksIcons.removeClass('hover');
459						}
460					}
461				}
462				$doc.off('touchstart.wmS3Menu', docClick);
463				$doc.on('touchstart.wmS3Menu', docClick);
464			}
465		},
466		update: function () {
467			this.init();
468		}
469	};
470	if (!$.fn[pluginName]) {
471		$.fn[pluginName] = function (options) {
472			var args = arguments;
473			if (options === undefined || typeof options === 'object') {
474				return this.each(function () {
475					if (!$.data(this, 'plugin_' + pluginName)) {
476						$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
477					}
478				});
479			} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
480				var returns;
481				this.each(function () {
482					var instance = $.data(this, 'plugin_' + pluginName);
483					if (instance instanceof Plugin && typeof instance[options] === 'function') {
484						returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
485					}
486					if (options === 'destroy') {
487						$.data(this, 'plugin_' + pluginName, null);
488					}
489				});
490				return returns !== undefined ? returns : this;
491			}
492		};
493	}
494	$(function () {
495		var wmMenuWrap = $('.wm-widget-menu.horizontal');
496		wmMenuWrap[pluginName]();
497
498		$win.on('resize.wmS3Menu', function(){
499			wmMenuWrap[pluginName]('update');
500		});
501	});
502
503	setTimeout(function(){
504		$win.trigger('resize');
505	}, 500);
506}(jQuery, window, document));
507$(function() {
508	var $search = $('.wm-search');
509
510	var debounce = (function () {
511		return function (fn, time) {
512			var timer, func;
513			func = function() {
514				var args = [].slice.call(arguments, 0);
515				window.clearTimeout(timer);
516				timer = window.setTimeout(function () {
517					window.requestAnimationFrame && window.requestAnimationFrame(function() {
518						fn.apply(null, args);
519					}) || fn.apply(null, args);
520				}, time)
521			};
522			return func;
523		}
524	}());
525
526	function init() {
527		$search.each(function() {
528			var $this = $(this),
529				options = {};
530			var curMedia = $this.attr('data-setting-media');
531			if ($this.attr('data-setting-animate_list')) {
532				var media_type,
533					body_width = $('body').width();
534				var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"];
535				var media_ind, animate_list_arr;
536
537
538				if (body_width >= 961) {
539					media_type = "screen";
540				} else if (body_width <= 960 && body_width >= 769) {
541					media_type = "tablet_landscape";
542				} else if (body_width <= 768 && body_width >= 641) {
543					media_type = "tablet_portrait";
544				} else if (body_width <= 640 && body_width >= 481) {
545					media_type = "mobile_landscape";
546				} else if (body_width <= 480) {
547					media_type = "mobile_portrait";
548				}
549
550				media_ind = mediaList.indexOf(media_type);
551				animate_list_arr = $this.attr('data-setting-animate_list').split(",");
552
553				options.animation = $this.attr('data-setting-type');
554				if(curMedia != media_type) {
555					if (animate_list_arr[media_ind] == 1) {
556						$this.attr('data-setting-media', media_type);
557						$this.find('.wm-search-inner').wmSearch(options);
558					} else {
559						$this.find('.wm-search-inner').wmSearch('destroy');
560					}
561				}
562			}
563		});
564	}
565
566	$(window).on('resize', debounce(init, 300));
567
568	init();
569
570});
571(function($) {
572	function getInternetExplorerVersion(){
573		var rv = -1;
574		if (navigator.appName == 'Microsoft Internet Explorer')	{
575			var ua = navigator.userAgent;
576			var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
577			if (re.exec(ua) != null)
578				rv = parseFloat( RegExp.$1 );
579		} else if (navigator.appName == 'Netscape')	{
580			var ua = navigator.userAgent;
581			var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
582			if (re.exec(ua) != null)
583				rv = parseFloat( RegExp.$1 );
584		}
585		return rv;
586	}
587
588	$.fn.wmSearch = function(options){
589		if (options === 'destroy') {
590			return this.each(function () {
591				var $this = $(this);
592				var inp = $this.find('input[name=search]');
593				var search_but = $this.find('button');
594				var $wrap = $this.parent('div');
595
596				$this.css('justify-content','flex-start');
597				$wrap.css('visibility','visible');
598				search_but.css('visibility','visible');
599				inp.stop(true).show().css({
600					'opacity': '',
601					'max-width':''
602				});
603
604				if ($this.data('wm_search')) {
605					search_but.off('.' + $this.data('wm_search'));
606					$(document).off('.' + $this.data('wm_search'));
607					$this.removeData('wm_search');
608				}
609			});
610		} else {
611			var defaults = $.extend({
612				animation : 'fade'
613			}, options);
614
615			return this.each(function () {
616				var clss = 'wm_search_' + Date.now();
617				var $this = $(this);
618				var inp = $this.find('input[name=search]');
619				var search_but = $this.find('button');
620				var $wrap = $this.parent('div');
621
622				$this.css('justify-content','flex-end');
623				$wrap.css('visibility','hidden');
624				search_but.css('visibility','visible');
625
626				if ($this.data('wm_search')) {
627					return;
628				}
629
630
631				if (defaults.animation == 'slide') {
632					var iebrw = getInternetExplorerVersion();
633					if (iebrw == 9 || iebrw == 10 || iebrw == 11) {
634						inp.hide();
635						search_but.on('click.' + clss, function () {
636							var wrapVis = $wrap.css('visibility');
637							if(wrapVis=="hidden"){
638								$wrap.css('visibility','visible');
639								inp.fadeIn().focus();
640								return false;
641							}
642						});
643
644						$(document).on('click.' + clss, function(event){
645							if( $(event.target).closest('.wm-search-inner').length )
646								return;
647							inp.fadeOut();
648							$wrap.css('visibility','hidden');
649							event.stopPropagation();
650						});
651					} else {
652						inp.css({
653							'max-width':'0px',
654							'opacity':'0'
655						});
656						search_but.on('click.' + clss, function () {
657							var wrapVis = $wrap.css('visibility');
658							if(wrapVis=="hidden"){
659								$wrap.css('visibility','visible');
660								inp.addClass('slide_search').css({
661									'opacity': '1',
662									'max-width':'100%'
663								}).focus();
664								return false;
665							}
666
667						});
668						$(document).on('click.' + clss, function(event){
669							if( $(event.target).closest('.wm-search-inner').length )
670								return;
671							inp.css({
672								'opacity': '0',
673								'max-width':'0'
674							});
675							$wrap.css('visibility','hidden');
676							event.stopPropagation();
677						});
678					}
679				} else {
680					search_but.on('click.' + clss, function () {
681						var wrapVis = $wrap.css('visibility');
682						if(wrapVis=="hidden"){
683							$wrap.css('visibility','visible');
684							inp.fadeIn().focus();
685							return false;
686						}
687					});
688					inp.hide();
689					$(document).on('click.' + clss, function(event){
690						if( $(event.target).closest('.wm-search-inner').length )
691							return;
692						inp.fadeOut();
693						$wrap.css('visibility','hidden');
694						event.stopPropagation();
695					});
696				}
697
698				$this.data('wm_search', clss);
699
700			});
701		}
702	}
703})(jQuery);
704;(function(window, document) {
705    if (!window.photoSwipeSettings) {
706        window.photoSwipeSettings = {};
707    }
708
709    var psSettings = window.photoSwipeSettings;
710
711    function initPhotoSwipeFunc(settings) {
712        if (!settings.preloadImages) {
713            settings.preloadImages = false;
714        }
715
716        var settingsKeys = Object.keys(psSettings);
717
718        if (settingsKeys.length) {
719            settingsKeys.forEach(function(key) {
720                if (key !== 'hashData') {
721                    psSettings[key].push(settings[key]);
722                }
723            });
724        } else {
725            Object.keys(settings).forEach(function(key) {
726                psSettings[key] = [];
727
728                psSettings[key].push(settings[key]);
729            });
730        }
731
732        var galleryIteration = 0;
733
734        psSettings.gallery.forEach(function(str){
735            if (str === settings.gallery) {
736                galleryIteration++;
737            }
738            var index = psSettings.gallery.indexOf(settings.gallery);
739
740            if (galleryIteration > 1) {
741                settingsKeys.forEach(function(key) {
742                    if (key !== 'hashData') {
743                        psSettings[key].splice(index, 1);
744                    }
745                });
746                galleryIteration = 0;
747            }
748        });
749
750        if (!psSettings.hashData) {
751            psSettings.hashData = photoswipeParseHash();
752        }
753
754        var hashData = psSettings.hashData;
755        var hashDataKeys = Object.keys(hashData);
756
757        if (hashDataKeys.length) {
758            settings.preloadImages = true;
759        }
760
761        var galleryElements = document.querySelectorAll(psSettings.gallery.join(','));
762        var galleryLength = galleryElements.length;
763
764        var pswpHTML = '<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"><div class="pswp__bg"></div><div class="pswp__scroll-wrap"><div class="pswp__container"><div class="pswp__item"></div><div class="pswp__item"></div><div class="pswp__item"></div></div><div class="pswp__ui pswp__ui--hidden"><div class="pswp__top-bar"><div class="pswp__counter"></div><button class="pswp__button pswp__button--close" title="Close (Esc)"></button>';
765        var pswpHTMLEnd = '<div class="pswp__preloader"><div class="pswp__preloader__icn"><div class="pswp__preloader__cut"><div class="pswp__preloader__donut"></div></div></div></div></div><div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"><div class="pswp__share-tooltip"></div></div><button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button><button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button><div class="pswp__caption"><div class="pswp__caption__center"></div></div></div></div></div>';
766        var pswpShare = '', pswpFullscreen = '', pswpZoom = '', curGallery;
767
768        for(var i = 0; i < galleryLength; i++) {
769            curGallery = galleryElements[i];
770
771            if (curGallery.getAttribute('data-popup-share') === '1') {
772                pswpShare = '<button class="pswp__button pswp__button--share" title="Share"></button>'
773            }
774            if (curGallery.getAttribute('data-popup-fullscreen') === '1') {
775                pswpFullscreen = '<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>';
776            }
777            if (curGallery.getAttribute('data-popup-zoom') === '1') {
778                pswpZoom = '<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>';
779            }
780
781            curGallery.setAttribute('data-pswp-uid', i+1);
782            curGallery.dataGID = i+1;
783
784            if (settings.preloadImages) {
785                parseGalleryImages(curGallery);
786            } else {
787                parseGalleryThumbs(curGallery);
788
789                if (hashData.pid && hashData.gid && hashData.gid === curGallery.dataGID) {
790                    openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
791                }
792            }
793        }
794
795        var pswpOverlay = document.querySelectorAll('.pswp');
796
797        if (pswpOverlay.length === 0) {
798            pswpHTML = pswpHTML + pswpShare + pswpFullscreen + psw
798pZoom + pswpHTMLEnd;
799
800            var pswpContainer = document.createElement('div');
801            pswpContainer.innerHTML = pswpHTML;
802
803            document.body.appendChild(pswpContainer);
804        }
805
806        function parseGalleryImages(gallery){
807            var images = gallery.querySelectorAll(settings.item + ' img');
808            var imagesLen = images.length;
809            var loadedArr = [];
810
811            for (var ind = 0; ind < imagesLen; ind++) {
812                setDataSize(images[ind]);
813            }
814            function setDataSize(img) {
815                var tempImg = new Image();
816
817                var link = closest(img, function(el) {
818                    return (el.tagName && el.tagName === 'A');
819                });
820
821				if(link){
822                    tempImg.src = link.getAttribute('href');
823				}
824
825
826                tempImg.addEventListener('load', function() {
827                    link.setAttribute('data-size', tempImg.naturalWidth + 'x' + tempImg.naturalHeight);
828                    tempImg = null;
829
830                    loadedArr.push('loaded');
831
832                    if (loadedArr.length === imagesLen) {
833                        parseGalleryThumbs(gallery);
834
835                        if (hashData.pid && hashData.gid && hashData.gid === gallery.dataGID) {
836                            openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
837                        }
838                    }
839                });
840            }
841        }
842        function parseGalleryThumbs(gallery) {
843            var thumbs = gallery.querySelectorAll(settings.item);
844            var thumbsLen = thumbs.length;
845            var items = [];
846            var item, link, image, title, desc, size, obj;
847
848            for (var i = 0; i < thumbsLen; i++) {
849                item = thumbs[i];
850
851                item.dataPSIndex = i;
852                item.addEventListener('click', onThumbsClick);
853
854                image = item.querySelector('img');
855                link = item.querySelector('a[data-size]');
856
857                title = link.getAttribute('data-title');
858                desc = item.querySelector(settings.itemDesc);
859
860                size = link.getAttribute('data-size').split('x');
861
862                obj = {
863                    src: link.getAttribute('href'),
864                    w: parseInt(size[0], 10),
865                    h: parseInt(size[1], 10)
866                };
867
868                if (title) {
869                    obj.title = title;
870                }
871
872                if (desc && desc.innerHTML) {
873                    obj.title += '<br /><small>' + desc.innerHTML + '</small>';
874                }
875
876                if (link.children.length > 0) {
877                    obj.msrc = image.getAttribute('src');
878                }
879
880                obj.el = item;
881
882                items.push(obj);
883            }
884
885            return items;
886        }
887        function onThumbsClick(e) {
888            e = e || window.event;
889
890            e.preventDefault ? e.preventDefault() : e.returnValue = false;
891
892            var eTarget = e.target || e.srcElement;
893
894            var clickedItem = closest(eTarget, function(el) {
895                return ('dataPSIndex' in el);
896            });
897
898            var clickedGallery = closest(clickedItem, function(el) {
899                return el.getAttribute('data-pswp-uid');
900            });
901
902            var index = clickedItem.dataPSIndex;
903
904            openPhotoSwipe(index, clickedGallery);
905
906            return false;
907        }
908        function closest(el, fn) {
909            return el && (fn(el) ? el : closest(el.parentNode, fn));
910        }
911        function openPhotoSwipe(index, gallery, disableAnimation, fromURL) {
912            var pswpElement = document.querySelectorAll('.pswp')[0];
913            if (!gallery) {
914                return false;
915            }
916            var items = parseGalleryThumbs(gallery);
917            var options = {
918                galleryUID: gallery.getAttribute('data-pswp-uid'),
919                getThumbBoundsFn: function(index) {
920                    var thumbnail = items[index].el.getElementsByTagName('img')[0];
921                    var pageYScroll = window.pageYOffset || document.documentElement.scrollTop;
922                    var rect = thumbnail.getBoundingClientRect();
923
924                    return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
925                }
926            };
927            if (fromURL) {
928                if(options['galleryPIDs']) {
929                    for (var j = 0; j < items.length; j++) {
930                        if (items[j].pid === index) {
931                            options.index = j;
932                            break;
933                        }
934                    }
935                } else {
936                    options.index = parseInt(index, 10) - 1;
937                }
938            } else {
939                options.index = parseInt(index, 10);
940            }
941            if (isNaN(options.index) ) {
942                return;
943            }
944            if (disableAnimation) {
945                options.showAnimationDuration = 0;
946                options.hideAnimationDuration = 0;
947            }
948            var pswpGallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
949            pswpGallery.init();
950            pswpGallery.listen('close', function() {
951                setTimeout(function(){
952                    pswpElement.classList.remove('pswp--open');
953                }, 500);
954            });
955        }
956        function photoswipeParseHash() {
957            var hash = location.hash.substring(1), params = {};
958
959            if (hash.length < 5) {
960                return params;
961            }
962
963            var vars = hash.split('&'), varsL = vars.length, pair;
964
965            for (var i = 0; i < varsL; i++) {
966                if (!vars[i]) {continue;}
967
968                pair = vars[i].split('=');
969
970                if (pair.length < 2) {continue;}
971
972                params[pair[0]] = pair[1];
973            }
974
975            if (params.gid) {
976                params.gid = parseInt(params.gid, 10);
977            }
978
979            return params;
980        }
981    }
982
983    if (!window.initPhotoSwipeFunc) {
984        window.initPhotoSwipeFunc = initPhotoSwipeFunc;
985    }
986}(window, document));
987
988$(function() {
989
990	var $win = $(window);
991
992	var debounce = (function () {
993		return function (fn, time) {
994			var timer, func;
995			func = function() {
996				var args = [].slice.call(arguments, 0);
997				window.clearTimeout(timer);
998				timer = window.setTimeout(function () {
999					window.requestAnimationFrame && window.requestAnimationFrame(function() {
1000						fn.apply(null, args);
1001					}) || fn.apply(null, args);
1002				}, time)
1003			};
1004			return func;
1005		}
1006	}());
1007
1008	var throttle = (function() {
1009		return function (fn, threshhold, scope) {
1010			threshhold || (threshhold = 250);
1011			var last,
1012				deferTimer,
1013				func;
1014			func = function () {
1015				var context = scope || this;
1016				var now = +new Date,
1017					args = arguments;
1018				if (last && now < last + threshhold) {
1019					// hold on to it
1020					clearTimeout(deferTimer);
1021					deferTimer = setTimeout(function () {
1022						last = now;
1023						fn.apply(context, args);
1024					}, threshhold);
1025				} else {
1026					last = now;
1027					fn.apply(context, args);
1028				}
1029			};
1030			return func;
1031		}
1032	}());
1033
1034	$('.blocklist').each(function() {
1035		var $blocklist = $(this),
1036			$items = $blocklist.find('.item-outer'),
1037			$list = $blocklist.find('.list'),
1038			$body = $blocklist.find('.body'),
1039			$controls = $blocklist.find('.controls'),
1040			$pagers = $blocklist.find('.bx-pager-wrap'),
1041			//$auto_controls = $blocklist.find('.auto_controls'),
1042			options = {},
1043			count,
1044			col_arr, pager_arr, controls_arr,
1045			bxslider,
1046			auto_controls_arr,
1047			containerWidth,
1048			isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
1049			 media_type,
1050			slider_arr = $blocklist.attr('data-slider').split(","),
1051			swipe_arr = $blocklist.attr('data-swipe').split(","),
1052			id = $blocklist.attr('data-layer_id') ? $blocklist.attr('data-layer_id') : $blocklist.attr('item_id'),
1053            psSettings = {
1054				gallery: '.blocklist-' + id + ' .body',
1055				item: '.image',
1056				itemDesc: '.text',
1057				preloadImages: true
1058			};
1059
1060		if (slider_arr.indexOf('1')>-1 && $.fn.bxSlider) {
1061
1062			options.pagerSelector= $blocklist.attr('data-setting-pager_selector');
1063			options.prevSelector = $blocklist.attr('data-setting-prev_selector');
1064			options.nextSelector = $blocklist.attr('data-setting-next_selector');
1065			options.prevText = $blocklist.attr('data-setting-prev_text') || '';
1066			options.nextText = $blocklist.attr('data-setting-next_text') || '';
1067			options.auto = !!parseInt($blocklist.attr('data-setting-auto'));
1068			options.controls = !!parseInt($blocklist.attr('data-setting-controls'));
1069			options.pager = !!parseInt($blocklist.attr('data-setting-pager').split(',')[0]);
1070			options.pause = parseInt($blocklist.attr('data-setting-pause'), 10) || 4000;
1071			options.useCSS = isMobile;
1072			options.infiniteLoop = true;
1073			options.adaptiveHeight = false;
1074			options.mode = $blocklist.attr('data-setting-mode') || 'horizontal';
1075			options.touchEnabled = options.mode === 'horizontal';
1076			options.slideMargin = 0;
1077			options.maxSlides = parseInt($blocklist.attr('data-setting-count').split(',')[0], 10) || 1;
1078			options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides;
1079			options.moveSlides = $blocklist.attr('data-setting-move') || 0;
1080			options.autoControlsSelector = $blocklist.attr('data-setting-auto_controls_selector');
1081			options.autoControls =  !!parseInt($blocklist.attr('data-setting-auto_controls').split(',')[0]);
1082			options.autoControlsCombine =  !!parseInt($blocklist.attr('data-setting-autoControlsCombine'));
1083			options.autoHover = true;
1084
1085			col_arr = $blocklist.attr('data-setting-columns').split(",");
1086			pager_arr = $blocklist.attr('data-setting-pager').split(",");
1087			controls_arr = $blocklist.attr('data-setting-controls').split(",");
1088			auto_controls_arr = $blocklist.attr('data-setting-auto_controls').split(",");
1089
1090			if (!options.autoControls && options.auto) {
1091				options.onSlideAfter = function() {
1092					bxslider.startAuto();
1093				}
1094			}
1095
1096			$items.removeClass('hidden');
1097			if ($list.parent().hasClass('bx-viewport')) {
1098				$list.unwrap();
1099				$list.unwrap();
1100			}
1101
1102			function init(force) {
1103				var setting_columns,
1104					isJustify, space_between,
1105					body_width = $('body').width(),
1106					mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"],
1107					slider_arr = $blocklist.attr('data-slider').split(",");
1108
1109
1110				if (body_width >= 961) {
1111					media_type = "screen";
1112				} else if (body_width <= 960 && body_width >= 769) {
1113					media_type = "tablet_landscape";
1114				} else if (body_width <= 768 && body_width >= 641) {
1115					media_type = "tablet_portrait";
1116				} else if (body_width <= 640 && body_width >= 481) {
1117					media_type = "mobile_landscape";
1118				} else if (body_width <= 480) {
1119					media_type = "mobile_portrait";
1120				}
1121				var media_ind = mediaList.indexOf(media_type);
1122				var newContainerWidth = $blocklist.width(), itemHeight, viewportHeight;
1123
1124				if (!$blocklist.is(':visible')) {
1125					if (bxslider) {
1126						bxslider.destroySlider();
1127					}
1128					return;
1129				}
1130				if (force!='force' && containerWidth && containerWidth === newContainerWidth) {
1131					return;
1132				}
1133				containerWidth = newContainerWidth;
1134
1135				if (bxslider) {
1136					bxslider.destroySlider();
1137				}
1138
1139				count = parseInt($blocklist.attr('data-setting-count').split(',')[media_ind], 10);
1140				isJustify = $body.css('justify-content') == "space-between" ? true : false;
1141
1142				$controls.css("pointer-events","none");
1143				$controls.find('.prev').css("pointer-events","auto");
1144				$controls.find('.next').css("pointer-events","auto");
1145
1146				$list.width('auto');
1147
1148				$items
1149					.attr('style', '')
1150					.slice(1).addClass('hidden').end()
1151					.width(options.slideWidth = $items.width())
1152					.removeClass('hidden');
1153
1154				if (pager_arr.length > 1) {
1155					options.pager = !!parseInt(pager_arr[media_ind]);
1156				}
1157				if (controls_arr.length > 1) {
1158					options.controls = !!parseInt(controls_arr[media_ind]);
1159				}
1160				if (auto_controls_arr.length > 1) {
1161					options.autoControls = !!parseInt(auto_controls_arr[media_ind]);
1162				}
1163
1164				$(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"});
1165				$blocklist.find(".controls").css({"display": options.controls == true ? "flex" : "none"});
1166
1167				if (options.mode === 'vertical') {
1168					itemHeight = Math.max.apply(Math, $items.map(function() {
1169						return $(this).height()
1170					}).get());
1171					$items.css('min-height', itemHeight);
1172					viewportHeight = itemHeight * count;
1173					options.maxSlides = options.minSlides = count;
1174				} else {
1175					setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]);
1176					if (setting_columns) {
1177						count = setting_columns;
1178					}
1179					options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width()));
1180				}
1181
1182				if (isJustify) {
1183					if (options.maxSlides > 1) {
1184						space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1));
1185						space_between = space_between < 0 ? 0 : space_between;
1186					} else {
1187						space_between = 0;
1188					}
1189					options.slideMargin = space_between;
1190				}
1191				if ($items.length > options.maxSlides && slider_arr[media_ind] == 1) {
1192					$list.css({'justify-content': 'flex-start'});
1193					if (bxslider) {
1194						bxslider.reloadSlider(options);
1195					} else {
1196						$list.data('bxslider', (bxslider = $list.bxSlider(options)));
1197					}
1198					if(options.pager){
1199						$pagers.css('display', 'flex');
1200					}
1201				} else {
1202					if(swipe_arr[media_ind]!=1){
1203                        $list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'wrap'});
1204                        if($list.width()/count < $items.width()) {
1205                            $items.css('width', $items.width()-1);
1206                        } else {
1207                            $items.css('width', $items.width());
1208                        }
1209					} else {
1210						$list.css({'flex-wrap': 'nowrap'});
1211					}
1212					$pagers.hide();
1213					$controls.hide();
1214				}
1215
1216				if (viewportHeight && slider_arr[media_ind] == 1) {
1217					$list.parent().css('min-height', viewportHeight);
1218				}
1219				if (options.mode === 'horizontal') {
1220					var align = {};
1221					switch ($body.css('justify-content')) {
1222						case 'flex-end':
1223							align['margin-left'] = 'auto';
1224							align['margin-right'] = '0px';
1225							break;
1226						case 'center':
1227							align['margin-left'] = 'auto';
1228							align['margin-right'] = 'auto';
1229							break;
1230						default:
1231							align['margin-left'] = '0px';
1232							align['margin-right'] = 'auto';
1233					}
1234					$blocklist.find('.bx-wrapper').css(align);
1235				}
1236			}
1237
1238			$win.on('resize', debounce(init, 300));
1239			$win.on('load', function(){
1240				init('force');
1241				$win.trigger('resize');
1242			});
1243
1244			init();
1245		} else {
1246			$pagers.hide();
1247			$controls.hide();
1248		}
1249
1250		$win.on('resize', debounce(swipeScrollInit, 300));
1251		swipeScrollInit();
1252
1253		function swipeScrollInit() {
1254			var $shadowLeft = $blocklist.find(".swipe-shadow-left");
1255			var $shadowRight = $blocklist.find(".swipe-shadow-right");
1256			if ($list.css("overflow-x") == "auto") {
1257				var scroll_width = $list.get(0).scrollWidth;
1258				var view_width = $list.width();
1259				$shadowLeft.css("pointer-events","none");
1260				$shadowRight.css("pointer-events","none");
1261
1262				$list.off('scroll');
1263				$list.on('scroll', throttle(swipeScrollCheack, 200));
1264
1265				swipeScrollCheack();
1266
1267				function swipeScrollCheack() {
1268					var scroll_left = $list.scrollLeft();
1269
1270					if (scroll_left > 0) {
1271						$shadowLeft.show();
1272					} else {
1273						$shadowLeft.hide();
1274					}
1275
1276					if (scroll_left + view_width >= scroll_width - 1) {
1277						$shadowRight.hide();
1278					} else {
1279						$shadowRight.show();
1280					}
1281				}
1282			} else {
1283				$shadowLeft.hide();
1284				$shadowRight.hide();
1285			}
1286		}
1287		if($blocklist.attr('data_photo_swipe') == 1){
1288            $('.pswp').appendTo('body');
1289            initPhotoSwipeFunc(psSettings);
1290			$win.on('resize', function() {
1291                initPhotoSwipeFunc(psSettings);
1292            });
1293		}
1294
1295        $(document).on('click', '.shop2-product-btn2', function(e) {
1296
1297            var $this = $(this),
1298                $form = $this.closest('form'),
1299                form = $form.get(0),
1300                adds = $form.find('.additional-cart-params'),
1301                len = adds.length,
1302                i, el,
1303                a4 = form.amount.value,
1304                kind_id = form.kind_id.value;
1305
1306            e.preventDefault();
1307
1308            if (len) {
1309                a4 = {
1310                    amount: a4
1311                };
1312
1313                for (i = 0; i < len; i += 1) {
1314                    el = adds[i];
1315                    if (el.value) {
1316                        a4[el.name] = el.value;
1317                    }
1318                }
1319            }
1320
1321            shop2.cart.add(kind_id, a4, function(d) {
1322
1323                $('#shop2-cart-preview').replaceWith(d.data);
1324
1325                if (d.errstr) {
1326                    shop2.msg(d.errstr, $this);
1327                } else {
1328                    shop2.msg(window._s3Lang.JS_ADDED, $this);
1329                }
1330
1331                if (d.panel) {
1332                    $('#shop2-panel').replaceWith(d.panel);
1333                }
1334            });
1335
1336        });
1337
1338	});
1339});
1340/*
1341 *  wmS3Menu v1.0.0
1342 *  K.I. 433
1343 */
1344;(function ($, window, document, undefined ) {
1345	var pluginName = 'wmS3Menu',
1346		defaults = {
1347			screenButton: false,
1348			responsiveTl: false,
1349			responsiveTp: false,
1350			responsiveMl: false,
1351			moreText: '...',
1352			childIcons: false,
1353			childIconsClass: 'has-child-icon'
1354		};
1355	// Проверка на касание
1356	var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
1357	var $win = $(window);
1358	var winWidth = $win.width();
1359	var $doc = $(document);
1360
1361	var pluginObj = {
1362		_events: {
1363			hover: function(menuWrap, item, settings){
1364				var link = item.find('> a');
1365				var linkIcon = link.find('.' + settings.childIconsClass);
1366				var iconLen = linkIcon.length;
1367				var subMenu = item.find('> ul');
1368				var showTimeout;
1369				// Отображение
1370				function menuShow() {
1371					clearTimeout(showTimeout);
1372					item.siblings().find('> ul').css('display', '');
1373					// Определение положения выпадашки чтобы не выводилось за пределы окна
1374					pluginObj._menuPosition(subMenu);
1375
1376					link.addClass('hover');
1377					if (iconLen) {
1378						linkIcon.addClass('hover');
1379					}
1380				}
1381				// Скрытие
1382				function menuHide() {
1383					showTimeout = setTimeout(function(){
1384						link.removeClass('hover');
1385						subMenu.css('display', '');
1386						if (iconLen) {
1387							linkIcon.removeClass('hover');
1388						}
1389					}, 500);
1390				}
1391				// Отключение и подключение событий
1392				item.off({
1393					'mouseenter.wmS3Menu': menuShow,
1394					'mouseleave.wmS3Menu': menuHide
1395				});
1396				item.on({
1397					'mouseenter.wmS3Menu': menuShow,
1398					'mouseleave.wmS3Menu': menuHide
1399				});
1400			},
1401			click: function(menuWrap, item, settings){
1402				var link = item.find('> a');
1403				var linkIcon = link.find('.' + settings.childIconsClass);
1404				var iconLen = linkIcon.length;
1405				var subMenu = item.find('> ul');
1406				// Переключение отображения
1407				function menuToggle() {
1408					if (subMenu.is(':visible')) {
1409						if (isTouchable) {
1410							document.location = link.attr('href');
1411						}
1412						link.removeClass('hover');
1413						subMenu.css('display', '');
1414						item.removeClass('submenu-opened');
1415						if (iconLen) {
1416							linkIcon.removeClass('hover');
1417						}
1418					} else {
1419						item.siblings().find('> ul').css('display', '');
1420						item.siblings().find('> a').removeClass('hover');
1421						item.siblings().find('> a .' + settings.childIconsClass).removeClass('hover');
1422						// Определение положения выпадашки чтобы не выводилось за пределы окна
1423						pluginObj._menuPosition(subMenu);
1424
1425						link.addClass('hover');
1426						item.addClass('submenu-opened');
1427						if (iconLen) {
1428							linkIcon.addClass('hover');
1429						}
1430					}
1431					return false;
1432				}
1433				// Отключение и подключение событий
1434				link.off('click.wmS3Menu');
1435				link.on('click.wmS3Menu', menuToggle);
1436			},
1437			click_tree: function(menuWrap, item, settings){
1438				var link = item.find('> a');
1439				var linkIcon = link.find('.' + settings.childIconsClass);
1440				var subMenu = item.find('> ul');
1441				// Переключение отображения
1442				function menuToggle(event) {
1443					var targ = $(event.target);
1444
1445					if (targ.closest(linkIcon).length) {
1446						if (subMenu.is(':visible')) {
1447							link.removeClass('hover');
1448							subMenu.css('display', '');
1449							item.removeClass('submenu-opened');
1450							linkIcon.removeClass('hover');
1451						} else {
1452							// Определение положения выпадашки чтобы не выводилось за пределы окна
1453							pluginObj._menuPosition(subMenu);
1454
1455							link.addClass('hover');
1456							item.addClass('submenu-opened');
1457							linkIcon.addClass('hover');
1458						}
1459						return false;
1460					}
1461				}
1462				// Отключение и подключение событий
1463				link.off('click.wmS3Menu');
1464				link.on('click.wmS3Menu', menuToggle);
1465			}
1466		},
1467		_menuPosition: function(subMenu) {
1468			// Определение положения выпадашки чтобы не выводилось за пределы окна
1469			winWidth = $win.width();
1470
1471			subMenu.css('display', 'block');
1472
1473			if (subMenu.parent().hasClass('first-level') === false) {
1474				subMenu.css({
1475					'visibility': 'hidden',
1476					'opacity': 0
1477				});
1478
1479				var menuRect = subMenu[0].getBoundingClientRect();
1480				var marginR = parseInt(subMenu.css('margin-right'));
1481				var parentWidth = subMenu.parent().width();
1482
1483				if (marginR > parentWidth) {
1484					subMenu.css('margin-right', parentWidth);
1485				}
1486
1487				if (menuRect.right >= winWidth) {
1488					subMenu.css({
1489						'left': '-100%',
1490						'margin-left': 0
1491					});
1492				}
1493				subMenu.css({
1494					'visibility': '',
1495					'opacity': ''
1496				});
1497			}
1498		}
1499	};
1500	function Plugin(element, options) {
1501		this.element = element;
1502
1503		this.options = $.extend({}, defaults, options, $(this.element).data()) ;
1504
1505		this._defaults = defaults;
1506		this._name = pluginName;
1507
1508		this.init();
1509	}
1510	Plugin.prototype = {
1511		init: function () {
1512			var settings = this.options;
1513			// Определение ширины медиа
1514			var moreButFlag = false;
1515			if (window.matchMedia('all and (max-width: 480px)').matches) {
1516				moreButFlag = settings.responsiveMl;
1517			} else if (window.matchMedia('all and (max-width: 640px)').matches) {
1518				//moreButFlag = settings.responsiveTp;
1519			} else if (window.matchMedia('all and (max-width: 768px)').matches) {
1520				moreButFlag = settings.responsiveTl;
1521			} else {
1522				moreButFlag = settings.screenButton;
1523			}
1524			// Обертка меню
1525			var menuWrap = $(this.element);
1526			var menuClass = menuWrap.attr('class');
1527			var menuMainUl = $(this.element.querySelector('ul'));
1528			var widgetClass = menuClass.match(/widget-\d+/)[0];
1529			// Проверка на наличие меню в Side panel
1530			if (window.side_panel_controller && side_panel_controller.inPanel(widgetClass)) {
1531				moreButFlag = false;
1532			}
1533
1534			menuMainUl.children().addClass('first-level');
1535			// Настройки для горизонтального меню
1536			if (!!menuClass.match(/horizontal/i)) {
1537				var menuWidth = menuMainUl.width();
1538				var itemsWidth = 0, hideArr = [], hideLength;
1539				// Кнопка More
1540				var moreBut = menuMainUl.find('.more-button');
1541				if (!moreBut.length) {
1542					moreBut = $('<li class="more-button"><a href="#"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click"
1543					menuMainUl.append(moreBut);
1544				}
1545				// Меню More
1546				var moreMenu = moreBut.find('> ul');
1547				if (!moreMenu.length) {
1548					moreMenu = $('<ul></ul>');
1549					moreBut.append(moreMenu);
1550				}
1551
1552				moreBut.removeClass('removed').attr('data-trigger', 'hover');
1553				menuMainUl.children().css('display', '');
1554
1555				var firstLevelItems = menuMainUl.children(':visible').not('.more-button');
1556				moreMenu.html('');
1557
1558				if (moreButFlag === 'more' || moreButFlag === 'button') {
1559					moreBut.removeClass('disabled');
1560
1561					menuWidth -= moreBut.outerWidth();
1562
1563					firstLevelItems.each(function(){
1564						var thisItem = $(this);
1565						itemsWidth += thisItem.outerWidth(true);
1566						if (itemsWidth >= menuWidth) {
1567							hideArr.push(thisItem.clone());
1568							thisItem.hide();
1569						}
1570					});
1571
1572					hideLength = hideArr.length;
1573					if (hideLength) {
1574						for (var ind = 0; ind < hideLength; ind++) {
1575							moreMenu.append(hideArr[ind]);
1576						}
1577						moreBut.removeClass('disabled');
1578					} else {
1579						moreBut.addClass('disabled');
1580					}
1581				} else {
1582					moreBut.addClass('disabled');
1583				}
1584			}
1585			// Вложенные подуровни меню
1586			var menuInner = menuMainUl.find('ul');
1587			var menuItems = menuInner.parent();
1588			var menuLinks = menuItems.find('> a');
1589			// Стрелочки для подуровней
1590			var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass);
1591			var childIconLen = menuLinksIcons.length;
1592			// Тип отображения меню
1593			var mShow = 'popup';
1594			if (!!menuClass.match(/dropdown/i)) {
1595				mShow = 'dropdown';
1596			} else if (!!menuClass.match(/treemenu/i)) {
1597				mShow = 'treemenu';
1598			}
1599			if (mShow === 'popup') {
1600				menuInner.hide();
1601			}
1602			if (childIconLen) {
1603				menuLinksIcons.remove();
1604			}
1605			if (!!settings.childIcons) {
1606				// Добавление стрелочек для подуровней
1607				var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>';
1608
1609				if (mShow === 'treemenu') {
1610					childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>';
1611				}
1612
1613				var childIconTag = $(childIconHTML);
1614				menuLinks.append(childIconTag.clone());
1615
1616				menuLinksIcons = menuLinks.find('.' + settings.childIconsClass);
1617				childIconLen = menuLinksIcons.length;
1618			}
1619			// Удаление всех событий на ссылках
1620			menuLinks.removeClass('hover').off('click.wmS3Menu');
1621			menuInner.css('display', '');
1622			if (childIconLen) {
1623				menuLinksIcons.removeClass('hover');
1624			}
1625
1626			menuItems.each(function() {
1627				var thisItem = $(this);
1628				var trigger = thisItem.data('trigger') || 'hover';
1629
1630				if (mShow === 'dropdown' || isTouchable) {
1631					trigger = 'click';
1632				} else if (mShow === 'treemenu') {
1633					trigger = 'click_tree';
1634				}
1635				pluginObj._events[trigger](menuWrap, thisItem, settings);
1636			});
1637			// Клик по документу
1638			if (isTouchable) {
1639				function docClick(e) {
1640					var target = $(e.target);
1641					if (target.closest(menuWrap).length === 0) {
1642						menuLinks.removeClass('hover');
1643						menuInner.css('display', '');
1644						menuItems.removeClass('submenu-opened');
1645
1646						if (childIconLen) {
1647							menuLinksIcons.removeClass('hover');
1648						}
1649					}
1650				}
1651				$doc.off('touchstart.wmS3Menu', docClick);
1652				$doc.on('touchstart.wmS3Menu', docClick);
1653			}
1654		},
1655		update: function () {
1656			this.init();
1657		}
1658	};
1659	if (!$.fn[pluginName]) {
1660		$.fn[pluginName] = function (options) {
1661			var args = arguments;
1662			if (options === undefined || typeof options === 'object') {
1663				return this.each(function () {
1664					if (!$.data(this, 'plugin_' + pluginName)) {
1665						$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
1666					}
1667				});
1668			} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
1669				var returns;
1670				this.each(function () {
1671					var instance = $.data(this, 'plugin_' + pluginName);
1672					if (instance instanceof Plugin && typeof instance[options] === 'function') {
1673						returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
1674					}
1675					if (options === 'destroy') {
1676						$.data(this, 'plugin_' + pluginName, null);
1677					}
1678				});
1679				return returns !== undefined ? returns : this;
1680			}
1681		};
1682	}
1683	$(function () {
1684		var wmMenuWrap = $('.wm-widget-menu.vertical');
1685		wmMenuWrap[pluginName]();
1686
1687		$win.on('resize.wmS3Menu', function(){
1688			wmMenuWrap[pluginName]('update');
1689		});
1690	});
1691
1692	setTimeout(function(){
1693		$win.trigger('resize');
1694	}, 500);
1695}(jQuery, window, document));
1696$(function() {
1697
1698	var debounce = (function () {
1699		return function (fn, time) {
1700			var timer, func;
1701			func = function() {
1702				var args = [].slice.call(arguments, 0);
1703				window.clearTimeout(timer);
1704				timer = window.setTimeout(function () {
1705					window.requestAnimationFrame && window.requestAnimationFrame(function() {
1706						fn.apply(null, args);
1707					}) || fn.apply(null, args);
1708				}, time)
1709			};
1710			return func;
1711		}
1712	}());
1713
1714	var throttle = (function() {
1715		return function (fn, threshhold, scope) {
1716			threshhold || (threshhold = 250);
1717			var last,
1718				deferTimer,
1719				func;
1720			func = function () {
1721				var context = scope || this;
1722				var now = +new Date,
1723					args = arguments;
1724				if (last && now < last + threshhold) {
1725					// hold on to it
1726					clearTimeout(deferTimer);
1727					deferTimer = setTimeout(function () {
1728						last = now;
1729						fn.apply(context, args);
1730					}, threshhold);
1731				} else {
1732					last = now;
1733					fn.apply(context, args);
1734				}
1735			};
1736			return func;
1737		}
1738	}());
1739
1740	$('.news-block').each(function() {
1741		var $newsblock = $(this),
1742			$items = $newsblock.find('.item-outer'),
1743			$list = $newsblock.find('.news__list'),
1744			$body = $newsblock.find('.body'),
1745			$controls = $newsblock.find('.controls'),
1746			$pagers = $newsblock.find('.bx-pager-wrap'),
1747			options = {},
1748			count,
1749			auto_controls_arr,
1750			col_arr, pager_arr, controls_arr,
1751			bxslider,
1752			containerWidth,
1753			isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
1754			slider_arr = $newsblock.attr('data-slider').split(","),
1755			swipe_arr = $newsblock.attr('data-swipe').split(",");
1756
1757		if (slider_arr.indexOf('1')>-1 && $.fn.bxSlider) {
1758
1759			options.pagerSelector= $newsblock.attr('data-setting-pager_selector');
1760			options.prevSelector = $newsblock.attr('data-setting-prev_selector');
1761			options.nextSelector = $newsblock.attr('data-setting-next_selector');
1762			options.prevText = $newsblock.attr('data-setting-prev_text') || '';
1763			options.nextText = $newsblock.attr('data-setting-next_text') || '';
1764			options.auto = !!parseInt($newsblock.attr('data-setting-auto'));
1765			options.controls = !!parseInt($newsblock.attr('data-setting-controls'));
1766			options.pager = !!parseInt($newsblock.attr('data-setting-pager').split(',')[0]);
1767			options.pause = parseInt($newsblock.attr('data-setting-pause'), 10) || 4000;
1768			options.useCSS = isMobile;
1769			options.infiniteLoop = true;
1770			options.adaptiveHeight = false;
1771			options.mode = $newsblock.attr('data-setting-mode') || 'horizontal';
1772			options.touchEnabled = options.mode === 'horizontal';
1773			options.slideMargin = 0;
1774			options.maxSlides = parseInt($newsblock.attr('data-setting-count').split(',')[0], 10) || 1;
1775			options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides;
1776			options.moveSlides = $newsblock.attr('data-setting-move') || 0;
1777			options.autoControlsSelector = $newsblock.attr('data-setting-auto_controls_selector');
1778			options.autoControls =  !!parseInt($newsblock.attr('data-setting-auto_controls').split(',')[0]);
1779			options.autoControlsCombine =  !!parseInt($newsblock.attr('data-setting-autoControlsCombine'));
1780			options.autoHover = true;
1781
1782			col_arr = $newsblock.attr('data-setting-columns').split(",");
1783			pager_arr = $newsblock.attr('data-setting-pager').split(",");
1784			controls_arr = $newsblock.attr('data-setting-controls').split(",");
1785			auto_controls_arr = $newsblock.attr('data-setting-auto_controls').split(",");
1786
1787			if (!options.autoControls && options.auto) {
1788				options.onSlideAfter = function() {
1789					bxslider.startAuto();
1790				}
1791			}
1792
1793			$items.removeClass('hidden');
1794			if ($list.parent().hasClass('bx-viewport')) {
1795				$list.unwrap();
1796				$list.unwrap();
1797			}
1798
1799			function init(force) {
1800				var media_type,
1801					body_width = $('body').width();
1802
1803				var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"];
1804				var media_ind, setting_columns,
1805					isJustify, space_between;
1806				var slider_arr = $newsblock.attr('data-slider').split(",");
1807
1808				var newContainerWidth = $newsblock.width(), itemHeight, viewportHeight;
1809				if (!$newsblock.is(':visible')) {
1810					if (bxslider) {
1811						bxslider.destroySlider();
1812					}
1813					return;
1814				}
1815				if (force!='force' && containerWidth && containerWidth === newContainerWidth) {
1816					return;
1817				}
1818				containerWidth = newContainerWidth;
1819
1820				if (bxslider) {
1821					bxslider.destroySlider();
1822				}
1823
1824				if (body_width >= 961) {
1825					media_type = "screen";
1826				} else if (body_width <= 960 && body_width >= 769) {
1827					media_type = "tablet_landscape";
1828				} else if (body_width <= 768 && body_width >= 641) {
1829					media_type = "tablet_portrait";
1830				} else if (body_width <= 640 && body_width >= 481) {
1831					media_type = "mobile_landscape";
1832				} else if (body_width <= 480) {
1833					media_type = "mobile_portrait";
1834				}
1835				media_ind = mediaList.indexOf(media_type);
1836
1837                count = parseInt($newsblock.attr('data-setting-count').split(',')[media_ind], 10);
1838				isJustify = $body.css('justify-content') == "space-between" ? true : false;
1839
1840				$controls.css("pointer-events","none");
1841				$controls.find('.prev').css("pointer-events","auto");
1842				$controls.find('.next').css("pointer-events","auto");
1843
1844				$list.width('auto');
1845				$items
1846					.attr('style', '')
1847					.slice(1).addClass('hidden').end()
1848					.width(options.slideWidth = $items.width())
1849					.removeClass('hidden');
1850
1851				if (pager_arr.length > 1) {
1852					options.pager = !!parseInt(pager_arr[media_ind]);
1853				}
1854				if (controls_arr.length > 1) {
1855					options.controls = !!parseInt(controls_arr[media_ind]);
1856				}
1857				if (auto_controls_arr.length > 1) {
1858					options.autoControls = !!parseInt(auto_controls_arr[media_ind]);
1859				}
1860
1861				$(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"});
1862				$newsblock.find(".controls").css({"display": options.controls == true ? "flex" : "none"});
1863
1864				if (options.mode === 'vertical') {
1865					itemHeight = Math.max.apply(Math, $items.map(function() {
1866						return $(this).height()
1867					}).get());
1868					$items.css('min-height', itemHeight);
1869					viewportHeight = itemHeight * count;
1870                    options.maxSlides = options.minSlides = count;
1871				} else {
1872					setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]);
1873					if (setting_columns) {
1874						count = setting_columns;
1875					}
1876					options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width()));
1877				}
1878
1879				if (isJustify) {
1880					if (options.maxSlides > 1) {
1881						space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1));
1882						space_between = space_between < 0 ? 0 : space_between;
1883					} else {
1884						space_between = 0;
1885					}
1886					options.slideMargin = space_between;
1887				}
1888
1889				if ($items.length > options.maxSlides && slider_arr[media_ind] == 1) {
1890					$list.css({'justify-content': 'flex-start'});
1891					if (bxslider) {
1892						bxslider.reloadSlider(options);
1893					} else {
1894						$list.data('bxslider', (bxslider = $list.bxSlider(options)));
1895					}
1896					if(options.pager){
1897						$pagers.css('display', 'flex');
1898					}
1899				} else {
1900					if(swipe_arr[media_ind]!=1){
1901						$list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'wrap'});
1902						$items.css('width', $items.width()-1);
1903					} else {
1904						$list.css({'flex-wrap': 'nowrap'});
1905					}
1906					$pagers.hide();
1907					$controls.hide();
1908				}
1909
1910				if (viewportHeight && slider_arr[media_ind] == 1) {
1911					$list.parent().css('min-height', viewportHeight);
1912				}
1913				if (options.mode === 'horizontal') {
1914					var align = {};
1915					switch ($body.css('justify-content')) {
1916						case 'flex-end':
1917							align['margin-left'] = 'auto';
1918							align['margin-right'] = '0px';
1919							break;
1920						case 'center':
1921							align['margin-left'] = 'auto';
1922							align['margin-right'] = 'auto';
1923							break;
1924						default:
1925							align['margin-left'] = '0px';
1926							align['margin-right'] = 'auto';
1927					}
1928					$newsblock.find('.bx-wrapper').css(align);
1929				}
1930			}
1931
1932			$(window).on('resize', debounce(init, 300));
1933			$(window).on('load', function(){
1934				init('force');
1935			});
1936
1937			init();
1938		} else {
1939			$pagers.hide();
1940			$controls.hide();
1941		}
1942
1943		$(window).on('resize', debounce(swipeScrollInit, 300));
1944		swipeScrollInit();
1945
1946		function swipeScrollInit() {
1947			var $shadowLeft = $newsblock.find(".swipe-shadow-left");
1948			var $shadowRight = $newsblock.find(".swipe-shadow-right");
1949			if ($list.css("overflow-x") == "auto") {
1950				var scroll_width = $list.get(0).scrollWidth;
1951				var view_width = $list.width();
1952				$shadowLeft.css("pointer-events","none");
1953				$shadowRight.css("pointer-events","none");
1954
1955				$list.off('scroll');
1956				$list.on('scroll', throttle(swipeScrollCheack, 200));
1957
1958				swipeScrollCheack();
1959
1960				function swipeScrollCheack() {
1961					var scroll_left = $list.scrollLeft();
1962
1963					if (scroll_left > 0) {
1964						$shadowLeft.show();
1965					} else {
1966						$shadowLeft.hide();
1967					}
1968
1969					if (scroll_left + view_width >= scroll_width - 1) {
1970						$shadowRight.hide();
1971					} else {
1972						$shadowRight.show();
1973					}
1974				}
1975			} else {
1976				$shadowLeft.hide();
1977				$shadowRight.hide();
1978			}
1979		}
1980
1981	});
1982});
1983$(function () {
1984	$(document).click(function (event) {
1985		$('.contacts-block').each(function() {
1986			if ($(event.target).closest($(this)).length) {
1987				return;
1988			} else {
1989				$(this).find('.tgl-but').prop("checked", false);
1990				$(this).find('.icon').removeClass('active');
1991			}
1992		});
1993	});
1994
1995	function setMargin($block) {
1996		if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
1997			$block.find(".block-body-drop").css({
1998				"margin-left": "0px"
1999			});
2000		} else {
2001			var left = $block.offset().left * -1;
2002			$block.find(".block-body-drop").css({
2003				"margin-left": left + "px"
2004			});
2005		}
2006	}
2007
2008	$('.contacts-block').each(function() {
2009		var $block = $(this),
2010			allClasses = $block.attr("class").split(" "),
2011			mainClass = allClasses[0],
2012			mainSelector = ".side-panel ."+mainClass+" .block-body-drop",
2013			styles = document.styleSheets;
2014
2015		for(var i = 0; i < styles.length; i++) {
2016			if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
2017				for(var j = 0; j < styles[i].cssRules.length; j++) {
2018					if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
2019						$block.data("fullwidth", 1);
2020						setMargin($block);
2021						break;
2022					}
2023				}
2024				break;
2025			}
2026		}
2027	});
2028
2029	$(window).resize(function() {
2030		$('.contacts-block').each(function() {
2031			var $block = $(this);
2032			if ($block.data("fullwidth") == 1) {
2033				setMargin($block);
2034			}
2035		});
2036	});
2037
2038	$('.contacts-block').each(function() {
2039		var $block = $(this);
2040		$block.find('.icon').click(function() {
2041			if ($block.data("fullwidth") == 1) {
2042				setMargin($block);
2043			}
2044			if ($block.find('.tgl-but').prop("checked")) {
2045				$(this).removeClass('active');
2046			} else {
2047				$(this).addClass('active');
2048			}
2049		});
2050	});
2051});
2052/*
2053 * @license
2054 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
2055 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
2056 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
2057 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
2058 * Code distributed by Google as part of the polymer project is also
2059 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2060 */
2061
2062"use strict";
2063
2064(function (exports) {
2065
2066	function sign(number) {
2067		if (number < 0)
2068			return -1;
2069		if (number > 0)
2070			return 1;
2071		return 0;
2072	}
2073
2074	function Animator(delegate) {
2075		this.delegate = delegate;
2076		this.startTimeStamp = 0;
2077		this.request_ = null;
2078	};
2079
2080	Animator.prototype.scheduleAnimation = function () {
2081		if (this.request_)
2082			return;
2083		this.request_ = requestAnimationFrame(this.onAnimation_.bind(this));
2084	};
2085
2086	Animator.prototype.startAnimation = function () {
2087		this.startTimeStamp = 0;
2088		this.scheduleAnimation();
2089	};
2090
2091	Animator.prototype.stopAnimation = function () {
2092		cancelAnimationFrame(this.request_);
2093		this.startTimeStamp = 0;
2094		this.request_ = null;
2095	};
2096
2097	Animator.prototype.onAnimation_ = function (timeStamp) {
2098		this.request_ = null;
2099		if (!this.startTimeStamp)
2100			this.startTimeStamp = timeStamp;
2101		if (this.delegate.onAnimation(timeStamp))
2102			this.scheduleAnimation();
2103	};
2104
2105	function VelocityTracker() {
2106		this.recentTouchMoves_ = [];
2107		this.velocityX = 0;
2108		this.velocityY = 0;
2109	}
2110
2111	VelocityTracker.kTimeWindow = 50;
2112
2113	VelocityTracker.prototype.pruneHistory_ = function (timeStamp) {
2114		for (var i = 0; i < this.recentTouchMoves_.length; ++i) {
2115			if (this.recentTouchMoves_[i].timeStamp > timeStamp - VelocityTracker.kTimeWindow) {
2116				this.recentTouchMoves_ = this.recentTouchMoves_.slice(i);
2117				return;
2118			}
2119		}
2120		// All touchmoves are old.
2121		this.recentTouchMoves_ = [];
2122	};
2123
2124	VelocityTracker.prototype.update_ = function (e) {
2125		this.pruneHistory_(e.timeStamp);
2126		this.recentTouchMoves_.push(e);
2127
2128		var oldestTouchMove = this.recentTouchMoves_[0];
2129
2130		var deltaX = e.changedTouches[0].clientX - oldestTouchMove.changedTouches[0].clientX;
2131		var deltaY = e.changedTouches[0].clientY - oldestTouchMove.changedTouches[0].clientY;
2132		var deltaT = e.timeStamp - oldestTouchMove.timeStamp;
2133
2134		if (deltaT > 0) {
2135			this.velocityX = deltaX / deltaT;
2136			this.velocityY = deltaY / deltaT;
2137		} else {
2138			this.velocityX = 0;
2139			this.velocityY = 0;
2140		}
2141	};
2142
2143	VelocityTracker.prototype.onTouchStart = function (e) {
2144		this.recentTouchMoves_.push(e);
2145		this.velocityX = 0;
2146		this.velocityY = 0;
2147	};
2148
2149	VelocityTracker.prototype.onTouchMove = function (e) {
2150		this.update_(e);
2151	};
2152
2153	VelocityTracker.prototype.onTouchEnd = function (e) {
2154		this.update_(e);
2155		this.recentTouchMoves_ = [];
2156	};
2157
2158	function LinearTimingFunction() {
2159	};
2160
2161	LinearTimingFunction.prototype.scaleTime = function (fraction) {
2162		return fraction;
2163	};
2164
2165	function CubicBezierTimingFunction(spec) {
2166		this.map = [];
2167		for (var ii = 0; ii <= 100; ii += 1) {
2168			var i = ii / 100;
2169			this.map.push([
2170				3 * i * (1 - i) * (1 - i) * spec[0] +
2171				3 * i * i * (1 - i) * spec[2] + i * i * i,
2172				3 * i * (1 - i) * (1 - i) * spec[1] +
2173				3 * i * i * (1 - i) * spec[3] + i * i * i
2174			]);
2175		}
2176	};
2177
2178	CubicBezierTimingFunction.prototype.scaleTime = function (fraction) {
2179		var fst = 0;
2180		while (fst !== 100 && fraction > this.map[fst][0]) {
2181			fst += 1;
2182		}
2183		if (fraction === this.map[fst][0] || fst === 0) {
2184			return this.map[fst][1];
2185		}
2186		var yDiff = this.map[fst][1] - this.map[fst - 1][1];
2187		var xDiff = this.map[fst][0] - this.map[fst - 1][0];
2188		var p = (fraction - this.map[fst - 1][0]) / xDiff;
2189		return this.map[fst - 1][1] + p * yDiff;
2190	};
2191
2192	var presetTimingFunctions = {
2193		'linear': new LinearTimingFunction(),
2194		'ease': new CubicBezierTimingFunction([0.25, 0.1, 0.25, 1.0]),
2195		'ease-in': new CubicBezierTimingFunction([0.42, 0, 1.0, 1.0]),
2196		'ease-out': new CubicBezierTimingFunction([0, 0, 0.58, 1.0]),
2197		'ease-in-out': new CubicBezierTimingFunction([0.42, 0, 0.58, 1.0]),
2198	};
2199
2200	function DrawerController(options) {
2201		this.velocityTracker = new VelocityTracker();
2202		this.animator = new Animator(this);
2203
2204		this.target = options.target;
2205		this.left = options.left;
2206		this.right = options.right;
2207		this.position = options.position;
2208		this.flip = options.flip;
2209		this.full_width = options.full_width;
2210
2211		this.width = this.right - this.left;
2212		this.curve = presetTimingFunctions[options.curve || 'linear'];
2213
2214		this.willOpenCallback = options.willOpen;
2215		this.didCloseCallback = options.didClose;
2216		this.animateCallback = options.onAnimate;
2217
2218		this.state = DrawerController.kClosed;
2219
2220		this.defaultAnimationSpeed = (this.right - this.left) / DrawerController.kBaseSettleDurationMS;
2221
2222		this.onTouchMove = this.onTouchMove.bind(this);
2223		this.onTouchEnd = this.onTouchEnd.bind(this);
2224
2225		if (!this.full_width) {
2226			this.target.addEventListener('touchstart', this.onTouchStart.bind(this));
2227		}
2228	}
2229
2230	DrawerController.kOpened = 'opened';
2231	DrawerController.kClosed = 'closed';
2232	DrawerController.kOpening = 'opening';
2233	DrawerController.kClosing = 'closing';
2234	DrawerController.kDragging = 'dragging';
2235	DrawerController.kFlinging = 'flinging';
2236
2237	DrawerController.kBaseSettleDurationMS = 246;
2238	DrawerController.kMaxSettleDurationMS = 600;
2239
2240	DrawerController.kMinFlingVelocity = 0.4;  // Matches Android framework.
2241	DrawerController.kTouchSlop = 5;  // Matches Android framework.
2242	DrawerController.kTouchSlopSquare = DrawerController.kTouchSlop * DrawerController.kTouchSlop;
2243
2244	DrawerController.prototype.restrictToCurrent = function (offset) {
2245		return Math.max(this.left, Math.min(this.position, offset));
2246	};
2247
2248	DrawerController.prototype.restrictToBounds = function (offset) {
2249		return Math.max(this.left, Math.min(this.right, offset));
2250	};
2251
2252	DrawerController.prototype.onTouchStart = function (e) {
2253		this.velocityTracker.onTouchStart(e);
2254
2255		var touchX;
2256		if (this.flip) {
2257			touchX = document.documentElement.clientWidth - e.changedTouches[0].clientX;
2258		} else {
2259			touchX = e.changedTouches[0].clientX;
2260		}
2261		var touchY = e.changedTouches[0].clientY;
2262
2263		if (this.state != DrawerController.kOpened) {
2264			if (touchX != this.restrictToCurrent(touchX))
2265				return;
2266			this.state = DrawerController.kDragging;
2267		}
2268
2269		this.animator.stopAnimation();
2270		this.target.addEventListener('touchmove', this.onTouchMove);
2271		this.target.addEventListener('touchend', this.onTouchEnd);
2272		// TODO(abarth): Handle touchcancel.
2273
2274		this.startX = touchX;
2275		this.startY = touchY;
2276		this.startPosition = this.position;
2277		this.touchBaseX = Math.min(touchX, this.startPosition);
2278	};
2279
2280	DrawerController.prototype.onTouchMove = function (e) {
2281		this.velocityTracker.onTouchMove(e);
2282
2283		if (this.state == DrawerController.kOpened) {
2284			var deltaX;
2285			if (this.flip) {
2286				deltaX = document.documentElement.clientWidth - e.changedTouches[0].clientX - this.startX;
2287			} else {
2288				deltaX = e.changedTouches[0].clientX - this.startX;
2289			}
2290			var deltaY = e.changedTouches[0].clientY - this.startY;
2291
2292			if (deltaX * deltaX + deltaY * deltaY < DrawerController.kTouchSlopSquare) {
2293				e.preventDefault();
2294				return;
2295			}
2296
2297			if (Math.abs(deltaY) > Math.abs(deltaX)) {
2298				this.target.removeEventListener('touchmove', this.onTouchMove);
2299				this.target.removeEventListener('touchend', this.onTouchEnd);
2300				return;
2301			}
2302
2303			this.state = DrawerController.kDragging;
2304		}
2305
2306		e.preventDefault();
2307		var touchDeltaX;
2308		if (this.flip) {
2309			touchDeltaX = document.documentElement.clientWidth - e.changedTouches[0].clientX - this.touchBaseX;
2310		} else {
2311			touchDeltaX = e.changedTouches[0].clientX - this.touchBaseX;
2312		}
2313		this.position = this.restrictToBounds(this.startPosition + touchDeltaX);
2314		this.animator.scheduleAnimation();
2315	};
2316
2317	DrawerController.prototype.onTouchEnd = function (e) {
2318		this.velocityTracker.onTouchEnd(e);
2319		this.target.removeEventListener('touchmove', this.onTouchMove);
2320		this.target.removeEventListener('touchend', this.onTouchEnd);
2321
2322		var velocityX = this.velocityTracker.velocityX;
2323
2324		if (this.flip) {
2325			velocityX *= -1;
2326		}
2327
2328		if (Math.abs(velocityX) > DrawerController.kMinFlingVelocity) {
2329			this.fling(velocityX);
2330		} else if (this.isOpen()) {
2331			this.open();
2332		} else {
2333			this.close();
2334		}
2335	};
2336
2337	DrawerController.prototype.openFraction = function () {
2338		var width = this.right - this.left;
2339		var offset = this.position - this.left;
2340		return offset / width;
2341	};
2342
2343	DrawerController.prototype.isOpen = function () {
2344		return this.openFraction() >= 0.5;
2345	};
2346
2347	DrawerController.prototype.isOpening = function () {
2348		return this.state == DrawerController.kOpening ||
2349			(this.state == DrawerController.kFlinging && this.animationVelocityX > 0);
2350	}
2351
2352	DrawerController.prototype.isClosing = function () {
2353		return this.state == DrawerController.kClosing ||
2354			(this.state == DrawerController.kFlinging && this.animationVelocityX < 0);
2355	}
2356
2357	DrawerController.prototype.toggle = function () {
2358		if (this.isOpen())
2359			this.close();
2360		else
2361			this.open();
2362	};
2363
2364	DrawerController.prototype.open = function () {
2365		if (this.full_width) {
2366			this.willOpenCallback.call(this.target);
2367			return;
2368		}
2369		if (!this.position)
2370			this.willOpenCallback.call(this.target);
2371
2372		this.animator.stopAnimation();
2373		this.animationDuration = 400;
2374		this.state = DrawerController.kOpening;
2375		this.animate();
2376	};
2377
2378	DrawerController.prototype.close = function () {
2379		if (this.full_width) {
2380			this.didCloseCallback.call(this.target);
2381			return;
2382		}
2383		this.animator.stopAnimation();
2384		this.animationDuration = 400;
2385		this.state = DrawerController.kClosing;
2386		this.animate();
2387	};
2388
2389	DrawerController.prototype.fling = function (velocityX) {
2390		this.animator.stopAnimation();
2391		this.animationVelocityX = velocityX;
2392		this.state = DrawerController.kFlinging;
2393		this.animate();
2394	};
2395
2396	DrawerController.prototype.animate = function () {
2397		this.positionAnimationBase = this.position;
2398		this.animator.startAnimation();
2399	};
2400
2401	DrawerController.prototype.targetPosition = function (deltaT) {
2402		if (this.state == DrawerController.kFlinging)
2403			return this.positionAnimationBase + this.animationVelocityX * deltaT;
2404		var targetFraction = this.curve.scaleTime(deltaT / this.animationDuration);
2405		var animationWidth = this.state == DrawerController.kOpening ?
2406		this.width - this.positionAnimationBase : -this.positionAnimationBase;
2407		return this.positionAnimationBase + targetFraction * animationWidth;
2408	};
2409
2410	DrawerController.prototype.onAnimation = function (timeStamp) {
2411		if (this.state == DrawerController.kDragging) {
2412			this.animateCallback.call(this.target, this.position);
2413			return false;
2414		}
2415
2416		var deltaT = timeStamp - this.animator.startTimeStamp;
2417		var targetPosition = this.targetPosition(deltaT);
2418		this.position = this.restrictToBounds(targetPosition);
2419
2420		this.animateCallback.call(this.target, this.position);
2421
2422		if (targetPosition <= this.left && this.isClosing()) {
2423			this.state = DrawerController.kClosed;
2424			this.didCloseCallback.call(this.target);
2425			return false;
2426		}
2427		if (targetPosition >= this.right && this.isOpening()) {
2428			this.state = DrawerController.kOpened;
2429			return false;
2430		}
2431
2432		return true;
2433	};
2434
2435
2436	exports.DrawerController = DrawerController;
2437
2438})(window);
2439document.addEventListener('DOMContentLoaded', function() {
2440	var bodyScrollBarWidth = (function () {
2441		var widthHidden, widthScroll, currentValue, currentPriority;
2442		currentValue = document.body.style.getPropertyValue('overflow');
2443		currentPriority = document.body.style.getPropertyPriority('overflow');
2444		document.body.style.setProperty('overflow', 'hidden', 'important');
2445		widthHidden = document.body.clientWidth;
2446		document.body.style.setProperty('overflow', 'scroll', 'important');
2447		widthScroll = document.body.clientWidth;
2448		document.body.style.setProperty('overflow', currentValue ? currentValue : '', currentPriority);
2449		return widthHidden - widthScroll;
2450	}());
2451	var media = {
2452		'tablet-landscape': 960,
2453		'tablet-portrait': 768,
2454		'mobile-landscape': 640,
2455		'mobile-portrait': 480
2456	};
2457	var side_panel = document.querySelector('.side-panel');
2458	var side_panel_content, side_panel_content_inner, side_panel_top, side_panel_mask, side_panel_button, side_panel_close, side_panel_controller, leftEdge, rightEdge, isPhantom;
2459	var layers, content_width, flip, full_width, elements = {}, comments = {};
2460
2461	if (!side_panel || side_panel.classList.contains('removed')) {
2462		return;
2463	}
2464
2465	flip = side_panel.getAttribute('data-position') === 'right';
2466
2467	try {
2468		layers = side_panel.getAttribute('data-layers');
2469		if (layers !== "") {
2470			layers = JSON.parse(layers.replace(/\[/g, '{').replace(/\]/g, '}').replace(/\'/g, '"'));
2471		}
2472	} catch(e) {
2473		console.error(e);
2474	}
2475
2476	if (typeof layers !== 'object' || Object.keys(layers).length === 0) {
2477		return;
2478	}
2479
2480	Object.keys(layers).forEach(function(clss) {
2481		elements[clss] = document.querySelector('.' + clss);
2482		comments[clss] = document.createComment(clss);
2483		if (elements[clss]) {
2484			elements[clss].parentNode.insertBefore(comments[clss], elements[clss]);
2485		} else {
2486			delete layers[clss];
2487		}
2488	});
2489
2490	side_panel_button = side_panel.querySelector('.side-panel-button');
2491	side_panel_close = side_panel.querySelector('.side-panel-close');
2492	side_panel_content = side_panel.querySelector('.side-panel-content');
2493	side_panel_content_inner = side_panel.querySelector('.side-panel-content-inner') || side_panel_content;
2494	side_panel_mask = side_panel.querySelector('.side-panel-mask');
2495	side_panel_top = side_panel.querySelector('.side-panel-top-inner');
2496
2497	side_panel.classList.remove('hidden');
2498	side_panel_button.classList.remove('hidden');
2499	side_panel_button.style.display = 'none';
2500	side_panel_content.classList.remove('hidden');
2501	side_panel_content.style.display = 'none';
2502	side_panel_mask.classList.remove('hidden');
2503	side_panel_mask.style.display = 'none';
2504
2505	content_width = getComputedStyle(side_panel_content, null).width;
2506
2507	leftEdge = 0;
2508	rightEdge = parseInt(content_width) + 50;
2509
2510	if (content_width === 'auto') {
2511		rightEdge = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2512		full_width = true;
2513	}
2514
2515	isPhantom = !!parseInt($(side_panel).attr("data-phantom"));
2516
2517	if (isPhantom) {
2518		$(side_panel).css({"pointer-events": "none"});
2519	} else {
2520		$(side_panel).css({"pointer-events": "auto"});
2521	}
2522
2523	if (flip) {
2524		side_panel_content.style.left = 'auto';
2525		side_panel_content.style.right = '0';
2526	}
2527
2528	if (full_width) {
2529		side_panel_content.style.left = '0';
2530		side_panel_content.style.right = '0';
2531	}
2532
2533	window.side_panel_controller = side_panel_controller = new DrawerController({
2534		target: side_panel,
2535		full_width: full_width,
2536		left: leftEdge,
2537		right: rightEdge,
2538		position: 0,
2539		flip: flip,
2540		curve: 'ease-in-out',
2541		willOpen: function() {
2542			side_panel_mask.style.display = 'block';
2543			side_panel_content.style.display = 'block';
2544			document.body.classList.add('noscroll');
2545			if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) {
2546				document.body.style.borderRight = bodyScrollBarWidth + 'px solid transparent'
2547			}
2548		},
2549		didClose: function() {
2550			side_panel_mask.style.display = 'none';
2551			side_panel_content.style.display = 'none';
2552			document.body.classList.remove('noscroll');
2553			if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) {
2554				document.body.style.borderRight = ''
2555			}
2556		},
2557		onAnimate: function(position) {
2558			side_panel_mask.style.opacity = position / rightEdge;
2559			side_panel_content.style.transform = 'translate3d(' + (flip ? rightEdge - position : position - rightEdge) + 'px,0,0)';
2560		}
2561	});
2562
2563	side_panel_controller.inPanel = function(clss) {
2564		var viewportWidth;
2565		var current_media;
2566
2567		if (typeof clss !== 'string') {
2568			return false;
2569		}
2570
2571		if (clss.charAt(0) === '.') {
2572			clss = clss.slice(1);
2573		}
2574
2575		viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2576
2577		Object.keys(media).forEach(function(key) {
2578			if (viewportWidth <= media[key]) {
2579				current_media = key;
2580			}
2581		});
2582
2583		if (typeof current_media === 'undefined') {
2584			current_media = 'screen';
2585		}
2586
2587		return layers[clss] && layers[clss][current_media];
2588	};
2589
2590	side_panel_button.addEventListener('click', function(e) {
2591		e.preventDefault();
2592		side_panel_controller.toggle();
2593		return false;
2594	});
2595
2596	if (side_panel_close) {
2597		side_panel_close.addEventListener('click', function(e) {
2598			e.preventDefault();
2599			side_panel_controller.close();
2600			return false;
2601		});
2602	}
2603
2604	side_panel_mask.addEventListener('click', function() {
2605		side_panel_controller.close();
2606		return false;
2607	});
2608
2609	document.addEventListener('keyup', function(e) {
2610		if (e.keyCode === 27) {
2611			side_panel_controller.close();
2612			return false;
2613		}
2614	});
2615
2616	var debounce = (function () {
2617		return function (fn, time) {
2618			var timer, func;
2619			if (window.requestAnimationFrame) {
2620				func = function() {
2621					timer && cancelAnimationFrame(timer);
2622					timer = requestAnimationFrame(fn);
2623				}
2624			} else {
2625				func = function() {
2626					window.clearTimeout(timer);
2627					timer = window.setTimeout(function () {
2628						fn();
2629					}, time)
2630				};
2631			}
2632			return func;
2633		}
2634	}());
2635
2636	function checkSidePanel() {
2637		var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2638		var current_media;
2639		var emptySide = true;
2640		var emptyTop = true;
2641
2642		if (checkSidePanel.viewportWidth === viewportWidth) {
2643			return;
2644		}
2645
2646		checkSidePanel.viewportWidth = viewportWidth;
2647
2648		Object.keys(media).forEach(function(key) {
2649			if (viewportWidth <= media[key]) {
2650				current_media = key;
2651			}
2652		});
2653
2654		if (typeof current_media === 'undefined') {
2655			current_media = 'screen';
2656		}
2657
2658		Object.keys(layers).forEach(function(clss){
2659			var element, comment;
2660
2661			element = elements[clss];
2662			comment = comments[clss];
2663
2664			if (current_media in layers[clss]) {
2665				if (layers[clss][current_media] === 'onTop') {
2666					side_panel_top.appendChild(element);
2667					emptyTop = false;
2668				} else {
2669					side_panel_content_inner.appendChild(element);
2670					emptySide = false;
2671				}
2672			} else {
2673				if (comment) {
2674					comment.parentNode.insertBefore(element, comment);
2675				}
2676			}
2677		});
2678
2679		if (emptySide) {
2680			side_panel_button.style.display = 'none';
2681		} else {
2682			side_panel_button.style.display = 'block';
2683		}
2684
2685		if (!emptyTop || !emptySide) {
2686			side_panel.style.display = 'block';
2687		} else {
2688			side_panel.style.display = 'none';
2689			side_panel_controller.close();
2690		}
2691	}
2692
2693	checkSidePanel = debounce(checkSidePanel, 40);
2694
2695	checkSidePanel();
2696	window.addEventListener('resize', checkSidePanel);
2697});

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.