PageSourceSearch

https://i-sosna.ru/bitrix/templates/adaptive/js/jquery.carousel.js?178544501632709

js i-sosna.ru collected 2026-10-04 16:07:57 UTC 32,709 bytes, 647 lines download raw bytes

1$(document).ready(function() {
2
3// page init
4jQuery(function(){
5	initCarousel();
6});
7
8// scroll gallery init
9function initCarousel() {
10	// jQuery('div.carousel1').scrollGallery({
11	// 	mask: 'div.gmask',
12	// 	slider: '.slideset',
13	// 	slides: '.slide',
14	// 	currentNumber: 'span.cur-num',
15	// 	totalNumber: 'span.all-num',
16	// 	disableWhileAnimating: true,
17	// 	generatePagination: 'div.pagination',
18	// 	circularRotation: true,
19	// 	pauseOnHover: false,
20	// 	autoRotation: false,
21	// 	maskAutoSize: false,
22	// 	switchTime: 2000,
23	// 	animSpeed: 600,
24	// 	step: 4
25	// });
26
27
28	$('div.carousel1 .slideset').each(function(){
29
30		if ($(this).closest('.js-tab-content').length == 0) {
31			initSlickSlider($(this));
32		} else {
33			if ($(this).closest('.js-tab-content.active').length != 0){
34				initSlickSlider($(this));	
35			}
36		}
37
38	})
39
40}
41
42function initSlickSlider($this){
43
44	var curSlider = $this,
45		curSliderWRP = curSlider.closest('.carousel1'),
46		prevBtn = curSliderWRP.find('.btn-prev'),
47		nextBtn = curSliderWRP.find('.btn-next');
48
49	curSlider.slick({
50		arrows:false,
51		dots: false,
52		draggable: true,
53		infinite: true,
54		speed: 300,
55		slidesToShow: 3,
56		centerMode: false,
57		variableWidth: false,
58		touchThreshold: 100,
59		responsive: [
60		{
61		  breakpoint: 767,
62		  settings: {
63		    slidesToShow: 3,
64		    slidesToScroll: 1,
65		    variableWidth: false,
66		  }
67		},
68		{
69		  breakpoint: 600,
70		  settings: {
71		    slidesToShow: 2,
72		    slidesToScroll: 1,
73		    variableWidth: false,
74		  }
75		},
76		{
77		  breakpoint: 480,
78		  settings: {
79		    slidesToShow: 1,
80		    slidesToScroll: 1,
81		    variableWidth: false,
82		  }
83		}
84		]
85	});	
86
87	prevBtn.on('click', function(event) {
88		event.preventDefault();
89		curSlider.slick('slickPrev');
90	});
91
92	nextBtn.on('click', function(event) {
93		event.preventDefault();
94		curSlider.slick('slickNext');
95	});
96
97}
98
99
100// TABS
101	$(document).on('click', '.new-main-tabs--last .js-tab-head', function(){
102
103	  var curItem = $(this);
104	  var curIndex = curItem.closest('li').index();
105	  curItem.addClass('active');
106	  curItem.closest('li').siblings('li').find('.js-tab-head').removeClass('active');
107
108	  var otherTabs = curItem.closest('.js-tab').find('.js-tab-content');
109	  otherTabs.each(function(){
110	  	$(this).removeClass('active');
111	  	$(this).find('.slideset.slick-initialized').slick('unslick');
112	  })
113
114	  var curTab = curItem.closest('.js-tab').find('.js-tab-content').eq(curIndex);
115	  curTab.addClass('active');
116	  var curSlider = curTab.find('.slideset');
117	  initSlickSlider(curSlider);
118
119	})
120
121
122
123    var sliderResize;
124    $(window).resize(function(){
125		clearTimeout(sliderResize);
126		sliderResize = setTimeout(function () {
127			if ($('.slideset.slick-initialized:not(:visible)').length != 0){
128				$('.slideset.slick-initialized:not(:visible)').slick('unslick');	
129			}
130		}, 1000);
131    });
132
133
134/*
135 * jQuery Carousel plugin
136 */
137;(function($){
138	function ScrollGallery(options) {
139		this.options = $.extend({
140			mask: 'div.mask',
141			slider: '>*',
142			slides: '>*',
143			activeClass:'active',
144			disabledClass:'disabled',
145			btnPrev: 'a.btn-prev',
146			btnNext: 'a.btn-next',
147			generatePagination: false,
148			pagerList: '<ul>',
149			pagerListItem: '<li><a href="#"></a></li>',
150			pagerListItemText: 'a',
151			pagerLinks: '.pagination li',
152			currentNumber: 'span.current-num',
153			totalNumber: 'span.total-num',
154			btnPlay: '.btn-play',
155			btnPause: '.btn-pause',
156			btnPlayPause: '.btn-play-pause',
157			galleryReadyClass: 'gallery-js-ready',
158			autorotationActiveClass: 'autorotation-active',
159			autorotationDisabledClass: 'autorotation-disabled',
160			stretchSlideToMask: false,
161			circularRotation: true,
162			disableWhileAnimating: false,
163			autoRotation: false,
164			pauseOnHover: isTouchDevice ? false : true,
165			maskAutoSize: false,
166			switchTime: 4000,
167			animSpeed: 600,
168			event:'click',
169			swipeThreshold: 15,
170			handleTouch: true,
171			vertical: false,
172			useTranslate3D: false,
173			step: false
174		}, options);
175		this.init();
176	}
177	ScrollGallery.prototype = {
178		init: function() {
179			if(this.options.holder) {
180				this.findElements();
181				this.attachEvents();
182				this.refreshPosition();
183				this.refreshState(true);
184				this.resumeRotation();
185				this.makeCallback('onInit', this);
186			}
187		},
188		findElements: function() {
189			// define dimensions proporties
190			this.fullSizeFunction = this.options.vertical ? 'outerHeight' : 'outerWidth';
191			this.innerSizeFunction = this.options.vertical ? 'height' : 'width';
192			this.slideSizeFunction = 'outerHeight';
193			this.maskSizeProperty = 'height';
194			this.animProperty = this.options.vertical ? 'marginTop' : 'marginLeft';
195
196			// control elements
197			this.gallery = $(this.options.holder).addClass(this.options.galleryReadyClass);
198			this.mask = this.gallery.find(this.options.mask);
199			this.slider = this.mask.find(this.options.slider);
200			this.slides = this.slider.find(this.options.slides);
201			this.btnPrev = this.gallery.find(this.options.btnPrev);
202			this.btnNext = this.gallery.find(this.options.btnNext);
203			this.currentStep = 0; this.stepsCount = 0;
204
205			// get start index
206			if(this.options.step === false) {
207				var activeSlide = this.slides.filter('.'+this.options.activeClass);
208				if(activeSlide.length) {
209					this.currentStep = this.slides.index(activeSlide);
210				}
211			}
212
213			// calculate offsets
214			this.calculateOffsets();
215
216			// create gallery pagination
217			if(typeof this.options.generatePagination === 'string') {
218				this.pagerLinks = $();
219				this.buildPagination();
220			} else {
221				this.pagerLinks = this.gallery.find(this.options.pagerLinks);
222				this.attachPaginationEvents();
223			}
224
225			// autorotation control buttons
226			this.btnPlay = this.gallery.find(this.options.btnPlay);
227			this.btnPause = this.gallery.find(this.options.btnPause);
228			this.btnPlayPause = this.gallery.find(this.options.btnPlayPause);
229
230			// misc elements
231			this.curNum = this.gallery.find(this.options.currentNumber);
232			this.allNum = this.gallery.find(this.options.totalNumber);
233		},
234		attachEvents: function() {
235			// bind handlers scope
236			var self = this;
237			this.bindHandlers(['onWindowResize']);
238			$(window).bind('load resize orientationchange', this.onWindowResize);
239
240			// previous and next button handlers
241			if(this.btnPrev.length) {
242				this.prevSlideHandler = function(e) {
243					e.preventDefault();
244					self.prevSlide();
245				};
246				this.btnPrev.bind(this.options.event, this.prevSlideHandler);
247			}
248			if(this.btnNext.length) {
249				this.nextSlideHandler = function(e) {
250					e.preventDefault();
251					self.nextSlide();
252				};
253				this.btnNext.bind(this.options.event, this.nextSlideHandler);
254			}
255
256			// pause on hover handling
257			if(this.options.pauseOnHover && !isTouchDevice) {
258				this.hoverHandler = function() {
259					if(self.options.autoRotation) {
260						self.galleryHover = true;
261						self.pauseRotation();
262					}
263				};
264				this.leaveHandler = function() {
265					if(self.options.autoRotation) {
266						self.galleryHover = false;
267						self.resumeRotation();
268					}
269				};
270				this.gallery.bind({mouseenter: this.hoverHandler, mouseleave: this.leaveHandler});
271			}
272
273			// autorotation buttons handler
274			if(this.btnPlay.length) {
275				this.btnPlayHandler = function(e) {
276					e.preventDefault();
277					self.startRotation();
278				};
279				this.btnPlay.bind(this.options.event, this.btnPlayHandler);
280			}
281			if(this.btnPause.length) {
282				this.btnPauseHandler = function(e) {
283					e.preventDefault();
284					self.stopRotation();
285				};
286				this.btnPause.bind(this.options.event, this.btnPauseHandler);
287			}
288			if(this.btnPlayPause.length) {
289				this.btnPlayPauseHandler = function(e) {
290					e.preventDefault();
291					if(!self.gallery.hasClass(self.options.autorotationActiveClass)) {
292						self.startRotation();
293					} else {
294						self.stopRotation();
295					}
296				};
297				this.btnPlayPause.bind(this.options.event, this.btnPlayPauseHandler);
298			}
299
300			// enable hardware acceleration
301			if(isTouchDevice && this.options.useTranslate3D) {
302				this.slider.css({'-webkit-transform': 'translate3d(0px, 0px, 0px)'});
303			}
304
305			// swipe event handling
306			if(isTouchDevice && this.options.handleTouch && window.Hammer && this.mask.length) {
307				this.swipeHandler = Hammer(this.mask[0], {
308					dragBlockHorizontal: !this.options.vertical,
309					dragBlockVertical: this.options.vertical,
310					dragMinDistance: 1,
311					behavior: {
312						touchAction: this.options.vertical ? 'pan-x' : 'pan-y'
313					}
314				}).on('touch release ' + (self.options.vertical ? 'dragup dragdown' : 'dragleft dragright'), function(e) {
315					switch(e.type) {
316						case 'touch':
317							if(self.galleryAnimating) {
318								e.gesture.stopDetect();
319							} else {
320								self.pauseRotation();
321								self.originalOffset = parseFloat(self.slider.css(self.animProperty));
322							}
323							break;
324						case 'dragup':
325						case 'dragdown':
326						case 'dragleft':
327						case 'dragright':
328							e.gesture.preventDefault();
329							var tmpOffset = self.originalOffset + e.gesture[self.options.vertical ? 'deltaY' : 'deltaX'];
330							tmpOffset = Math.max(Math.min(0, tmpOffset), self.maxOffset);
331							self.slider.css(self.animProperty, tmpOffset);
332							break;
333						case 'release':
334							self.resumeRotation();
335							if(Math.abs(e.gesture[self.options.vertical ? 'deltaY' : 'deltaX']) > self.options.swipeThreshold) {
336								if(e.gesture.direction == 'left' || e.gesture.direction == 'up') {
337									self.nextSlide();
338								} else {
339									self.prevSlide();
340								}
341							} else {
342								self.switchSlide();
343							}
344					}
345				});
346			}
347		},
348		onWindowResize: function() {
349			if(!this.galleryAnimating) {
350				this.calculateOffsets();
351				this.refreshPosition();
352				this.buildPagination();
353				this.refreshState();
354				this.resizeQueue = false;
355			} else {
356				this.resizeQueue = true;
357			}
358		},
359		refreshPosition: function() {
360			this.currentStep = Math.min(this.currentStep, this.stepsCount - 1);
361			this.tmpProps = {};
362			this.tmpProps[this.animProperty] = this.getStepOffset();
363			this.slider.stop().css(this.tmpProps);
364		},
365		calculateOffsets: function() {
366			var self = this, tmpOffset, tmpStep;
367			if(this.options.stretchSlideToMask) {
368				var tmpObj = {};
369				tmpObj[this.innerSizeFunction] = this.mask[this.innerSizeFunction]();
370				this.slides.css(tmpObj);
371			}
372
373			this.maskSize = this.mask[this.innerSizeFunction]();
374			this.sumSize = this.getSumSize();
375			this.maxOffset = this.maskSize - this.sumSize;
376
377			// vertical gallery with single size step custom behavior
378			if(this.options.vertical && this.options.maskAutoSize) {
379				this.options.step = 1;
380				this.stepsCount = this.slides.length;
381				this.stepOffsets = [0];
382				tmpOffset = 0;
383				for(var i = 0; i < this.slides.length; i++) {
384					tmpOffset -= $(this.slides[i])[this.fullSizeFunction](true);
385					this.stepOffsets.push(tmpOffset);
386				}
387				this.maxOffset = tmpOffset;
388				return;
389			}
390
391			// scroll by slide size
392			if(typeof this.options.step === 'number' && this.options.step > 0) {
393				this.slideDimensions = [];
394				this.slides.each($.proxy(function(ind, obj){
395					self.slideDimensions.push( $(obj)[self.fullSizeFunction](true) );
396				},this));
397
398				// calculate steps count
399				this.stepOffsets = [0];
400				this.stepsCount = 1;
401				tmpOffset = tmpStep = 0;
402				while(tmpOffset > this.maxOffset) {
403					tmpOffset -= this.getSlideSize(tmpStep, tmpStep + this.options.step);
404					tmpStep += this.options.step;
405					this.stepOffsets.push(Math.max(tmpOffset, this.maxOffset));
406					this.stepsCount++;
407				}
408			}
409			// scroll by mask size
410			else {
411				// define step size
412				this.stepSize = this.maskSize;
413
414				// calculate steps count
415				this.stepsCount = 1;
416				tmpOffset = 0;
417				while(tmpOffset > this.maxOffset) {
418					tmpOffset -= this.stepSize;
419					this.stepsCount++;
420				}
421			}
422		},
423		getSumSize: function() {
424			var sum = 0;
425			this.slides.each($.proxy(function(ind, obj){
426				sum += $(obj)[this.fullSizeFunction](true);
427			},this));
428			this.slider.css(this.innerSizeFunction, sum);
429			return sum;
430		},
431		getStepOffset: function(step) {
432			step = step || this.currentStep;
433			if(typeof this.options.step === 'number') {
434				return this.stepOffsets[this.currentStep];
435			} else {
436				return Math.min(0, Math.max(-this.currentStep * this.stepSize, this.maxOffset));
437			}
438		},
439		getSlideSize: function(i1, i2) {
440			var sum = 0;
441			for(var i = i1; i < Math.min(i2, this.slideDimensions.length); i++) {
442				sum += this.slideDimensions[i];
443			}
444			return sum;
445		},
446		buildPagination: function() {
447			if(typeof this.options.generatePagination === 'string') {
448				if(!this.pagerHolder) {
449					this.pagerHolder = this.gallery.find(this.options.generatePagination);
450				}
451				if(this.pagerHolder.length && this.oldStepsCount != this.stepsCount) {
452					this.oldStepsCount = this.stepsCount;
453					this.pagerHolder.empty();
454					this.pagerList = $(this.options.pagerList).appendTo(this.pagerHolder);
455					for(var i = 0; i < this.stepsCount; i++) {
456						$(this.options.pagerListItem).appendTo(this.pagerList).find(this.options.pagerListItemText).text(i+1);
457					}
458					this.pagerLinks = this.pagerList.children();
459					this.attachPaginationEvents();
460				}
461			}
462		},
463		attachPaginationEvents: function() {
464			var self = this;
465			this.pagerLinksHandler = function(e) {
466				e.preventDefault();
467				self.numSlide(self.pagerLinks.index(e.currentTarget));
468			};
469			this.pagerLinks.bind(this.options.event, this.pagerLinksHandler);
470		},
471		prevSlide: function() {
472			if(!(this.options.disableWhileAnimating && this.galleryAnimating)) {
473				if(this.currentStep > 0) {
474					this.currentStep--;
475					this.switchSlide();
476				} else if(this.options.circularRotation) {
477					this.currentStep = this.stepsCount - 1;
478					this.switchSlide();
479				}
480			}
481		},
482		nextSlide: function(fromAutoRotation) {
483			if(!(this.options.disableWhileAnimating && this.galleryAnimating)) {
484				if(this.currentStep < this.stepsCount - 1) {
485					this.currentStep++;
486					this.switchSlide();
487				} else if(this.options.circularRotation || fromAutoRotation === true) {
488					this.currentStep = 0;
489					this.switchSlide();
490				}
491			}
492		},
493		numSlide: function(c) {
494			if(this.currentStep != c) {
495				this.currentStep = c;
496				this.switchSlide();
497			}
498		},
499		switchSlide: function() {
500			var self = this;
501			this.galleryAnimating = true;
502			this.tmpProps = {};
503			this.tmpProps[this.animProperty] = this.getStepOffset();
504			this.slider.stop().animate(this.tmpProps, {duration: this.options.animSpeed, complete: function(){
505				// animation complete
506				self.galleryAnimating = false;
507				if(self.resizeQueue) {
508					self.onWindowResize();
509				}
510
511				// onchange callback
512				self.makeCallback('onChange', self);
513				self.autoRotate();
514			}});
515			this.refreshState();
516
517			// onchange callback
518			this.makeCallback('onBeforeChange', this);
519		},
520		refreshState: function(initial) {
521			if(this.options.step === 1 || this.stepsCount === this.slides.length) {
522				this.slides.removeClass(this.options.activeClass).eq(this.currentStep).addClass(this.options.activeClass);
523			}
524			this.pagerLinks.removeClass(this.options.activeClass).eq(this.currentStep).addClass(this.options.activeClass);
525			this.curNum.html(this.currentStep+1);
526			this.allNum.html(this.stepsCount);
527
528			// initial refresh
529			if(this.options.maskAutoSize && typeof this.options.step === 'number') {
530				this.tmpProps = {};
531				this.tmpProps[this.maskSizeProperty] = this.slides.eq(Math.min(this.currentStep,this.slides.length-1))[this.slideSizeFunction](true);
532				this.mask.stop()[initial ? 'css' : 'animate'](this.tmpProps);
533			}
534
535			// disabled state
536			if(!this.options.circularRotation) {
537				this.btnPrev.add(this.btnNext).removeClass(this.options.disabledClass);
538				if(this.currentStep === 0) this.btnPrev.addClass(this.options.disabledClass);
539				if(this.currentStep === this.stepsCount - 1) this.btnNext.addClass(this.options.disabledClass);
540			}
541
542			// add class if not enough slides
543			this.gallery.toggleClass('not-enough-slides', this.sumSize <= this.maskSize);
544		},
545		startRotation: function() {
546			this.options.autoRotation = true;
547			this.galleryHover = false;
548			this.autoRotationStopped = false;
549			this.resumeRotation();
550		},
551		stopRotation: function() {
552			this.galleryHover = true;
553			this.autoRotationStopped = true;
554			this.pauseRotation();
555		},
556		pauseRotation: function() {
557			this.gallery.addClass(this.options.autorotationDisabledClass);
558			this.gallery.removeClass(this.options.autorotationActiveClass);
559			clearTimeout(this.timer);
560		},
561		resumeRotation: function() {
562			if(!this.autoRotationStopped) {
563				this.gallery.addClass(this.options.autorotationActiveClass);
564				this.gallery.removeClass(this.options.autorotationDisabledClass);
565				this.autoRotate();
566			}
567		},
568		autoRotate: function() {
569			var self = this;
570			clearTimeout(this.timer);
571			if(this.options.autoRotation && !this.galleryHover && !this.autoRotationStopped) {
572				this.timer = setTimeout(function(){
573					self.nextSlide(true);
574				}, this.options.switchTime);
575			} else {
576				this.pauseRotation();
577			}
578		},
579		bindHandlers: function(handlersList) {
580			var self = this;
581			$.each(handlersList, function(index, handler) {
582				var origHandler = self[handler];
583				self[handler] = function() {
584					return origHandler.apply(self, arguments);
585				};
586			});
587		},
588		makeCallback: function(name) {
589			if(typeof this.options[name] === 'function') {
590				var args = Array.prototype.slice.call(arguments);
591				args.shift();
592				this.options[name].apply(this, args);
593			}
594		},
595		destroy: function() {
596			// destroy handler
597			$(window).unbind('load resize orientationchange', this.onWindowResize);
598			this.btnPrev.unbind(this.options.event, this.prevSlideHandler);
599			this.btnNext.unbind(this.options.event, this.nextSlideHandler);
600			this.pagerLinks.unbind(this.options.event, this.pagerLinksHandler);
601			this.gallery.unbind('mouseenter', this.hoverHandler);
602			this.gallery.unbind('mouseleave', this.leaveHandler);
603
604			// autorotation buttons handlers
605			this.stopRotation();
606			this.btnPlay.unbind(this.options.event, this.btnPlayHandler);
607			this.btnPause.unbind(this.options.event, this.btnPauseHandler);
608			this.btnPlayPause.unbind(this.options.event, this.btnPlayPauseHandler);
609
610			// destroy swipe handler
611			if(this.swipeHandler) {
612				this.swipeHandler.dispose();
613			}
614
615			// remove inline styles, classes and pagination
616			var unneededClasses = [this.options.galleryReadyClass, this.options.autorotationActiveClass, this.options.autorotationDisabledClass];
617			this.gallery.removeClass(unneededClasses.join(' '));
618			this.slider.add(this.slides).removeAttr('style');
619			if(typeof this.options.generatePagination === 'string') {
620				this.pagerHolder.empty();
621			}
622		}
623	};
624
625	// detect device type
626	var isTouchDevice = /Windows Phone/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
627
628	// jquery plugin
629	$.fn.scrollGallery = function(opt){
630		return this.each(function(){
631			$(this).data('ScrollGallery', new ScrollGallery($.extend(opt,{holder:this})));
632		});
633	};
634}(jQuery));
635
636/*! Hammer.JS - v1.1.3 - 2014-05-20
637 * http://eightmedia.github.io/hammer.js
638 *
639 * Copyright (c) 2014 Jorik Tangelder <[email protected]>;
640 * Licensed under the MIT license */
641!function(a,b){"use strict";function c(){d.READY||(s.determineEventTypes(),r.each(d.gestures,function(a){u.register(a)}),s.onTouch(d.DOCUMENT,n,u.detect),s.onTouch(d.DOCUMENT,o,u.detect),d.READY=!0)}var d=function v(a,b){return new v.Instance(a,b||{})};d.VERSION="1.1.3",d.defaults={behavior:{userSelect:"none",touchAction:"pan-y",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},d.DOCUMENT=document,d.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,d.HAS_TOUCHEVENTS="ontouchstart"in a,d.IS_MOBILE=/mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent),d.NO_MOUSEEVENTS=d.HAS_TOUCHEVENTS&&d.IS_MOBILE||d.HAS_POINTEREVENTS,d.CALCULATE_INTERVAL=25;var e={},f=d.DIRECTION_DOWN="down",g=d.DIRECTION_LEFT="left",h=d.DIRECTION_UP="up",i=d.DIRECTION_RIGHT="right",j=d.POINTER_MOUSE="mouse",k=d.POINTER_TOUCH="touch",l=d.POINTER_PEN="pen",m=d.EVENT_START="start",n=d.EVENT_MOVE="move",o=d.EVENT_END="end",p=d.EVENT_RELEASE="release",q=d.EVENT_TOUCH="touch";d.READY=!1,d.plugins=d.plugins||{},d.gestures=d.gestures||{};var r=d.utils={extend:function(a,c,d){for(var e in c)!c.hasOwnProperty(e)||a[e]!==b&&d||(a[e]=c[e]);return a},on:function(a,b,c){a.addEventListener(b,c,!1)},off:function(a,b,c){a.removeEventListener(b,c,!1)},each:function(a,c,d){var e,f;if("forEach"in a)a.forEach(c,d);else if(a.length!==b){for(e=0,f=a.length;f>e;e++)if(c.call(d,a[e],e,a)===!1)return}else for(e in a)if(a.hasOwnProperty(e)&&c.call(d,a[e],e,a)===!1)return},inStr:function(a,b){return a.indexOf(b)>-1},inArray:function(a,b){if(a.indexOf){var c=a.indexOf(b);return-1===c?!1:c}for(var d=0,e=a.length;e>d;d++)if(a[d]===b)return d;return!1},toArray:function(a){return Array.prototype.slice.call(a,0)},hasParent:function(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1},getCenter:function(a){var b=[],c=[],d=[],e=[],f=Math.min,g=Math.max;return 1===a.length?{pageX:a[0].pageX,pageY:a[0].pageY,clientX:a[0].clientX,clientY:a[0].clientY}:(r.each(a,function(a){b.push(a.pageX),c.push(a.pageY),d.push(a.clientX),e.push(a.clientY)}),{pageX:(f.apply(Math,b)+g.apply(Math,b))/2,pageY:(f.apply(Math,c)+g.apply(Math,c))/2,clientX:(f.apply(Math,d)+g.apply(Math,d))/2,clientY:(f.apply(Math,e)+g.apply(Math,e))/2})},getVelocity:function(a,b,c){return{x:Math.abs(b/a)||0,y:Math.abs(c/a)||0}},getAngle:function(a,b){var c=b.clientX-a.clientX,d=b.clientY-a.clientY;return 180*Math.atan2(d,c)/Math.PI},getDirection:function(a,b){var c=Math.abs(a.clientX-b.clientX),d=Math.abs(a.clientY-b.clientY);return c>=d?a.clientX-b.clientX>0?g:i:a.clientY-b.clientY>0?h:f},getDistance:function(a,b){var c=b.clientX-a.clientX,d=b.clientY-a.clientY;return Math.sqrt(c*c+d*d)},getScale:function(a,b){return a.length>=2&&b.length>=2?this.getDistance(b[0],b[1])/this.getDistance(a[0],a[1]):1},getRotation:function(a,b){return a.length>=2&&b.length>=2?this.getAngle(b[1],b[0])-this.getAngle(a[1],a[0]):0},isVertical:function(a){return a==h||a==f},setPrefixedCss:function(a,b,c,d){var e=["","Webkit","Moz","O","ms"];b=r.toCamelCase(b);for(var f=0;f<e.length;f++){var g=b;if(e[f]&&(g=e[f]+g.slice(0,1).toUpperCase()+g.slice(1)),g in a.style){a.style[g]=(null==d||d)&&c||"";break}}},toggleBehavior:function(a,b,c){if(b&&a&&a.style){r.each(b,function(b,d){r.setPrefixedCss(a,d,b,c)});var d=c&&function(){return!1};"none"==b.userSelect&&(a.onselectstart=d),"none"==b.userDrag&&(a.ondragstart=d)}},toCamelCase:function(a){return a.replace(/[_-]([a-z])/g,function(a){return a[1].toUpperCase()})}},s=d.event={preventMouseEvents:!1,started:!1,shouldDetect:!1,on:function(a,b,c,d){var e=b.split(" ");r.each(e,function(b){r.on(a,b,c),d&&d(b)})},off:function(a,b,c,d){var e=b.split(" ");r.each(e,function(b){r.off(a,b,c),d&&d(b)})},onTouch:function(a,b,c){var f=this,g=function(e){var g,h=e.type.toLowerCase(),i=d.HAS_POINTEREVENTS,j=r.inStr(h,"mouse");j&&f.preventMouseEvents||(j&&b==m&&0===e.button?(f.preventMouseEvents=!1,f.shouldDetect=!0):i&&b==m?f.shouldDetect=1===e.buttons||t.matchType(k,e):j||b!=m||(f.preventMouseEvents=!0,f.shouldDetect=!0),i&&b!=o&&t.updatePointer(b,e),f.shouldDetect&&(g=f.doDetect.call(f,e,b,a,c)),g==o&&(f.preventMouseEvents=!1,f.shouldDetect=!1,t.reset()),i&&b==o&&t.updatePointer(b,e))};return this.on(a,e[b],g),g},doDetect:function(a,b,c,d){var e=this.getTouchList(a,b),f=e.length,g=b,h=e.trigger,i=f;b==m?h=q:b==o&&(h=p,i=e.length-(a.changedTouches?a.changedTouches.length:1)),i>0&&this.started&&(g=n),this.started=!0;var j=this.collectEventData(c,g,e,a);return b!=o&&d.call(u,j),h&&(j.changedLength=i,j.eventType=h,d.call(u,j),j.eventType=g,delete j.changedLength),g==o&&(d.call(u,j),this.started=!1),g},determineEventTypes:function(){var b;return b=d.HAS_POINTEREVENTS?a.PointerEvent?["pointerdown","pointermove","pointerup pointercancel lostpointercapture"]:["MSPointerDown","MSPointerMove","MSPointerUp MSPointerCancel MSLostPointerCapture"]:d.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],e[m]=b[0],e[n]=b[1],e[o]=b[2],e},getTouchList:function(a,b){if(d.HAS_POINTEREVENTS&&!(navigator.msPointerEnabled&&!navigator.pointerEnabled))return t.getTouchList();if(a.touches){if(b==n)return a.touches;var c=[],e=[].concat(r.toArray(a.touches),r.toArray(a.changedTouches)),f=[];return r.each(e,function(a){r.inArray(c,a.identifier)===!1&&f.push(a),c.push(a.identifier)}),f}return a.identifier=1,[a]},collectEventData:function(a,b,c,d){var e=k;return r.inStr(d.type,"mouse")||t.matchType(j,d)?e=j:t.matchType(l,d)&&(e=l),{center:r.getCenter(c),timeStamp:Date.now(),target:d.target,touches:c,eventType:b,pointerType:e,srcEvent:d,preventDefault:function(){var a=this.srcEvent;a.preventManipulation&&a.preventManipulation(),a.preventDefault&&a.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return u.stopDetect()}}}},t=d.PointerEvent={pointers:{},getTouchList:function(){var a=[];return r.each(this.pointers,function(b){a.push(b)}),a},updatePointer:function(a,b){a==o||a!=o&&1!==b.buttons?delete this.pointers[b.pointerId]:(b.identifier=b.pointerId,this.pointers[b.pointerId]=b)},matchType:function(a,b){if(!b.pointerType)return!1;var c=b.pointerType,d={};return d[j]=c===(b.MSPOINTER_TYPE_MOUSE||j),d[k]=c===(b.MSPOINTER_TYPE_TOUCH||k),d[l]=c===(b.MSPOINTER_TYPE_PEN||l),d[a]},reset:function(){this.pointers={}}}
641,u=d.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(a,b){this.current||(this.stopped=!1,this.current={inst:a,startEvent:r.extend({},b),lastEvent:!1,lastCalcEvent:!1,futureCalcEvent:!1,lastCalcData:{},name:""},this.detect(b))},detect:function(a){if(this.current&&!this.stopped){a=this.extendEventData(a);var b=this.current.inst,c=b.options;return r.each(this.gestures,function(d){!this.stopped&&b.enabled&&c[d.name]&&d.handler.call(d,a,b)},this),this.current&&(this.current.lastEvent=a),a.eventType==o&&this.stopDetect(),a}},stopDetect:function(){this.previous=r.extend({},this.current),this.current=null,this.stopped=!0},getCalculatedData:function(a,b,c,e,f){var g=this.current,h=!1,i=g.lastCalcEvent,j=g.lastCalcData;i&&a.timeStamp-i.timeStamp>d.CALCULATE_INTERVAL&&(b=i.center,c=a.timeStamp-i.timeStamp,e=a.center.clientX-i.center.clientX,f=a.center.clientY-i.center.clientY,h=!0),(a.eventType==q||a.eventType==p)&&(g.futureCalcEvent=a),(!g.lastCalcEvent||h)&&(j.velocity=r.getVelocity(c,e,f),j.angle=r.getAngle(b,a.center),j.direction=r.getDirection(b,a.center),g.lastCalcEvent=g.futureCalcEvent||a,g.futureCalcEvent=a),a.velocityX=j.velocity.x,a.velocityY=j.velocity.y,a.interimAngle=j.angle,a.interimDirection=j.direction},extendEventData:function(a){var b=this.current,c=b.startEvent,d=b.lastEvent||c;(a.eventType==q||a.eventType==p)&&(c.touches=[],r.each(a.touches,function(a){c.touches.push({clientX:a.clientX,clientY:a.clientY})}));var e=a.timeStamp-c.timeStamp,f=a.center.clientX-c.center.clientX,g=a.center.clientY-c.center.clientY;return this.getCalculatedData(a,d.center,e,f,g),r.extend(a,{startEvent:c,deltaTime:e,deltaX:f,deltaY:g,distance:r.getDistance(c.center,a.center),angle:r.getAngle(c.center,a.center),direction:r.getDirection(c.center,a.center),scale:r.getScale(c.touches,a.touches),rotation:r.getRotation(c.touches,a.touches)}),a},register:function(a){var c=a.defaults||{};return c[a.name]===b&&(c[a.name]=!0),r.extend(d.defaults,c,!0),a.index=a.index||1e3,this.gestures.push(a),this.gestures.sort(function(a,b){return a.index<b.index?-1:a.index>b.index?1:0}),this.gestures}};d.Instance=function(a,b){var e=this;c(),this.element=a,this.enabled=!0,r.each(b,function(a,c){delete b[c],b[r.toCamelCase(c)]=a}),this.options=r.extend(r.extend({},d.defaults),b||{}),this.options.behavior&&r.toggleBehavior(this.element,this.options.behavior,!0),this.eventStartHandler=s.onTouch(a,m,function(a){e.enabled&&a.eventType==m?u.startDetect(e,a):a.eventType==q&&u.detect(a)}),this.eventHandlers=[]},d.Instance.prototype={on:function(a,b){var c=this;return s.on(c.element,a,b,function(a){c.eventHandlers.push({gesture:a,handler:b})}),c},off:function(a,b){var c=this;return s.off(c.element,a,b,function(a){var d=r.inArray({gesture:a,handler:b});d!==!1&&c.eventHandlers.splice(d,1)}),c},trigger:function(a,b){b||(b={});var c=d.DOCUMENT.createEvent("Event");c.initEvent(a,!0,!0),c.gesture=b;var e=this.element;return r.hasParent(b.target,e)&&(e=b.target),e.dispatchEvent(c),this},enable:function(a){return this.enabled=a,this},dispose:function(){var a,b;for(r.toggleBehavior(this.element,this.options.behavior,!1),a=-1;b=this.eventHandlers[++a];)r.off(this.element,b.gesture,b.handler);return this.eventHandlers=[],s.off(this.element,e[m],this.eventStartHandler),null}},function(a){function b(b,d){var e=u.current;if(!(d.options.dragMaxTouches>0&&b.touches.length>d.options.dragMaxTouches))switch(b.eventType){case m:c=!1;break;case n:if(b.distance<d.options.dragMinDistance&&e.name!=a)return;var j=e.startEvent.center;if(e.name!=a&&(e.name=a,d.options.dragDistanceCorrection&&b.distance>0)){var k=Math.abs(d.options.dragMinDistance/b.distance);j.pageX+=b.deltaX*k,j.pageY+=b.deltaY*k,j.clientX+=b.deltaX*k,j.clientY+=b.deltaY*k,b=u.extendEventData(b)}(e.lastEvent.dragLockToAxis||d.options.dragLockToAxis&&d.options.dragLockMinDistance<=b.distance)&&(b.dragLockToAxis=!0);var l=e.lastEvent.direction;b.dragLockToAxis&&l!==b.direction&&(b.direction=r.isVertical(l)?b.deltaY<0?h:f:b.deltaX<0?g:i),c||(d.trigger(a+"start",b),c=!0),d.trigger(a,b),d.trigger(a+b.direction,b);var q=r.isVertical(b.direction);(d.options.dragBlockVertical&&q||d.options.dragBlockHorizontal&&!q)&&b.preventDefault();break;case p:c&&b.changedLength<=d.options.dragMaxTouches&&(d.trigger(a+"end",b),c=!1);break;case o:c=!1}}var c=!1;d.gestures.Drag={name:a,index:50,handler:b,defaults:{dragMinDistance:10,dragDistanceCorrection:!0,dragMaxTouches:1,dragBlockHorizontal:!1,dragBlockVertical:!1,dragLockToAxis:!1,dragLockMinDistance:25}}}("drag"),d.gestures.Gesture={name:"gesture",index:1337,handler:function(a,b){b.trigger(this.name,a)}},function(a){function b(b,d){var e=d.options,f=u.current;switch(b.eventType){case m:clearTimeout(c),f.name=a,c=setTimeout(function(){f&&f.name==a&&d.trigger(a,b)},e.holdTimeout);break;case n:b.distance>e.holdThreshold&&clearTimeout(c);break;case p:clearTimeout(c)}}var c;d.gestures.Hold={name:a,index:10,defaults:{holdTimeout:500,holdThreshold:2},handler:b}}("hold"),d.gestures.Release={name:"release",index:1/0,handler:function(a,b){a.eventType==p&&b.trigger(this.name,a)}},d.gestures.Swipe={name:"swipe",index:40,defaults:{swipeMinTouches:1,swipeMaxTouches:1,swipeVelocityX:.6,swipeVelocityY:.6},handler:function(a,b){if(a.eventType==p){var c=a.touches.length,d=b.options;if(c<d.swipeMinTouches||c>d.swipeMaxTouches)return;(a.velocityX>d.swipeVelocityX||a.velocityY>d.swipeVelocityY)&&(b.trigger(this.name,a),b.trigger(this.name+a.direction,a))}}},function(a){function b(b,d){var e,f,g=d.options,h=u.current,i=u.previous;switch(b.eventType){case m:c=!1;break;case n:c=c||b.distance>g.tapMaxDistance;break;case o:!r.inStr(b.srcEvent.type,"cancel")&&b.deltaTime<g.tapMaxTime&&!c&&(e=i&&i.lastEvent&&b.timeStamp-i.lastEvent.timeStamp,f=!1,i&&i.name==a&&e&&e<g.doubleTapInterval&&b.distance<g.doubleTapDistance&&(d.trigger("doubletap",b),f=!0),(!f||g.tapAlways)&&(h.name=a,d.trigger(h.name,b)))}}var c=!1;d.gestures.Tap={name:a,index:100,handler:b,defaults:{tapMaxTime:250,tapMaxDistance:10,tapAlways:!0,doubleTapDistance:20,doubleTapInterval:300}}}("tap"),d.gestures.Touch={name:"touch",index:-1/0,defaults:{preventDefault:!1,preventMouse:!1},handler:function(a,b){return b.options.preventMouse&&a.pointerType==j?void a.stopDetect():(b.options.preventDefault&&a.preventDefault(),void(a.eventType==q&&b.trigger("touch",a)))}},function(a){function b(b,d){switch(b.eventType){case m:c=!1;break;case n:if(b.touches.length<2)return;var e=Math.abs(1-b.scale),f=Math.abs(b.rotation);if(e<d.options.transformMinScale&&f<d.options.transformMinRotation)return;u.current.name=a,c||(d.trigger(a+"start",b),c=!0),d.trigger(a,b),f>d.options.transformMinRotation&&d.trigger("rotate",b),e>d.options.transformMinScale&&(d.trigger("pinch",b),d.trigger("pinch"+(b.scale<1?"in":"out"),b));break;case p:c&&b.changedLength<2&&(d.trigger(a+"end",b),c=!1)}}var c=!1;d.gestures.Transform={name:a,index:45,defaults:{transformMinScale:.01,transformMinRotation:1},handler:b}}("transform"),"function"==typeof define&&define.amd?define(function(){return d}):"undefined"!=typeof module&&module.exports?module.exports=d:a.Hammer=d}(window);
642
643
644
645
646});
647

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.