diff --git a/demos/Basic_swipe.html b/demos/Basic_swipe.html index 2dc4ca5..2bb3a93 100755 --- a/demos/Basic_swipe.html +++ b/demos/Basic_swipe.html @@ -9,7 +9,7 @@ - + touchSwipe diff --git a/jquery.touchSwipe.js b/jquery.touchSwipe.js index fcccfe8..59259f4 100644 --- a/jquery.touchSwipe.js +++ b/jquery.touchSwipe.js @@ -193,11 +193,11 @@ PHASE_END = "end", PHASE_CANCEL = "cancel", - SUPPORTS_TOUCH = 'ontouchstart' in window, - + SUPPORTS_TOUCH = ('ontouchstart' in document), + SUPPORTS_POINTER_IE10 = window.navigator.msPointerEnabled && !window.PointerEvent && !SUPPORTS_TOUCH, - SUPPORTS_POINTER = (window.PointerEvent || window.navigator.msPointerEnabled) && !SUPPORTS_TOUCH, + SUPPORTS_POINTER = ('onpointerdown' in window || window.PointerEvent || window.navigator.msPointerEnabled) && !SUPPORTS_TOUCH, PLUGIN_NS = 'TouchSwipe'; @@ -458,13 +458,13 @@ //take a local/instacne level copy of the options - should make it this.options really... var options = $.extend({}, options); + var useTouchEvents = (SUPPORTS_TOUCH || SUPPORTS_POINTER || !options.fallbackToMouseEvents), - START_EV = useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerDown' : 'pointerdown') : 'touchstart') : 'mousedown', - MOVE_EV = useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerMove' : 'pointermove') : 'touchmove') : 'mousemove', - END_EV = useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerUp' : 'pointerup') : 'touchend') : 'mouseup', - LEAVE_EV = useTouchEvents ? (SUPPORTS_POINTER ? 'mouseleave' : null) : 'mouseleave', //we manually detect leave on touch devices, so null event here - CANCEL_EV = (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerCancel' : 'pointercancel') : 'touchcancel'); - + START_EV = useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerDown' : 'pointerdown') : 'touchstart') : 'mousedown', + MOVE_EV = useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerMove' : 'pointermove') : 'touchmove') : 'mousemove', + END_EV = useTouchEvents ? (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerUp' : 'pointerup touchend') : 'touchend') : 'mouseup', + LEAVE_EV = useTouchEvents ? (SUPPORTS_POINTER ? 'mouseleave' : 'pointerleave') : 'mouseleave', //we manually detect leave on touch devices, so null event here + CANCEL_EV = (SUPPORTS_POINTER ? (SUPPORTS_POINTER_IE10 ? 'MSPointerCancel' : 'pointercancel') : 'touchcancel'); //touch properties @@ -1598,24 +1598,16 @@ //Add or remove event listeners depending on touch status if (val === true) { $element.on(MOVE_EV, touchMove); - $element.on(END_EV, touchEnd); + $element.one(END_EV, function(e) { touchEnd(e); }); //we only have leave events on desktop, we manually calcuate leave on touch as its not supported in webkit if (LEAVE_EV) { - $element.on(LEAVE_EV, touchLeave); + $element.one(LEAVE_EV, touchLeave); } } else { - $element.off(MOVE_EV, touchMove, false); - $element.off(END_EV, touchEnd, false); - - //we only have leave events on desktop, we manually calcuate leave on touch as its not supported in webkit - if (LEAVE_EV) { - $element.off(LEAVE_EV, touchLeave, false); - } } - //strict equality to ensure only true and false can update the value $element.data(PLUGIN_NS + '_intouch', val === true); } @@ -1873,17 +1865,7 @@ * @param {DomNode} The DOM node to get the bounds for. */ function getbounds(el) { - el = $(el); - var offset = el.offset(); - - var bounds = { - left: offset.left, - right: offset.left + el.outerWidth(), - top: offset.top, - bottom: offset.top + el.outerHeight() - } - - return bounds; + return el.getBoundingClientRect(); } diff --git a/jquery.touchSwipe.min.js b/jquery.touchSwipe.min.js index 8ba8494..1dd0a11 100644 --- a/jquery.touchSwipe.min.js +++ b/jquery.touchSwipe.min.js @@ -1,7 +1,6 @@ /*! * @fileOverview TouchSwipe - jQuery Plugin * @version 1.6.18 - * * @author Matt Bryson http://www.github.com/mattbryson * @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin * @see http://labs.rampinteractive.co.uk/touchSwipe/ @@ -9,8 +8,7 @@ * @license * Copyright (c) 2010-2015 Matt Bryson * Dual licensed under the MIT or GPL Version 2 licenses. - * + ***This version modified to support Windows touch & click simultaneously*** + * https://github.com/justinputney/TouchSwipe-Jquery-Plugin */ - -!function(factory){"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],factory):factory("undefined"!=typeof module&&module.exports?require("jquery"):jQuery)}(function($){"use strict";function init(options){return!options||void 0!==options.allowPageScroll||void 0===options.swipe&&void 0===options.swipeStatus||(options.allowPageScroll=NONE),void 0!==options.click&&void 0===options.tap&&(options.tap=options.click),options||(options={}),options=$.extend({},$.fn.swipe.defaults,options),this.each(function(){var $this=$(this),plugin=$this.data(PLUGIN_NS);plugin||(plugin=new TouchSwipe(this,options),$this.data(PLUGIN_NS,plugin))})}function TouchSwipe(element,options){function touchStart(jqEvent){if(!(getTouchInProgress()||$(jqEvent.target).closest(options.excludedElements,$element).length>0)){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(!event.pointerType||"mouse"!=event.pointerType||0!=options.fallbackToMouseEvents){var ret,touches=event.touches,evt=touches?touches[0]:event;return phase=PHASE_START,touches?fingerCount=touches.length:options.preventDefaultEvents!==!1&&jqEvent.preventDefault(),distance=0,direction=null,currentDirection=null,pinchDirection=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,maximumsMap=createMaximumsData(),cancelMultiFingerRelease(),createFingerData(0,evt),!touches||fingerCount===options.fingers||options.fingers===ALL_FINGERS||hasPinches()?(startTime=getTimeStamp(),2==fingerCount&&(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)),(options.swipeStatus||options.pinchStatus)&&(ret=triggerHandler(event,phase))):ret=!1,ret===!1?(phase=PHASE_CANCEL,triggerHandler(event,phase),ret):(options.hold&&(holdTimeout=setTimeout($.proxy(function(){$element.trigger("hold",[event.target]),options.hold&&(ret=options.hold.call($element,event,event.target))},this),options.longTapThreshold)),setTouchInProgress(!0),null)}}}function touchMove(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(phase!==PHASE_END&&phase!==PHASE_CANCEL&&!inMultiFingerRelease()){var ret,touches=event.touches,evt=touches?touches[0]:event,currentFinger=updateFingerData(evt);if(endTime=getTimeStamp(),touches&&(fingerCount=touches.length),options.hold&&clearTimeout(holdTimeout),phase=PHASE_MOVE,2==fingerCount&&(0==startTouchesDistance?(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)):(updateFingerData(touches[1]),endTouchesDistance=calculateTouchesDistance(fingerData[0].end,fingerData[1].end),pinchDirection=calculatePinchDirection(fingerData[0].end,fingerData[1].end)),pinchZoom=calculatePinchZoom(startTouchesDistance,endTouchesDistance),pinchDistance=Math.abs(startTouchesDistance-endTouchesDistance)),fingerCount===options.fingers||options.fingers===ALL_FINGERS||!touches||hasPinches()){if(direction=calculateDirection(currentFinger.start,currentFinger.end),currentDirection=calculateDirection(currentFinger.last,currentFinger.end),validateDefaultEvent(jqEvent,currentDirection),distance=calculateDistance(currentFinger.start,currentFinger.end),duration=calculateDuration(),setMaxDistance(direction,distance),ret=triggerHandler(event,phase),!options.triggerOnTouchEnd||options.triggerOnTouchLeave){var inBounds=!0;if(options.triggerOnTouchLeave){var bounds=getbounds(this);inBounds=isInBounds(currentFinger.end,bounds)}!options.triggerOnTouchEnd&&inBounds?phase=getNextPhase(PHASE_MOVE):options.triggerOnTouchLeave&&!inBounds&&(phase=getNextPhase(PHASE_END)),phase!=PHASE_CANCEL&&phase!=PHASE_END||triggerHandler(event,phase)}}else phase=PHASE_CANCEL,triggerHandler(event,phase);ret===!1&&(phase=PHASE_CANCEL,triggerHandler(event,phase))}}function touchEnd(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent,touches=event.touches;if(touches){if(touches.length&&!inMultiFingerRelease())return startMultiFingerRelease(event),!0;if(touches.length&&inMultiFingerRelease())return!0}return inMultiFingerRelease()&&(fingerCount=fingerCountAtRelease),endTime=getTimeStamp(),duration=calculateDuration(),didSwipeBackToCancel()||!validateSwipeDistance()?(phase=PHASE_CANCEL,triggerHandler(event,phase)):options.triggerOnTouchEnd||options.triggerOnTouchEnd===!1&&phase===PHASE_MOVE?(options.preventDefaultEvents!==!1&&jqEvent.preventDefault(),phase=PHASE_END,triggerHandler(event,phase)):!options.triggerOnTouchEnd&&hasTap()?(phase=PHASE_END,triggerHandlerForGesture(event,phase,TAP)):phase===PHASE_MOVE&&(phase=PHASE_CANCEL,triggerHandler(event,phase)),setTouchInProgress(!1),null}function touchCancel(){fingerCount=0,endTime=0,startTime=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,cancelMultiFingerRelease(),setTouchInProgress(!1)}function touchLeave(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;options.triggerOnTouchLeave&&(phase=getNextPhase(PHASE_END),triggerHandler(event,phase))}function removeListeners(){$element.unbind(START_EV,touchStart),$element.unbind(CANCEL_EV,touchCancel),$element.unbind(MOVE_EV,touchMove),$element.unbind(END_EV,touchEnd),LEAVE_EV&&$element.unbind(LEAVE_EV,touchLeave),setTouchInProgress(!1)}function getNextPhase(currentPhase){var nextPhase=currentPhase,validTime=validateSwipeTime(),validDistance=validateSwipeDistance(),didCancel=didSwipeBackToCancel();return!validTime||didCancel?nextPhase=PHASE_CANCEL:!validDistance||currentPhase!=PHASE_MOVE||options.triggerOnTouchEnd&&!options.triggerOnTouchLeave?!validDistance&¤tPhase==PHASE_END&&options.triggerOnTouchLeave&&(nextPhase=PHASE_CANCEL):nextPhase=PHASE_END,nextPhase}function triggerHandler(event,phase){var ret,touches=event.touches;return(didSwipe()||hasSwipes())&&(ret=triggerHandlerForGesture(event,phase,SWIPE)),(didPinch()||hasPinches())&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,PINCH)),didDoubleTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,DOUBLE_TAP):didLongTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,LONG_TAP):didTap()&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,TAP)),phase===PHASE_CANCEL&&touchCancel(event),phase===PHASE_END&&(touches?touches.length||touchCancel(event):touchCancel(event)),ret}function triggerHandlerForGesture(event,phase,gesture){var ret;if(gesture==SWIPE){if($element.trigger("swipeStatus",[phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection]),options.swipeStatus&&(ret=options.swipeStatus.call($element,event,phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection),ret===!1))return!1;if(phase==PHASE_END&&validateSwipe()){if(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),$element.trigger("swipe",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipe&&(ret=options.swipe.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection),ret===!1))return!1;switch(direction){case LEFT:$element.trigger("swipeLeft",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeLeft&&(ret=options.swipeLeft.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case RIGHT:$element.trigger("swipeRight",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeRight&&(ret=options.swipeRight.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case UP:$element.trigger("swipeUp",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeUp&&(ret=options.swipeUp.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case DOWN:$element.trigger("swipeDown",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeDown&&(ret=options.swipeDown.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection))}}}if(gesture==PINCH){if($element.trigger("pinchStatus",[phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchStatus&&(ret=options.pinchStatus.call($element,event,phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData),ret===!1))return!1;if(phase==PHASE_END&&validatePinch())switch(pinchDirection){case IN:$element.trigger("pinchIn",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchIn&&(ret=options.pinchIn.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData));break;case OUT:$element.trigger("pinchOut",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchOut&&(ret=options.pinchOut.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData))}}return gesture==TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),hasDoubleTap()&&!inDoubleTap()?(doubleTapStartTime=getTimeStamp(),singleTapTimeout=setTimeout($.proxy(function(){doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target))},this),options.doubleTapThreshold)):(doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target)))):gesture==DOUBLE_TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),doubleTapStartTime=null,$element.trigger("doubletap",[event.target]),options.doubleTap&&(ret=options.doubleTap.call($element,event,event.target))):gesture==LONG_TAP&&(phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),doubleTapStartTime=null,$element.trigger("longtap",[event.target]),options.longTap&&(ret=options.longTap.call($element,event,event.target)))),ret}function validateSwipeDistance(){var valid=!0;return null!==options.threshold&&(valid=distance>=options.threshold),valid}function didSwipeBackToCancel(){var cancelled=!1;return null!==options.cancelThreshold&&null!==direction&&(cancelled=getMaxDistance(direction)-distance>=options.cancelThreshold),cancelled}function validatePinchDistance(){return null===options.pinchThreshold||pinchDistance>=options.pinchThreshold}function validateSwipeTime(){var result;return result=!options.maxTimeThreshold||!(duration>=options.maxTimeThreshold)}function validateDefaultEvent(jqEvent,direction){if(options.preventDefaultEvents!==!1)if(options.allowPageScroll===NONE)jqEvent.preventDefault();else{var auto=options.allowPageScroll===AUTO;switch(direction){case LEFT:(options.swipeLeft&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case RIGHT:(options.swipeRight&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case UP:(options.swipeUp&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case DOWN:(options.swipeDown&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case NONE:}}}function validatePinch(){var hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),hasCorrectDistance=validatePinchDistance();return hasCorrectFingerCount&&hasEndPoint&&hasCorrectDistance}function hasPinches(){return!!(options.pinchStatus||options.pinchIn||options.pinchOut)}function didPinch(){return!(!validatePinch()||!hasPinches())}function validateSwipe(){var hasValidTime=validateSwipeTime(),hasValidDistance=validateSwipeDistance(),hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),didCancel=didSwipeBackToCancel(),valid=!didCancel&&hasEndPoint&&hasCorrectFingerCount&&hasValidDistance&&hasValidTime;return valid}function hasSwipes(){return!!(options.swipe||options.swipeStatus||options.swipeLeft||options.swipeRight||options.swipeUp||options.swipeDown)}function didSwipe(){return!(!validateSwipe()||!hasSwipes())}function validateFingers(){return fingerCount===options.fingers||options.fingers===ALL_FINGERS||!SUPPORTS_TOUCH}function validateEndPoint(){return 0!==fingerData[0].end.x}function hasTap(){return!!options.tap}function hasDoubleTap(){return!!options.doubleTap}function hasLongTap(){return!!options.longTap}function validateDoubleTap(){if(null==doubleTapStartTime)return!1;var now=getTimeStamp();return hasDoubleTap()&&now-doubleTapStartTime<=options.doubleTapThreshold}function inDoubleTap(){return validateDoubleTap()}function validateTap(){return(1===fingerCount||!SUPPORTS_TOUCH)&&(isNaN(distance)||distanceoptions.longTapThreshold&&distance=0?LEFT:angle<=360&&angle>=315?LEFT:angle>=135&&angle<=225?RIGHT:angle>45&&angle<135?DOWN:UP}function getTimeStamp(){var now=new Date;return now.getTime()}function getbounds(el){el=$(el);var offset=el.offset(),bounds={left:offset.left,right:offset.left+el.outerWidth(),top:offset.top,bottom:offset.top+el.outerHeight()};return bounds}function isInBounds(point,bounds){return point.x>bounds.left&&point.xbounds.top&&point.y0)){var o=l.originalEvent?l.originalEvent:l;if(!o.pointerType||"mouse"!=o.pointerType||0!=P.fallbackToMouseEvents){var a,u,s=o.touches,c=s?s[0]:o;return V=T,s?W=s.length:!1!==P.preventDefaultEvents&&l.preventDefault(),U=0,j=null,N=null,F=null,H=0,_=0,q=0,C=1,Q=0,(u={})[n]=De(n),u[t]=De(t),u[r]=De(r),u[i]=De(i),X=u,xe(),Oe(0,c),!s||W===P.fingers||P.fingers===w||ge()?(B=Ae(),2==W&&(Oe(1,s[1]),_=q=Re(z[0].start,z[1].start)),(P.swipeStatus||P.pinchStatus)&&(a=ue(o,V))):a=!1,!1===a?(ue(o,V=m),a):(P.hold&&(ee=setTimeout(e.proxy(function(){Y.trigger("hold",[o.target]),P.hold&&(a=P.hold.call(Y,o,o.target))},this),P.longTapThreshold)),be(!0),null)}}}function te(e){var s=e.originalEvent?e.originalEvent:e;if(V!==E&&V!==m&&!Se()){var c,p,f,h=s.touches,v=Me(h?h[0]:s);if(G=Ae(),h&&(W=h.length),P.hold&&clearTimeout(ee),V=y,2==W&&(0==_?(Oe(1,h[1]),_=q=Re(z[0].start,z[1].start)):(Me(h[1]),q=Re(z[0].end,z[1].end),z[0].end,z[1].end,F=C<1?o:l),C=(q/_*1).toFixed(2),Q=Math.abs(_-q)),W===P.fingers||P.fingers===w||!h||ge()){if(j=ke(v.start,v.end),function(e,l){if(!1===P.preventDefaultEvents)return;if(P.allowPageScroll===a)e.preventDefault();else{var o=P.allowPageScroll===u;switch(l){case n:(P.swipeLeft&&o||!o&&P.allowPageScroll!=g)&&e.preventDefault();break;case t:(P.swipeRight&&o||!o&&P.allowPageScroll!=g)&&e.preventDefault();break;case r:(P.swipeUp&&o||!o&&P.allowPageScroll!=d)&&e.preventDefault();break;case i:(P.swipeDown&&o||!o&&P.allowPageScroll!=d)&&e.preventDefault()}}}(e,N=ke(v.last,v.end)),p=v.start,f=v.end,U=Math.round(Math.sqrt(Math.pow(f.x-p.x,2)+Math.pow(f.y-p.y,2))),H=Le(),function(e,n){if(e==a)return;n=Math.max(n,Pe(e)),X[e].distance=n}(j,U),c=ue(s,V),!P.triggerOnTouchEnd||P.triggerOnTouchLeave){var T=!0;if(P.triggerOnTouchLeave){var x=this.getBoundingClientRect();T=function(e,n){return e.x>n.left&&e.xn.top&&e.yP.longTapThreshold&&U=P.threshold),e}function pe(){var e=!1;return null!==P.cancelThreshold&&null!==j&&(e=Pe(j)-U>=P.cancelThreshold),e}function fe(){return!P.maxTimeThreshold||!(H>=P.maxTimeThreshold)}function he(){var e=ve(),n=Te(),t=null===P.pinchThreshold||Q>=P.pinchThreshold;return e&&n&&t}function ge(){return!!(P.pinchStatus||P.pinchIn||P.pinchOut)}function de(){var e=fe(),n=ce(),t=ve(),r=Te();return!pe()&&r&&t&&n&&e}function we(){return!!(P.swipe||P.swipeStatus||P.swipeLeft||P.swipeRight||P.swipeUp||P.swipeDown)}function ve(){return W===P.fingers||P.fingers===w||!x}function Te(){return 0!==z[0].end.x}function ye(){return!!P.tap}function Ee(){return!!P.doubleTap}function me(){if(null==K)return!1;var e=Ae();return Ee()&&e-K<=P.doubleTapThreshold}function xe(){Z=0,J=0}function Se(){var e=!1;Z&&(Ae()-Z<=P.fingerReleaseThreshold&&(e=!0));return e}function be(e){Y&&(!0===e?(Y.on(R,te),Y.one(k,function(e){re(e)}),A&&Y.one(A,le)):Y.off(R,te,!1),Y.data(O+"_intouch",!0===e))}function Oe(e,n){var t={start:{x:0,y:0},last:{x:0,y:0},end:{x:0,y:0}};return t.start.x=t.last.x=t.end.x=n.pageX||n.clientX,t.start.y=t.last.y=t.end.y=n.pageY||n.clientY,z[e]=t,t}function Me(e){var n=void 0!==e.identifier?e.identifier:0,t=function(e){return z[e]||null}(n);return null===t&&(t=Oe(n,e)),t.last.x=t.end.x,t.last.y=t.end.y,t.end.x=e.pageX||e.clientX,t.end.y=e.pageY||e.clientY,t}function Pe(e){if(X[e])return X[e].distance}function De(e){return{direction:e,distance:0}}function Le(){return G-B}function Re(e,n){var t=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);return Math.round(Math.sqrt(t*t+r*r))}function ke(e,l){if(u=l,(o=e).x==u.x&&o.y==u.y)return a;var o,u,s=function(e,n){var t=e.x-n.x,r=n.y-e.y,i=Math.atan2(r,t),l=Math.round(180*i/Math.PI);return l<0&&(l=360-Math.abs(l)),l}(e,l);return s<=45&&s>=0?n:s<=360&&s>=315?n:s>=135&&s<=225?t:s>45&&s<135?i:r}function Ae(){return(new Date).getTime()}this.enable=function(){return this.disable(),Y.on(L,ne),Y.on(I,ie),Y},this.disable=function(){return oe(),Y},this.destroy=function(){oe(),Y.data(O,null),Y=null},this.option=function(n,t){if("object"==typeof n)P=e.extend(P,n);else if(void 0!==P[n]){if(void 0===t)return P[n];P[n]=t}else{if(!n)return P;e.error("Option "+n+" does not exist on jQuery.swipe.options")}return null}}e.fn.swipe=function(n){var t=e(this),r=t.data(O);if(r&&"string"==typeof n){if(r[n])return r[n].apply(r,Array.prototype.slice.call(arguments,1));e.error("Method "+n+" does not exist on jQuery.swipe")}else if(r&&"object"==typeof n)r.option.apply(r,arguments);else if(!(r||"object"!=typeof n&&n))return function(n){!n||void 0!==n.allowPageScroll||void 0===n.swipe&&void 0===n.swipeStatus||(n.allowPageScroll=a);void 0!==n.click&&void 0===n.tap&&(n.tap=n.click);n||(n={});return n=e.extend({},e.fn.swipe.defaults,n),this.each(function(){var t=e(this),r=t.data(O);r||(r=new M(this,n),t.data(O,r))})}.apply(this,arguments);return t},e.fn.swipe.version="1.6.18",e.fn.swipe.defaults={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:!0,triggerOnTouchLeave:!1,allowPageScroll:"auto",fallbackToMouseEvents:!0,excludedElements:".noSwipe",preventDefaultEvents:!0},e.fn.swipe.phases={PHASE_START:T,PHASE_MOVE:y,PHASE_END:E,PHASE_CANCEL:m},e.fn.swipe.directions={LEFT:n,RIGHT:t,UP:r,DOWN:i,IN:l,OUT:o},e.fn.swipe.pageScroll={NONE:a,HORIZONTAL:g,VERTICAL:d,AUTO:u},e.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,FOUR:4,FIVE:5,ALL:w}}); \ No newline at end of file