PageSourceSearch

https://natyazhnoy-potolok.su/t/v1645/images/js/main.js

js natyazhnoy-potolok.su collected 2026-09-30 14:17:10 UTC 44,399 bytes, 1,508 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$(function () {
152	$(document).click(function (event) {
153		$('.contacts-block').each(function() {
154			if ($(event.target).closest($(this)).length) {
155				return;
156			} else {
157				$(this).find('.tgl-but').prop("checked", false);
158				$(this).find('.icon').removeClass('active');
159			}
160		});
161	});
162
163	function setMargin($block) {
164		if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
165			$block.find(".block-body-drop").css({
166				"margin-left": "0px"
167			});
168		} else {
169			var left = $block.offset().left * -1;
170			$block.find(".block-body-drop").css({
171				"margin-left": left + "px"
172			});
173		}
174	}
175
176	$('.contacts-block').each(function() {
177		var $block = $(this),
178			allClasses = $block.attr("class").split(" "),
179			mainClass = allClasses[0],
180			mainSelector = ".side-panel ."+mainClass+" .block-body-drop",
181			styles = document.styleSheets;
182
183		for(var i = 0; i < styles.length; i++) {
184			if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
185				for(var j = 0; j < styles[i].cssRules.length; j++) {
186					if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
187						$block.data("fullwidth", 1);
188						setMargin($block);
189						break;
190					}
191				}
192				break;
193			}
194		}
195	});
196
197	$(window).resize(function() {
198		$('.contacts-block').each(function() {
199			var $block = $(this);
200			if ($block.data("fullwidth") == 1) {
201				setMargin($block);
202			}
203		});
204	});
205
206	$('.contacts-block').each(function() {
207		var $block = $(this);
208		$block.find('.icon').click(function() {
209			if ($block.data("fullwidth") == 1) {
210				setMargin($block);
211			}
212			if ($block.find('.tgl-but').prop("checked")) {
213				$(this).removeClass('active');
214			} else {
215				$(this).addClass('active');
216			}
217		});
218	});
219});
220/*
221 *  wmS3Menu v1.0.0
222 *  K.I. 433
223 */
224;(function ($, window, document, undefined ) {
225	var pluginName = 'wmS3Menu',
226		defaults = {
227			screenButton: false,
228			responsiveTl: false,
229			responsiveTp: false,
230			responsiveMl: false,
231			moreText: '...',
232			childIcons: false,
233			childIconsClass: 'has-child-icon'
234		};
235	// Проверка на касание
236	var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
237	var $win = $(window);
238	var winWidth = $win.width();
239	var $doc = $(document);
240
241	var pluginObj = {
242		_events: {
243			hover: function(menuWrap, item, settings){
244				var link = item.find('> a');
245				var linkIcon = link.find('.' + settings.childIconsClass);
246				var iconLen = linkIcon.length;
247				var subMenu = item.find('> ul');
248				var showTimeout;
249				// Отображение
250				function menuShow() {
251					clearTimeout(showTimeout);
252					item.siblings().find('> ul').css('display', '');
253					// Определение положения выпадашки чтобы не выводилось за пределы окна
254					pluginObj._menuPosition(subMenu);
255
256					link.addClass('hover');
257					if (iconLen) {
258						linkIcon.addClass('hover');
259					}
260				}
261				// Скрытие
262				function menuHide() {
263					showTimeout = setTimeout(function(){
264						link.removeClass('hover');
265						subMenu.css('display', '');
266						if (iconLen) {
267							linkIcon.removeClass('hover');
268						}
269					}, 500);
270				}
271				// Отключение и подключение событий
272				item.off({
273					'mouseenter.wmS3Menu': menuShow,
274					'mouseleave.wmS3Menu': menuHide
275				});
276				item.on({
277					'mouseenter.wmS3Menu': menuShow,
278					'mouseleave.wmS3Menu': menuHide
279				});
280			},
281			click: function(menuWrap, item, settings){
282				var link = item.find('> a');
283				var linkIcon = link.find('.' + settings.childIconsClass);
284				var iconLen = linkIcon.length;
285				var subMenu = item.find('> ul');
286				// Переключение отображения
287				function menuToggle() {
288					if (subMenu.is(':visible')) {
289						if (isTouchable) {
290							document.location = link.attr('href');
291						}
292						link.removeClass('hover');
293						subMenu.css('display', '');
294						item.removeClass('submenu-opened');
295						if (iconLen) {
296							linkIcon.removeClass('hover');
297						}
298					} else {
299						item.siblings().find('> ul').css('display', '');
300						item.siblings().find('> a').removeClass('hover');
301						item.siblings().find('> a .' + settings.childIconsClass).removeClass('hover');
302						// Определение положения выпадашки чтобы не выводилось за пределы окна
303						pluginObj._menuPosition(subMenu);
304
305						link.addClass('hover');
306						item.addClass('submenu-opened');
307						if (iconLen) {
308							linkIcon.addClass('hover');
309						}
310					}
311					return false;
312				}
313				// Отключение и подключение событий
314				link.off('click.wmS3Menu');
315				link.on('click.wmS3Menu', menuToggle);
316			},
317			click_tree: function(menuWrap, item, settings){
318				var link = item.find('> a');
319				var linkIcon = link.find('.' + settings.childIconsClass);
320				var subMenu = item.find('> ul');
321				// Переключение отображения
322				function menuToggle(event) {
323					var targ = $(event.target);
324
325					if (targ.closest(linkIcon).length) {
326						if (subMenu.is(':visible')) {
327							link.removeClass('hover');
328							subMenu.css('display', '');
329							item.removeClass('submenu-opened');
330							linkIcon.removeClass('hover');
331						} else {
332							// Определение положения выпадашки чтобы не выводилось за пределы окна
333							pluginObj._menuPosition(subMenu);
334
335							link.addClass('hover');
336							item.addClass('submenu-opened');
337							linkIcon.addClass('hover');
338						}
339						return false;
340					}
341				}
342				// Отключение и подключение событий
343				link.off('click.wmS3Menu');
344				link.on('click.wmS3Menu', menuToggle);
345			}
346		},
347		_menuPosition: function(subMenu) {
348			// Определение положения выпадашки чтобы не выводилось за пределы окна
349			winWidth = $win.width();
350
351			subMenu.css('display', 'block');
352
353			if (subMenu.parent().hasClass('first-level') === false) {
354				subMenu.css({
355					'visibility': 'hidden',
356					'opacity': 0
357				});
358
359				var menuRect = subMenu[0].getBoundingClientRect();
360				var marginR = parseInt(subMenu.css('margin-right'));
361				var parentWidth = subMenu.parent().width();
362
363				if (marginR > parentWidth) {
364					subMenu.css('margin-right', parentWidth);
365				}
366
367				if (menuRect.right >= winWidth) {
368					subMenu.css({
369						'left': '-100%',
370						'margin-left': 0
371					});
372				}
373				subMenu.css({
374					'visibility': '',
375					'opacity': ''
376				});
377			}
378		}
379	};
380	function Plugin(element, options) {
381		this.element = element;
382
383		this.options = $.extend({}, defaults, options, $(this.element).data()) ;
384
385		this._defaults = defaults;
386		this._name = pluginName;
387
388		this.init();
389	}
390	Plugin.prototype = {
391		init: function () {
392			var settings = this.options;
393			// Определение ширины медиа
394			var moreButFlag = false;
395			if (window.matchMedia('all and (max-width: 480px)').matches) {
396				moreButFlag = settings.responsiveMl;
397			} else if (window.matchMedia('all and (max-width: 640px)').matches) {
398				//moreButFlag = settings.responsiveTp;
399			} else if (window.matchMedia('all and (max-width: 768px)').matches) {
400				moreButFlag = settings.responsiveTl;
401			} else {
402				moreButFlag = settings.screenButton;
403			}
404			// Обертка меню
405			var menuWrap = $(this.element);
406			var menuClass = menuWrap.attr('class');
407			var menuMainUl = $(this.element.querySelector('ul'));
408			var widgetClass = menuClass.match(/widget-\d+/)[0];
409			// Проверка на наличие меню в Side panel
410			if (window.side_panel_controller && side_panel_controller.inPanel(widgetClass)) {
411				moreButFlag = false;
412			}
413
414			menuMainUl.children().addClass('first-level');
415			// Настройки для горизонтального меню
416			if (!!menuClass.match(/horizontal/i)) {
417				var menuWidth = menuMainUl.width();
418				var itemsWidth = 0, hideArr = [], hideLength;
419				// Кнопка More
420				var moreBut = menuMainUl.find('.more-button');
421				if (!moreBut.length) {
422					moreBut = $('<li class="more-button"><a href="#"><span>' + settings.moreText + '</span></a></li>');// data-trigger="click"
423					menuMainUl.append(moreBut);
424				}
425				// Меню More
426				var moreMenu = moreBut.find('> ul');
427				if (!moreMenu.length) {
428					moreMenu = $('<ul></ul>');
429					moreBut.append(moreMenu);
430				}
431
432				moreBut.removeClass('removed').attr('data-trigger', 'hover');
433				menuMainUl.children().css('display', '');
434
435				var firstLevelItems = menuMainUl.children(':visible').not('.more-button');
436				moreMenu.html('');
437
438				if (moreButFlag === 'more' || moreButFlag === 'button') {
439					moreBut.removeClass('disabled');
440
441					menuWidth -= moreBut.outerWidth();
442
443					firstLevelItems.each(function(){
444						var thisItem = $(this);
445						itemsWidth += thisItem.outerWidth(true);
446						if (itemsWidth >= menuWidth) {
447							hideArr.push(thisItem.clone());
448							thisItem.hide();
449						}
450					});
451
452					hideLength = hideArr.length;
453					if (hideLength) {
454						for (var ind = 0; ind < hideLength; ind++) {
455							moreMenu.append(hideArr[ind]);
456						}
457						moreBut.removeClass('disabled');
458					} else {
459						moreBut.addClass('disabled');
460					}
461				} else {
462					moreBut.addClass('disabled');
463				}
464			}
465			// Вложенные подуровни меню
466			var menuInner = menuMainUl.find('ul');
467			var menuItems = menuInner.parent();
468			var menuLinks = menuItems.find('> a');
469			// Стрелочки для подуровней
470			var menuLinksIcons = menuLinks.find('.' + settings.childIconsClass);
471			var childIconLen = menuLinksIcons.length;
472			// Тип отображения меню
473			var mShow = 'popup';
474			if (!!menuClass.match(/dropdown/i)) {
475				mShow = 'dropdown';
476			} else if (!!menuClass.match(/treemenu/i)) {
477				mShow = 'treemenu';
478			}
479			if (mShow === 'popup') {
480				menuInner.hide();
481			}
482			if (childIconLen) {
483				menuLinksIcons.remove();
484			}
485			if (!!settings.childIcons) {
486				// Добавление стрелочек для подуровней
487				var childIconHTML = '<em class="' + settings.childIconsClass + '"></em>';
488
489				if (mShow === 'treemenu') {
490					childIconHTML = '<em class="' + settings.childIconsClass + '"><b style="position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;"></b></em>';
491				}
492
493				var childIconTag = $(childIconHTML);
494				menuLinks.append(childIconTag.clone());
495
496				menuLinksIcons = menuLinks.find('.' + settings.childIconsClass);
497				childIconLen = menuLinksIcons.length;
498			}
499			// Удаление всех событий на ссылках
500			menuLinks.removeClass('hover').off('click.wmS3Menu');
501			menuInner.css('display', '');
502			if (childIconLen) {
503				menuLinksIcons.removeClass('hover');
504			}
505
506			menuItems.each(function() {
507				var thisItem = $(this);
508				var trigger = thisItem.data('trigger') || 'hover';
509
510				if (mShow === 'dropdown' || isTouchable) {
511					trigger = 'click';
512				} else if (mShow === 'treemenu') {
513					trigger = 'click_tree';
514				}
515				pluginObj._events[trigger](menuWrap, thisItem, settings);
516			});
517			// Клик по документу
518			if (isTouchable) {
519				function docClick(e) {
520					var target = $(e.target);
521					if (target.closest(menuWrap).length === 0) {
522						menuLinks.removeClass('hover');
523						menuInner.css('display', '');
524						menuItems.removeClass('submenu-opened');
525
526						if (childIconLen) {
527							menuLinksIcons.removeClass('hover');
528						}
529					}
530				}
531				$doc.off('touchstart.wmS3Menu', docClick);
532				$doc.on('touchstart.wmS3Menu', docClick);
533			}
534		},
535		update: function () {
536			this.init();
537		}
538	};
539	if (!$.fn[pluginName]) {
540		$.fn[pluginName] = function (options) {
541			var args = arguments;
542			if (options === undefined || typeof options === 'object') {
543				return this.each(function () {
544					if (!$.data(this, 'plugin_' + pluginName)) {
545						$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
546					}
547				});
548			} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
549				var returns;
550				this.each(function () {
551					var instance = $.data(this, 'plugin_' + pluginName);
552					if (instance instanceof Plugin && typeof instance[options] === 'function') {
553						returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
554					}
555					if (options === 'destroy') {
556						$.data(this, 'plugin_' + pluginName, null);
557					}
558				});
559				return returns !== undefined ? returns : this;
560			}
561		};
562	}
563	$(function () {
564		var wmMenuWrap = $('.wm-widget-menu.horizontal');
565		wmMenuWrap[pluginName]();
566
567		$win.on('resize.wmS3Menu', function(){
568			wmMenuWrap[pluginName]('update');
569		});
570	});
571
572	setTimeout(function(){
573		$win.trigger('resize');
574	}, 500);
575}(jQuery, window, document));
576$(function() {
577
578	var debounce = (function () {
579		return function (fn, time) {
580			var timer, func;
581			func = function() {
582				var args = [].slice.call(arguments, 0);
583				window.clearTimeout(timer);
584				timer = window.setTimeout(function () {
585					window.requestAnimationFrame && window.requestAnimationFrame(function() {
586						fn.apply(null, args);
587					}) || fn.apply(null, args);
588				}, time)
589			};
590			return func;
591		}
592	}());
593
594	var throttle = (function() {
595		return function (fn, threshhold, scope) {
596			threshhold || (threshhold = 250);
597			var last,
598				deferTimer,
599				func;
600			func = function () {
601				var context = scope || this;
602				var now = +new Date,
603					args = arguments;
604				if (last && now < last + threshhold) {
605					// hold on to it
606					clearTimeout(deferTimer);
607					deferTimer = setTimeout(function () {
608						last = now;
609						fn.apply(context, args);
610					}, threshhold);
611				} else {
612					last = now;
613					fn.apply(context, args);
614				}
615			};
616			return func;
617		}
618	}());
619
620	$('.bx-reviews').each(function() {
621		var $reviews = $(this),
622			$items = $reviews.find('.item-outer'),
623			$list = $reviews.find('.list'),
624			$body = $reviews.find('.body'),
625			$controls = $reviews.find('.controls'),
626			$pagers = $reviews.find('.bx-pager-wrap'),
627			options = {},
628			auto_controls_arr,
629			count,
630			col_arr, pager_arr, controls_arr,
631			bxslider,
632			containerWidth,
633			isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
634			slider_arr = $reviews.attr('data-slider').split(","),
635			swipe_arr = $reviews.attr('data-swipe').split(",");
636
637		if (slider_arr.indexOf('1')>-1 && $.fn.bxSlider) {
638
639			options.pagerSelector= $reviews.attr('data-setting-pager_selector');
640			options.prevSelector = $reviews.attr('data-setting-prev_selector');
641			options.nextSelector = $reviews.attr('data-setting-next_selector');
642			options.prevText = $reviews.attr('data-setting-prev_text') || '';
643			options.nextText = $reviews.attr('data-setting-next_text') || '';
644			options.auto = !!parseInt($reviews.attr('data-setting-auto'));
645			options.controls = !!parseInt($reviews.attr('data-setting-controls'));
646			options.pager = !!parseInt($reviews.attr('data-setting-pager').split(',')[0]);
647			options.pause = parseInt($reviews.attr('data-setting-pause'), 10) || 4000;
648			options.useCSS = isMobile;
649			options.infiniteLoop = true;
650			options.adaptiveHeight = false;
651			options.mode = $reviews.attr('data-setting-mode') || 'horizontal';
652			options.touchEnabled = options.mode === 'horizontal';
653			options.slideMargin = 0;
654            options.maxSlides = parseInt($reviews.attr('data-setting-count').split(',')[0], 10) || 1;
655			options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides;
656			options.moveSlides = $reviews.attr('data-setting-move') || 0;
657			options.autoControlsSelector = $reviews.attr('data-setting-auto_controls_selector');
658			options.autoControls =  !!parseInt($reviews.attr('data-setting-auto_controls').split(',')[0]);
659			options.autoControlsCombine =  !!parseInt($reviews.attr('data-setting-autoControlsCombine'));
660			options.autoHover = true;
661
662			col_arr = $reviews.attr('data-setting-columns').split(",");
663			pager_arr = $reviews.attr('data-setting-pager').split(",");
664			controls_arr = $reviews.attr('data-setting-controls').split(",");
665			auto_controls_arr = $reviews.attr('data-setting-auto_controls').split(",");
666
667			if (!options.autoControls && options.auto) {
668				options.onSlideAfter = function() {
669					bxslider.startAuto();
670				}
671			}
672
673			$items.removeClass('hidden');
674			if ($list.parent().hasClass('bx-viewport')) {
675				$list.unwrap();
676				$list.unwrap();
677			}
678
679			function init(force) {
680				var media_type,
681					body_width = $('body').width();
682
683				var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"];
684				var media_ind, setting_columns,
685					isJustify, space_between;
686				var slider_arr = $reviews.attr('data-slider').split(",");
687
688				var newContainerWidth = $reviews.width(), itemHeight, viewportHeight;
689				if (!$reviews.is(':visible')) {
690					if (bxslider) {
691						bxslider.destroySlider();
692					}
693					return;
694				}
695				if (force!='force' && containerWidth && containerWidth === newContainerWidth) {
696					return;
697				}
698				containerWidth = newContainerWidth;
699
700				if (bxslider) {
701					bxslider.destroySlider();
702				}
703
704				if (body_width >= 961) {
705					media_type = "screen";
706				} else if (body_width <= 960 && body_width >= 769) {
707					media_type = "tablet_landscape";
708				} else if (body_width <= 768 && body_width >= 641) {
709					media_type = "tablet_portrait";
710				} else if (body_width <= 640 && body_width >= 481) {
711					media_type = "mobile_landscape";
712				} else if (body_width <= 480) {
713					media_type = "mobile_portrait";
714				}
715				media_ind = mediaList.indexOf(media_type);
716				count = parseInt($reviews.attr('data-setting-count').split(',')[media_ind], 10);
717
718				isJustify = $body.css('justify-content') == "space-between" ? true : false;
719
720				$controls.css("pointer-events","none");
721				$controls.find('.prev').css("pointer-events","auto");
722				$controls.find('.next').css("pointer-events","auto");
723
724				$list.width('auto');
725				$items
726					.attr('style', '')
727					.slice(1).addClass('hidden').end()
728					.width(options.slideWidth = $items.width())
729					.removeClass('hidden');
730
731				if (pager_arr.length > 1) {
732					options.pager = !!parseInt(pager_arr[media_ind]);
733				}
734				if (controls_arr.length > 1) {
735					options.controls = !!parseInt(controls_arr[media_ind]);
736				}
737				if (auto_controls_arr.length > 1) {
738					options.autoControls = !!parseInt(auto_controls_arr[media_ind]);
739				}
740
741				$(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"});
742				$reviews.find(".controls").css({"display": options.controls == true ? "flex" : "none"});
743
744				if (options.mode === 'vertical') {
745					itemHeight = Math.max.apply(Math, $items.map(function() {
746						return $(this).height()
747					}).get());
748					$items.css('min-height', itemHeight);
749					viewportHeight = itemHeight * count;
750                    options.maxSlides = options.minSlides = count;
751				} else {
752					setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]);
753					if (setting_columns) {
754						count = setting_columns;
755					}
756					options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width()));
757				}
758
759				if (isJustify) {
760					if (options.maxSlides > 1) {
761						space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1));
762						space_between = space_between < 0 ? 0 : space_between;
763					} else {
764						space_between = 0;
765					}
766					options.slideMargin = space_between;
767				}
768
769				if ($items.length > options.maxSlides && slider_arr[media_ind] == 1) {
770					$list.css({'justify-content': 'flex-start'});
771					if (bxslider) {
772						bxslider.reloadSlider(options);
773					} else {
774						$list.data('bxslider', (bxslider = $list.bxSlider(options)));
775					}
776					if(options.pager){
777						$pagers.css('display', 'flex');
778					}
779				} else {
780					if(swipe_arr[media_ind]!=1){
781						$list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'wrap'});
782						$items.css('width', $items.width()-1);
783					} else {
784						$list.css({'flex-wrap': 'nowrap'});
785					}
786					$pagers.hide();
787					$controls.hide();
788				}
789
790				if (viewportHeight && slider_arr[media_ind] == 1) {
791					$list.parent().css('min-height', viewportHeight);
792				}
793				if (options.mode === 'horizontal') {
794					var align = {};
795					switch ($body.css('justify-content')) {
796						case 'flex-end':
797							align['margin-left'] = 'auto';
798							align['margin-right'] = '0px';
799							break;
800						case 'center':
801							align['margin-left'] = 'auto';
802							align['margin-right'] = 'auto';
803							break;
804						default:
805							align['margin-left'] = '0px';
806							align['margin-right'] = 'auto';
807					}
808					$reviews.find('.bx-wrapper').css(align);
809				}
810			}
811
812			$(window).on('resize', debounce(init, 300));
813			$(window).on('load', function(){
814				init('force');
815			});
816
817			init();
818		} else {
819			$pagers.hide();
820			$controls.hide();
821		}
822
823		$(window).on('resize', debounce(swipeScrollInit, 300));
824		swipeScrollInit();
825
826		function swipeScrollInit() {
827			var $shadowLeft = $reviews.find(".swipe-shadow-left");
828			var $shadowRight = $reviews.find(".swipe-shadow-right");
829			if ($list.css("overflow-x") == "auto") {
830				var scroll_width = $list.get(0).scrollWidth;
831				var view_width = $list.width();
832				$shadowLeft.css("pointer-events","none");
833				$shadowRight.css("pointer-events","none");
834
835				$list.off('scroll');
836				$list.on('scroll', throttle(swipeScrollCheack, 200));
837
838				swipeScrollCheack();
839
840				function swipeScrollCheack() {
841					var scroll_left = $list.scrollLeft();
842
843					if (scroll_left > 0) {
844						$shadowLeft.show();
845					} else {
846						$shadowLeft.hide();
847					}
848
849					if (scroll_left + view_width >= scroll_width - 1) {
850						$shadowRight.hide();
851					} else {
852						$shadowRight.show();
853					}
854				}
855			} else {
856				$shadowLeft.hide();
857				$shadowRight.hide();
858			}
859		}
860
861	});
862});
863document.addEventListener('DOMContentLoaded', function() {
864	var bodyScrollBarWidth = (function () {
865		var widthHidden, widthScroll, currentValue, currentPriority;
866		currentValue = document.body.style.getPropertyValue('overflow');
867		currentPriority = document.body.style.getPropertyPriority('overflow');
868		document.body.style.setProperty('overflow', 'hidden', 'important');
869		widthHidden = document.body.clientWidth;
870		document.body.style.setProperty('overflow', 'scroll', 'important');
871		widthScroll = document.body.clientWidth;
872		document.body.style.setProperty('overflow', currentValue ? currentValue : '', currentPriority);
873		return widthHidden - widthScroll;
874	}());
875	var media = {
876		'tablet-landscape': 960,
877		'tablet-portrait': 768,
878		'mobile-landscape': 640,
879		'mobile-portrait': 480
880	};
881	var side_panel = document.querySelector('.side-panel');
882	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;
883	var layers, content_width, flip, full_width, elements = {}, comments = {};
884
885	if (!side_panel || side_panel.classList.contains('removed')) {
886		return;
887	}
888
889	flip = side_panel.getAttribute('data-position') === 'right';
890
891	try {
892		layers = side_panel.getAttribute('data-layers');
893		if (layers !== "") {
894			layers = JSON.parse(layers.replace(/\[/g, '{').replace(/\]/g, '}').replace(/\'/g, '"'));
895		}
896	} catch(e) {
897		console.error(e);
898	}
899
900	if (typeof layers !== 'object' || Object.keys(layers).length === 0) {
901		return;
902	}
903
904	Object.keys(layers).forEach(function(clss) {
905		elements[clss] = document.querySelector('.' + clss);
906		comments[clss] = document.createComment(clss);
907		if (elements[clss]) {
908			elements[clss].parentNode.insertBefore(comments[clss], elements[clss]);
909		} else {
910			delete layers[clss];
911		}
912	});
913
914	side_panel_button = side_panel.querySelector('.side-panel-button');
915	side_panel_close = side_panel.querySelector('.side-panel-close');
916	side_panel_content = side_panel.querySelector('.side-panel-content');
917	side_panel_content_inner = side_panel.querySelector('.side-panel-content-inner') || side_panel_content;
918	side_panel_mask = side_panel.querySelector('.side-panel-mask');
919	side_panel_top = side_panel.querySelector('.side-panel-top-inner');
920
921	side_panel.classList.remove('hidden');
922	side_panel_button.classList.remove('hidden');
923	side_panel_button.style.display = 'none';
924	side_panel_content.classList.remove('hidden');
925	side_panel_content.style.display = 'none';
926	side_panel_mask.classList.remove('hidden');
927	side_panel_mask.style.display = 'none';
928
929	content_width = getComputedStyle(side_panel_content, null).width;
930
931	leftEdge = 0;
932	rightEdge = parseInt(content_width) + 50;
933
934	if (content_width === 'auto') {
935		rightEdge = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
936		full_width = true;
937	}
938
939	isPhantom = !!parseInt($(side_panel).attr("data-phantom"));
940
941	if (isPhantom) {
942		$(side_panel).css({"pointer-events": "none"});
943	} else {
944		$(side_panel).css({"pointer-events": "auto"});
945	}
946
947	if (flip) {
948		side_panel_content.style.left = 'auto';
949		side_panel_content.style.right = '0';
950	}
951
952	if (full_width) {
953		side_panel_content.style.left = '0';
954		side_panel_content.style.right = '0';
955	}
956
957	window.side_panel_controller = side_panel_controller = new DrawerController({
958		target: side_panel,
959		full_width: full_width,
960		left: leftEdge,
961		right: rightEdge,
962		position: 0,
963		flip: flip,
964		curve: 'ease-in-out',
965		willOpen: function() {
966			side_panel_mask.style.display = 'block';
967			side_panel_content.style.display = 'block';
968			document.body.classList.add('noscroll');
969			if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) {
970				document.body.style.borderRight = bodyScrollBarWidth + 'px solid transparent'
971			}
972		},
973		didClose: function() {
974			side_panel_mask.style.display = 'none';
975			side_panel_content.style.display = 'none';
976			document.body.classList.remove('noscroll');
977			if (bodyScrollBarWidth && document.documentElement.scrollHeight > document.documentElement.clientHeight) {
978				document.body.style.borderRight = ''
979			}
980		},
981		onAnimate: function(position) {
982			side_panel_mask.style.opacity = position / rightEdge;
983			side_panel_content.style.transform = 'translate3d(' + (flip ? rightEdge - position : position - rightEdge) + 'px,0,0)';
984		}
985	});
986
987	side_panel_controller.inPanel = function(clss) {
988		var viewportWidth;
989		var current_media;
990
991		if (typeof clss !== 'string') {
992			return false;
993		}
994
995		if (clss.charAt(0) === '.') {
996			clss = clss.slice(1);
997		}
998
999		viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1000
1001		Object.keys(media).forEach(function(key) {
1002			if (viewportWidth <= media[key]) {
1003				current_media = key;
1004			}
1005		});
1006
1007		if (typeof current_media === 'undefined') {
1008			current_media = 'screen';
1009		}
1010
1011		return layers[clss] && layers[clss][current_media];
1012	};
1013
1014	side_panel_button.addEventListener('click', function(e) {
1015		e.preventDefault();
1016		side_panel_controller.toggle();
1017		return false;
1018	});
1019
1020	if (side_panel_close) {
1021		side_panel_close.addEventListener('click', function(e) {
1022			e.preventDefault();
1023			side_panel_controller.close();
1024			return false;
1025		});
1026	}
1027
1028	side_panel_mask.addEventListener('click', function() {
1029		side_panel_controller.close();
1030		return false;
1031	});
1032
1033	document.addEventListener('keyup', function(e) {
1034		if (e.keyCode === 27) {
1035			side_panel_controller.close();
1036			return false;
1037		}
1038	});
1039
1040	var debounce = (function () {
1041		return function (fn, time) {
1042			var timer, func;
1043			if (window.requestAnimationFrame) {
1044				func = function() {
1045					timer && cancelAnimationFrame(timer);
1046					timer = requestAnimationFrame(fn);
1047				}
1048			} else {
1049				func = function() {
1050					window.clearTimeout(timer);
1051					timer = window.setTimeout(function () {
1052						fn();
1053					}, time)
1054				};
1055			}
1056			return func;
1057		}
1058	}());
1059
1060	function checkSidePanel() {
1061		var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1062		var current_media;
1063		var emptySide = true;
1064		var emptyTop = true;
1065
1066		if (checkSidePanel.viewportWidth === viewportWidth) {
1067			return;
1068		}
1069
1070		checkSidePanel.viewportWidth = viewportWidth;
1071
1072		Object.keys(media).forEach(function(key) {
1073			if (viewportWidth <= media[key]) {
1074				current_media = key;
1075			}
1076		});
1077
1078		if (typeof current_media === 'undefined') {
1079			current_media = 'screen';
1080		}
1081
1082		Object.keys(layers).forEach(function(clss){
1083			var element, comment;
1084
1085			element = elements[clss];
1086			comment = comments[clss];
1087
1088			if (current_media in layers[clss]) {
1089				if (layers[clss][current_media] === 'onTop') {
1090					side_panel_top.appendChild(element);
1091					emptyTop = false;
1092				} else {
1093					side_panel_content_inner.appendChild(element);
1094					emptySide = false;
1095				}
1096			} else {
1097				if (comment) {
1098					comment.parentNode.insertBefore(element, comment);
1099				}
1100			}
1101		});
1102
1103		if (emptySide) {
1104			side_panel_button.style.display = 'none';
1105		} else {
1106			side_panel_button.style.display = 'block';
1107		}
1108
1109		if (!emptyTop || !emptySide) {
1110			side_panel.style.display = 'block';
1111		} else {
1112			side_panel.style.display = 'none';
1113			side_panel_controller.close();
1114		}
1115	}
1116
1117	checkSidePanel = debounce(checkSidePanel, 40);
1118
1119	checkSidePanel();
1120	window.addEventListener('resize', checkSidePanel);
1121});
1122/*
1123 * @license
1124 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
1125 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
1126 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
1127 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
1128 * Code distributed by Google as part of the polymer project is also
1129 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
1130 */
1131
1132"use strict";
1133
1134(function (exports) {
1135
1136	function sign(number) {
1137		if (number < 0)
1138			return -1;
1139		if (number > 0)
1140			return 1;
1141		return 0;
1142	}
1143
1144	function Animator(delegate) {
1145		this.delegate = delegate;
1146		this.startTimeStamp = 0;
1147		this.request_ = null;
1148	};
1149
1150	Animator.prototype.scheduleAnimation = function () {
1151		if (this.request_)
1152			return;
1153		this.request_ = requestAnimationFrame(this.onAnimation_.bind(this));
1154	};
1155
1156	Animator.prototype.startAnimation = function () {
1157		this.startTimeStamp = 0;
1158		this.scheduleAnimation();
1159	};
1160
1161	Animator.prototype.stopAnimation = function () {
1162		cancelAnimationFrame(this.request_);
1163		this.startTimeStamp = 0;
1164		this.request_ = null;
1165	};
1166
1167	Animator.prototype.onAnimation_ = function (timeStamp) {
1168		this.request_ = null;
1169		if (!this.startTimeStamp)
1170			this.startTimeStamp = timeStamp;
1171		if (this.delegate.onAnimation(timeStamp))
1172			this.scheduleAnimation();
1173	};
1174
1175	function VelocityTracker() {
1176		this.recentTouchMoves_ = [];
1177		this.velocityX = 0;
1178		this.velocityY = 0;
1179	}
1180
1181	VelocityTracker.kTimeWindow = 50;
1182
1183	VelocityTracker.prototype.pruneHistory_ = function (timeStamp) {
1184		for (var i = 0; i < this.recentTouchMoves_.length; ++i) {
1185			if (this.recentTouchMoves_[i].timeStamp > timeStamp - VelocityTracker.kTimeWindow) {
1186				this.recentTouchMoves_ = this.recentTouchMoves_.slice(i);
1187				return;
1188			}
1189		}
1190		// All touchmoves are old.
1191		this.recentTouchMoves_ = [];
1192	};
1193
1194	VelocityTracker.prototype.update_ = function (e) {
1195		this.pruneHistory_(e.timeStamp);
1196		this.recentTouchMoves_.push(e);
1197
1198		var oldestTouchMove = this.recentTouchMoves_[0];
1199
1200		var deltaX = e.changedTouches[0].clientX - oldestTouchMove.changedTouches[0].clientX;
1201		var deltaY = e.changedTouches[0].clientY - oldestTouchMove.changedTouches[0].clientY;
1202		var deltaT = e.timeStamp - oldestTouchMove.timeStamp;
1203
1204		if (deltaT > 0) {
1205			this.velocityX = deltaX / deltaT;
1206			this.velocityY = deltaY / deltaT;
1207		} else {
1208			this.velocityX = 0;
1209			this.velocityY = 0;
1210		}
1211	};
1212
1213	VelocityTracker.prototype.onTouchStart = function (e) {
1214		this.recentTouchMoves_.push(e);
1215		this.velocityX = 0;
1216		this.velocityY = 0;
1217	};
1218
1219	VelocityTracker.prototype.onTouchMove = function (e) {
1220		this.update_(e);
1221	};
1222
1223	VelocityTracker.prototype.onTouchEnd = function (e) {
1224		this.update_(e);
1225		this.recentTouchMoves_ = [];
1226	};
1227
1228	function LinearTimingFunction() {
1229	};
1230
1231	LinearTimingFunction.prototype.scaleTime = function (fraction) {
1232		return fraction;
1233	};
1234
1235	function CubicBezierTimingFunction(spec) {
1236		this.map = [];
1237		for (var ii = 0; ii <= 100; ii += 1) {
1238			var i = ii / 100;
1239			this.map.push([
1240				3 * i * (1 - i) * (1 - i) * spec[0] +
1241				3 * i * i * (1 - i) * spec[2] + i * i * i,
1242				3 * i * (1 - i) * (1 - i) * spec[1] +
1243				3 * i * i * (1 - i) * spec[3] + i * i * i
1244			]);
1245		}
1246	};
1247
1248	CubicBezierTimingFunction.prototype.scaleTime = function (fraction) {
1249		var fst = 0;
1250		while (fst !== 100 && fraction > this.map[fst][0]) {
1251			fst += 1;
1252		}
1253		if (fraction === this.map[fst][0] || fst === 0) {
1254			return this.map[fst][1];
1255		}
1256		var yDiff = this.map[fst][1] - this.map[fst - 1][1];
1257		var xDiff = this.map[fst][0] - this.map[fst - 1][0];
1258		var p = (fraction - this.map[fst - 1][0]) / xDiff;
1259		return this.map[fst - 1][1] + p * yDiff;
1260	};
1261
1262	var presetTimingFunctions = {
1263		'linear': new LinearTimingFunction(),
1264		'ease': new CubicBezierTimingFunction([0.25, 0.1, 0.25, 1.0]),
1265		'ease-in': new CubicBezierTimingFunction([0.42, 0, 1.0, 1.0]),
1266		'ease-out': new CubicBezierTimingFunction([0, 0, 0.58, 1.0]),
1267		'ease-in-out': new CubicBezierTimingFunction([0.42, 0, 0.58, 1.0]),
1268	};
1269
1270	function DrawerController(options) {
1271		this.velocityTracker = new VelocityTracker();
1272		this.animator = new Animator(this);
1273
1274		this.target = options.target;
1275		this.left = options.left;
1276		this.right = options.right;
1277		this.position = options.position;
1278		this.flip = options.flip;
1279		this.full_width = options.full_width;
1280
1281		this.width = this.right - this.left;
1282		this.curve = presetTimingFunctions[options.curve || 'linear'];
1283
1284		this.willOpenCallback = options.willOpen;
1285		this.didCloseCallback = options.didClose;
1286		this.animateCallback = options.onAnimate;
1287
1288		this.state = DrawerController.kClosed;
1289
1290		this.defaultAnimationSpeed = (this.right - this.left) / DrawerController.kBaseSettleDurationMS;
1291
1292		this.onTouchMove = this.onTouchMove.bind(this);
1293		this.onTouchEnd = this.onTouchEnd.bind(this);
1294
1295		if (!this.full_width) {
1296			this.target.addEventListener('touchstart', this.onTouchStart.bind(this));
1297		}
1298	}
1299
1300	DrawerController.kOpened = 'opened';
1301	DrawerController.kClosed = 'closed';
1302	DrawerController.kOpening = 'opening';
1303	DrawerController.kClosing = 'closing';
1304	DrawerController.kDragging = 'dragging';
1305	DrawerController.kFlinging = 'flinging';
1306
1307	DrawerController.kBaseSettleDurationMS = 246;
1308	DrawerController.kMaxSettleDurationMS = 600;
1309
1310	DrawerController.kMinFlingVelocity = 0.4;  // Matches Android framework.
1311	DrawerController.kTouchSlop = 5;  // Matches Android framework.
1312	DrawerController.kTouchSlopSquare = DrawerController.kTouchSlop * DrawerController.kTouchSlop;
1313
1314	DrawerController.prototype.restrictToCurrent = function (offset) {
1315		return Math.max(this.left, Math.min(this.position, offset));
1316	};
1317
1318	DrawerController.prototype.restrictToBounds = function (offset) {
1319		return Math.max(this.left, Math.min(this.right, offset));
1320	};
1321
1322	DrawerController.prototype.onTouchStart = function (e) {
1323		this.velocityTracker.onTouchStart(e);
1324
1325		var touchX;
1326		if (this.flip) {
1327			touchX = document.documentElement.clientWidth - e.changedTouches[0].clientX;
1328		} else {
1329			touchX = e.changedTouches[0].clientX;
1330		}
1331		var touchY = e.changedTouches[0].clientY;
1332
1333		if (this.state != DrawerController.kOpened) {
1334			if (touchX != this.restrictToCurrent(touchX))
1335				return;
1336			this.state = DrawerController.kDragging;
1337		}
1338
1339		this.animator.stopAnimation();
1340		this.target.addEventListener('touchmove', this.onTouchMove);
1341		this.target.addEventListener('touchend', this.onTouchEnd);
1342		// TODO(abarth): Handle touchcancel.
1343
1344		this.startX = touchX;
1345		this.startY = touchY;
1346		this.startPosition = this.position;
1347		this.touchBaseX = Math.min(touchX, this.startPosition);
1348	};
1349
1350	DrawerController.prototype.onTouchMove = function (e) {
1351		this.velocityTracker.onTouchMove(e);
1352
1353		if (this.state == DrawerController.kOpened) {
1354			var deltaX;
1355			if (this.flip) {
1356				deltaX = document.documentElement.clientWidth - e.changedTouches[0].clientX - this.startX;
1357			} else {
1358				deltaX = e.changedTouches[0].clientX - this.startX;
1359			}
1360			var deltaY = e.changedTouches[0].clientY - this.startY;
1361
1362			if (deltaX * deltaX + deltaY * deltaY < DrawerController.kTouchSlopSquare) {
1363				e.preventDefault();
1364				return;
1365			}
1366
1367			if (Math.abs(deltaY) > Math.abs(deltaX)) {
1368				this.target.removeEventListener('touchmove', this.onTouchMove);
1369				this.target.removeEventListener('touchend', this.onTouchEnd);
1370				return;
1371			}
1372
1373			this.state = DrawerController.kDragging;
1374		}
1375
1376		e.preventDefault();
1377		var touchDeltaX;
1378		if (this.flip) {
1379			touchDeltaX = document.documentElement.clientWidth - e.changedTouches[0].clientX - this.touchBaseX;
1380		} else {
1381			touchDeltaX = e.changedTouches[0].clientX - this.touchBaseX;
1382		}
1383		this.position = this.restrictToBounds(this.startPosition + touchDeltaX);
1384		this.animator.scheduleAnimation();
1385	};
1386
1387	DrawerController.prototype.onTouchEnd = function (e) {
1388		this.velocityTracker.onTouchEnd(e);
1389		this.target.removeEventListener('touchmove', this.onTouchMove);
1390		this.target.removeEventListener('touchend', this.onTouchEnd);
1391
1392		var velocityX = this.velocityTracker.velocityX;
1393
1394		if (this.flip) {
1395			velocityX *= -1;
1396		}
1397
1398		if (Math.abs(velocityX) > DrawerController.kMinFlingVelocity) {
1399			this.fling(velocityX);
1400		} else if (this.isOpen()) {
1401			this.open();
1402		} else {
1403			this.close();
1404		}
1405	};
1406
1407	DrawerController.prototype.openFraction = function () {
1408		var width = this.right - this.left;
1409		var offset = this.position - this.left;
1410		return offset / width;
1411	};
1412
1413	DrawerController.prototype.isOpen = function () {
1414		return this.openFraction() >= 0.5;
1415	};
1416
1417	DrawerController.prototype.isOpening = function () {
1418		return this.state == DrawerController.kOpening ||
1419			(this.state == DrawerController.kFlinging && this.animationVelocityX > 0);
1420	}
1421
1422	DrawerController.prototype.isClosing = function () {
1423		return this.state == DrawerController.kClosing ||
1424			(this.state == DrawerController.kFlinging && this.animationVelocityX < 0);
1425	}
1426
1427	DrawerController.prototype.toggle = function () {
1428		if (this.isOpen())
1429			this.close();
1430		else
1431			this.open();
1432	};
1433
1434	DrawerController.prototype.open = function () {
1435		if (this.full_width) {
1436			this.willOpenCallback.call(this.target);
1437			return;
1438		}
1439		if (!this.position)
1440			this.willOpenCallback.call(this.target);
1441
1442		this.animator.stopAnimation();
1443		this.animationDuration = 400;
1444		this.state = DrawerController.kOpening;
1445		this.animate();
1446	};
1447
1448	DrawerController.prototype.close = function () {
1449		if (this.full_width) {
1450			this.didCloseCallback.call(this.target);
1451			return;
1452		}
1453		this.animator.stopAnimation();
1454		this.animationDuration = 400;
1455		this.state = DrawerController.kClosing;
1456		this.animate();
1457	};
1458
1459	DrawerController.prototype.fling = function (velocityX) {
1460		this.animator.stopAnimation();
1461		this.animationVelocityX = velocityX;
1462		this.state = DrawerController.kFlinging;
1463		this.animate();
1464	};
1465
1466	DrawerController.prototype.animate = function () {
1467		this.positionAnimationBase = this.position;
1468		this.animator.startAnimation();
1469	};
1470
1471	DrawerController.prototype.targetPosition = function (deltaT) {
1472		if (this.state == DrawerController.kFlinging)
1473			return this.positionAnimationBase + this.animationVelocityX * deltaT;
1474		var targetFraction = this.curve.scaleTime(deltaT / this.animationDuration);
1475		var animationWidth = this.state == DrawerController.kOpening ?
1476		this.width - this.positionAnimationBase : -this.positionAnimationBase;
1477		return this.positionAnimationBase + targetFraction * animationWidth;
1478	};
1479
1480	DrawerController.prototype.onAnimation = function (timeStamp) {
1481		if (this.state == DrawerController.kDragging) {
1482			this.animateCallback.call(this.target, this.position);
1483			return false;
1484		}
1485
1486		var deltaT = timeStamp - this.animator.startTimeStamp;
1487		var targetPosition = this.targetPosition(deltaT);
1488		this.position = this.restrictToBounds(targetPosition);
1489
1490		this.animateCallback.call(this.target, this.position);
1491
1492		if (targetPosition <= this.left && this.isClosing()) {
1493			this.state = DrawerController.kClosed;
1494			this.didCloseCallback.call(this.target);
1495			return false;
1496		}
1497		if (targetPosition >= this.right && this.isOpening()) {
1498			this.state = DrawerController.kOpened;
1499			return false;
1500		}
1501
1502		return true;
1503	};
1504
1505
1506	exports.DrawerController = DrawerController;
1507
1508})(window);

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.