vendor: 28,948 bytes, lines 1-532
1/*! 2 * @fileOverview TouchSwipe - jQuery Plugin 3 * @version 1.6.18 4 * 5 * @author Matt Bryson http://www.github.com/mattbryson 6 * @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin 7 * @see http://labs.rampinteractive.co.uk/touchSwipe/ 8 * @see http://plugins.jquery.com/project/touchSwipe 9 * @license 10 * Copyright (c) 2010-2015 Matt Bryson 11 * Dual licensed under the MIT or GPL Version 2 licenses. 12 * 13 */ 14! function(factory) { 15 "function" == typeof define && define.amd && define.amd.jQuery ? define(["jquery"], factory) : factory("undefined" != typeof module && module.exports ? require("jquery") : jQuery) 16}(function($) { 17 "use strict"; 18 19 function init(options) { 20 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() { 21 var $this = $(this), 22 plugin = $this.data(PLUGIN_NS); 23 plugin || (plugin = new TouchSwipe(this, options), $this.data(PLUGIN_NS, plugin)) 24 }) 25 } 26 27 function TouchSwipe(element, options) { 28 function touchStart(jqEvent) { 29 if (!(getTouchInProgress() || $(jqEvent.target).closest(options.excludedElements, $element).length > 0)) { 30 var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent; 31 if (!event.pointerType || "mouse" != event.pointerType || 0 != options.fallbackToMouseEvents) { 32 var ret, touches = event.touches, 33 evt = touches ? touches[0] : event; 34 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() { 35 $element.trigger("hold", [event.target]), options.hold && (ret = options.hold.call($element, event, event.target)) 36 }, this), options.longTapThreshold)), setTouchInProgress(!0), null) 37 } 38 } 39 } 40 41 function touchMove(jqEvent) { 42 var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent; 43 if (phase !== PHASE_END && phase !== PHASE_CANCEL && !inMultiFingerRelease()) { 44 var ret, touches = event.touches, 45 evt = touches ? touches[0] : event, 46 currentFinger = updateFingerData(evt); 47 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()) { 48 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) { 49 var inBounds = !0; 50 if (options.triggerOnTouchLeave) { 51 var bounds = getbounds(this); 52 inBounds = isInBounds(currentFinger.end, bounds) 53 }!options.triggerOnTouchEnd && inBounds ? phase = getNextPhase(PHASE_MOVE) : options.triggerOnTouchLeave && !inBounds && (phase = getNextPhase(PHASE_END)), phase != PHASE_CANCEL && phase != PHASE_END || triggerHandler(event, phase) 54 } 55 } else phase = PHASE_CANCEL, triggerHandler(event, phase); 56 ret === !1 && (phase = PHASE_CANCEL, triggerHandler(event, phase)) 57 } 58 } 59 60 function touchEnd(jqEvent) { 61 var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent, 62 touches = event.touches; 63 if (touches) { 64 if (touches.length && !inMultiFingerRelease()) return startMultiFingerRelease(event), !0; 65 if (touches.length && inMultiFingerRelease()) return !0 66 } 67 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.cancelable !== !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 68 } 69 70 function touchCancel() { 71 fingerCount = 0, endTime = 0, startTime = 0, startTouchesDistance = 0, endTouchesDistance = 0, pinchZoom = 1, cancelMultiFingerRelease(), setTouchInProgress(!1) 72 } 73 74 function touchLeave(jqEvent) { 75 var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent; 76 options.triggerOnTouchLeave && (phase = getNextPhase(PHASE_END), triggerHandler(event, phase)) 77 } 78 79 function removeListeners() { 80 $element.off(START_EV, touchStart), $element.off(CANCEL_EV, touchCancel), $element.off(MOVE_EV, touchMove), $element.off(END_EV, touchEnd), LEAVE_EV && $element.off(LEAVE_EV, touchLeave), setTouchInProgress(!1) 81 } 82 83 function getNextPhase(currentPhase) { 84 var nextPhase = currentPhase, 85 validTime = validateSwipeTime(), 86 validDistance = validateSwipeDistance(), 87 didCancel = didSwipeBackToCancel(); 88 return !validTime || didCancel ? nextPhase = PHASE_CANCEL : !validDistance || currentPhase != PHASE_MOVE || options.triggerOnTouchEnd && !options.triggerOnTouchLeave ? !validDistance && currentPhase == PHASE_END && options.triggerOnTouchLeave && (nextPhase = PHASE_CANCEL) : nextPhase = PHASE_END, nextPhase 89 } 90 91 function triggerHandler(event, phase) { 92 var ret, touches = event.touches; 93 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 94 } 95 96 function triggerHandlerForGesture(event, phase, gesture) { 97 var ret; 98 if (gesture == SWIPE) { 99 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; 100 if (phase == PHASE_END && validateSwipe()) { 101 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; 102 switch (direction) { 103 case LEFT: 104 $element.trigger("swipeLeft", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeLeft && (ret = options.swipeLeft.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)); 105 break; 106 case RIGHT: 107 $element.trigger("swipeRight", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeRight && (ret = options.swipeRight.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)); 108 break; 109 case UP: 110 $element.trigger("swipeUp", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeUp && (ret = options.swipeUp.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)); 111 break; 112 case DOWN: 113 $element.trigger("swipeDown", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeDown && (ret = options.swipeDown.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)) 114 } 115 } 116 } 117 if (gesture == PINCH) { 118 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; 119 if (phase == PHASE_END && validatePinch()) switch (pinchDirection) { 120 case IN: 121 $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)); 122 break; 123 case OUT: 124 $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)) 125 } 126 } 127 return gesture == TAP ? phase !== PHASE_CANCEL && phase !== PHASE_END || (clearTimeout(singleTapTimeout), clearTimeout(holdTimeout), hasDoubleTap() && !inDoubleTap() ? (doubleTapStartTime = getTimeStamp(), singleTapTimeout = setTimeout($.proxy(function() { 128 doubleTapStartTime = null, $element.trigger("tap", [event.target]), options.tap && (ret = options.tap.call($element, event, event.target)) 129 }, 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 130 } 131 132 function validateSwipeDistance() { 133 var valid = !0; 134 return null !== options.threshold && (valid = distance >= options.threshold), valid 135 } 136 137 function didSwipeBackToCancel() { 138 var cancelled = !1; 139 return null !== options.cancelThreshold && null !== direction && (cancelled = getMaxDistance(direction) - distance >= options.cancelThreshold), cancelled 140 } 141 142 function validatePinchDistance() { 143 return null !== options.pinchThreshold ? pinchDistance >= options.pinchThreshold : !0 144 } 145 146 function validateSwipeTime() { 147 var result; 148 return result = options.maxTimeThreshold ? !(duration >= options.maxTimeThreshold) : !0 149 } 150 151 function validateDefaultEvent(jqEvent, direction) { 152 if (options.preventDefaultEvents !== !1) 153 if (options.allowPageScroll === NONE) jqEvent.preventDefault(); 154 else { 155 var auto = options.allowPageScroll === AUTO; 156 switch (direction) { 157 case LEFT: 158 (options.swipeLeft && auto || !auto && options.allowPageScroll != HORIZONTAL) && jqEvent.preventDefault(); 159 break; 160 case RIGHT: 161 (options.swipeRight && auto || !auto && options.allowPageScroll != HORIZONTAL) && jqEvent.preventDefault(); 162 break; 163 case UP: 164 (options.swipeUp && auto || !auto && options.allowPageScroll != VERTICAL) && jqEvent.preventDefault(); 165 break; 166 case DOWN: 167 (options.swipeDown && auto || !auto && options.allowPageScroll != VERTICAL) && jqEvent.preventDefault(); 168 break; 169 case NONE: 170 } 171 } 172 } 173 174 function validatePinch() { 175 var hasCorrectFingerCount = validateFingers(), 176 hasEndPoint = validateEndPoint(), 177 hasCorrectDistance = validatePinchDistance(); 178 return hasCorrectFingerCount && hasEndPoint && hasCorrectDistance 179 } 180 181 function hasPinches() { 182 return !!(options.pinchStatus || options.pinchIn || options.pinchOut) 183 } 184 185 function didPinch() { 186 return !(!validatePinch() || !hasPinches()) 187 } 188 189 function validateSwipe() { 190 var hasValidTime = validateSwipeTime(), 191 hasValidDistance = validateSwipeDistance(), 192 hasCorrectFingerCount = validateFingers(), 193 hasEndPoint = validateEndPoint(), 194 didCancel = didSwipeBackToCancel(), 195 valid = !didCancel && hasEndPoint && hasCorrectFingerCount && hasValidDistance && hasValidTime; 196 return valid 197 } 198 199 function hasSwipes() { 200 return !!(options.swipe || options.swipeStatus || options.swipeLeft || options.swipeRight || options.swipeUp || options.swipeDown) 201 } 202 203 function didSwipe() { 204 return !(!validateSwipe() || !hasSwipes()) 205 } 206 207 function validateFingers() { 208 return fingerCount === options.fingers || options.fingers === ALL_FINGERS || !SUPPORTS_TOUCH 209 } 210 211 function validateEndPoint() { 212 return 0 !== fingerData[0].end.x 213 } 214 215 function hasTap() { 216 return !!options.tap 217 } 218 219 function hasDoubleTap() { 220 return !!options.doubleTap 221 } 222 223 function hasLongTap() { 224 return !!options.longTap 225 } 226 227 function validateDoubleTap() { 228 if (null == doubleTapStartTime) return !1; 229 var now = getTimeStamp(); 230 return hasDoubleTap() && now - doubleTapStartTime <= options.doubleTapThreshold 231 } 232 233 function inDoubleTap() { 234 return validateDoubleTap() 235 } 236 237 function validateTap() { 238 return (1 === fingerCount || !SUPPORTS_TOUCH) && (isNaN(distance) || distance < options.threshold) 239 } 240 241 function validateLongTap() { 242 return duration > options.longTapThreshold && DOUBLE_TAP_THRESHOLD > distance 243 } 244 245 function didTap() { 246 return !(!validateTap() || !hasTap()) 247 } 248 249 function didDoubleTap() { 250 return !(!validateDoubleTap() || !hasDoubleTap()) 251 } 252 253 function didLongTap() { 254 return !(!validateLongTap() || !hasLongTap()) 255 } 256 257 function startMultiFingerRelease(event) { 258 previousTouchEndTime = getTimeStamp(), fingerCountAtRelease = event.touches.length + 1 259 } 260 261 function cancelMultiFingerRelease() { 262 previousTouchEndTime = 0, fingerCountAtRelease = 0 263 } 264 265 function inMultiFingerRelease() { 266 var withinThreshold = !1; 267 if (previousTouchEndTime) { 268 var diff = getTimeStamp() - previousTouchEndTime; 269 diff <= options.fingerReleaseThreshold && (withinThreshold = !0) 270 } 271 return withinThreshold 272 } 273 274 function getTouchInProgress() { 275 return !($element.data(PLUGIN_NS + "_intouch") !== !0) 276 } 277 278 function setTouchInProgress(val) { 279 $element && (val === !0 ? ($element.on(MOVE_EV, touchMove), $element.on(END_EV, touchEnd), LEAVE_EV && $element.on(LEAVE_EV, touchLeave)) : ($element.off(MOVE_EV, touchMove, !1), $element.off(END_EV, touchEnd, !1), LEAVE_EV && $element.off(LEAVE_EV, touchLeave, !1)), $element.data(PLUGIN_NS + "_intouch", val === !0)) 280 } 281 282 function createFingerData(id, evt) { 283 var f = { 284 start: { 285 x: 0, 286 y: 0 287 }, 288 last: { 289 x: 0, 290 y: 0 291 }, 292 end: { 293 x: 0, 294 y: 0 295 } 296 }; 297 return f.start.x = f.last.x = f.end.x = evt.pageX || evt.clientX, f.start.y = f.last.y = f.end.y = evt.pageY || evt.clientY, fingerData[id] = f, f 298 } 299 300 function updateFingerData(evt) { 301 var id = void 0 !== evt.identifier ? evt.identifier : 0, 302 f = getFingerData(id); 303 return null === f && (f = createFingerData(id, evt)), f.last.x = f.end.x, f.last.y = f.end.y, f.end.x = evt.pageX || evt.clientX, f.end.y = evt.pageY || evt.clientY, f 304 } 305 306 function getFingerData(id) { 307 return fingerData[id] || null 308 } 309 310 function setMaxDistance(direction, distance) { 311 direction != NONE && (distance = Math.max(distance, getMaxDistance(direction)), maximumsMap[direction].distance = distance) 312 } 313 314 function getMaxDistance(direction) { 315 return maximumsMap[direction] ? maximumsMap[direction].distance : void 0 316 } 317 318 function createMaximumsData() { 319 var maxData = {}; 320 return maxData[LEFT] = createMaximumVO(LEFT), maxData[RIGHT] = createMaximumVO(RIGHT), maxData[UP] = createMaximumVO(UP), maxData[DOWN] = createMaximumVO(DOWN), maxData 321 } 322 323 function createMaximumVO(dir) { 324 return { 325 direction: dir, 326 distance: 0 327 } 328 } 329 330 function calculateDuration() { 331 return endTime - startTime 332 } 333 334 function calculateTouchesDistance(startPoint, endPoint) { 335 var diffX = Math.abs(startPoint.x - endPoint.x), 336 diffY = Math.abs(startPoint.y - endPoint.y); 337 return Math.round(Math.sqrt(diffX * diffX + diffY * diffY)) 338 } 339 340 function calculatePinchZoom(startDistance, endDistance) { 341 var percent = endDistance / startDistance * 1; 342 return percent.toFixed(2) 343 } 344 345 function calculatePinchDirection() { 346 return 1 > pinchZoom ? OUT : IN 347 } 348 349 function calculateDistance(startPoint, endPoint) { 350 return Math.round(Math.sqrt(Math.pow(endPoint.x - startPoint.x, 2) + Math.pow(endPoint.y - startPoint.y, 2))) 351 } 352 353 function calculateAngle(startPoint, endPoint) { 354 var x = startPoint.x - endPoint.x, 355 y = endPoint.y - startPoint.y, 356 r = Math.atan2(y, x), 357 angle = Math.round(180 * r / Math.PI); 358 return 0 > angle && (angle = 360 - Math.abs(angle)), angle 359 } 360 361 function calculateDirection(startPoint, endPoint) { 362 if (comparePoints(startPoint, endPoint)) return NONE; 363 var angle = calculateAngle(startPoint, endPoint); 364 return 45 >= angle && angle >= 0 ? LEFT : 360 >= angle && angle >= 315 ? LEFT : angle >= 135 && 225 >= angle ? RIGHT : angle > 45 && 135 > angle ? DOWN : UP 365 } 366 367 function getTimeStamp() { 368 var now = new Date; 369 return now.getTime() 370 } 371 372 function getbounds(el) { 373 el = $(el); 374 var offset = el.offset(), 375 bounds = { 376 left: offset.left, 377 right: offset.left + el.outerWidth(), 378 top: offset.top, 379 bottom: offset.top + el.outerHeight() 380 }; 381 return bounds 382 } 383 384 function isInBounds(point, bounds) { 385 return point.x > bounds.left && point.x < bounds.right && point.y > bounds.top && point.y < bounds.bottom 386 } 387 388 function comparePoints(pointA, pointB) { 389 return pointA.x == pointB.x && pointA.y == pointB.y 390 } 391 var options = $.extend({}, options), 392 useTouchEvents = SUPPORTS_TOUCH || SUPPORTS_POINTER || !options.fallbackToMouseEvents, 393 START_EV = useTouchEvents ? SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerDown" : "pointerdown" : "touchstart" : "mousedown", 394 MOVE_EV = useTouchEvents ? SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerMove" : "pointermove" : "touchmove" : "mousemove", 395 END_EV = useTouchEvents ? SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerUp" : "pointerup" : "touchend" : "mouseup", 396 LEAVE_EV = useTouchEvents ? SUPPORTS_POINTER ? "mouseleave" : null : "mouseleave", 397 CANCEL_EV = SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerCancel" : "pointercancel" : "touchcancel", 398 distance = 0, 399 direction = null, 400 currentDirection = null, 401 duration = 0, 402 startTouchesDistance = 0, 403 endTouchesDistance = 0, 404 pinchZoom = 1, 405 pinchDistance = 0, 406 pinchDirection = 0, 407 maximumsMap = null, 408 $element = $(element), 409 phase = "start", 410 fingerCount = 0, 411 fingerData = {}, 412 startTime = 0, 413 endTime = 0, 414 previousTouchEndTime = 0, 415 fingerCountAtRelease = 0, 416 doubleTapStartTime = 0, 417 singleTapTimeout = null, 418 holdTimeout = null; 419 try { 420 $element.on(START_EV, touchStart), $element.on(CANCEL_EV, touchCancel) 421 } catch (e) { 422 $.error("events not supported " + START_EV + "," + CANCEL_EV + " on jQuery.swipe") 423 } 424 this.enable = function() { 425 return this.disable(), $element.on(START_EV, touchStart), $element.on(CANCEL_EV, touchCancel), $element 426 }, this.disable = function() { 427 return removeListeners(), $element 428 }, this.destroy = function() { 429 removeListeners(), $element.data(PLUGIN_NS, null), $element = null 430 }, this.option = function(property, value) { 431 if ("object" == typeof property) options = $.extend(options, property); 432 else if (void 0 !== options[property]) { 433 if (void 0 === value) return options[property]; 434 options[property] = value 435 } else { 436 if (!property) return options; 437 $.error("Option " + property + " does not exist on jQuery.swipe.options") 438 } 439 return null 440 } 441 } 442 var VERSION = "1.6.18", 443 LEFT = "left", 444 RIGHT = "right", 445 UP = "up", 446 DOWN = "down", 447 IN = "in", 448 OUT = "out", 449 NONE = "none", 450 AUTO = "auto", 451 SWIPE = "swipe", 452 PINCH = "pinch", 453 TAP = "tap", 454 DOUBLE_TAP = "doubletap", 455 LONG_TAP = "longtap", 456 HORIZONTAL = "horizontal", 457 VERTICAL = "vertical", 458 ALL_FINGERS = "all", 459 DOUBLE_TAP_THRESHOLD = 10, 460 PHASE_START = "start", 461 PHASE_MOVE = "move", 462 PHASE_END = "end", 463 PHASE_CANCEL = "cancel", 464 SUPPORTS_TOUCH = "ontouchstart" in window, 465 SUPPORTS_POINTER_IE10 = window.navigator.msPointerEnabled && !window.PointerEvent && !SUPPORTS_TOUCH, 466 SUPPORTS_POINTER = (window.PointerEvent || window.navigator.msPointerEnabled) && !SUPPORTS_TOUCH, 467 PLUGIN_NS = "TouchSwipe", 468 defaults = { 469 fingers: 1, 470 threshold: 75, 471 cancelThreshold: null, 472 pinchThreshold: 20, 473 maxTimeThreshold: null, 474 fingerReleaseThreshold: 250, 475 longTapThreshold: 500, 476 doubleTapThreshold: 200, 477 swipe: null, 478 swipeLeft: null, 479 swipeRight: null, 480 swipeUp: null, 481 swipeDown: null, 482 swipeStatus: null, 483 pinchIn: null, 484 pinchOut: null, 485 pinchStatus: null, 486 click: null, 487 tap: null, 488 doubleTap: null, 489 longTap: null, 490 hold: null, 491 triggerOnTouchEnd: !0, 492 triggerOnTouchLeave: !1, 493 allowPageScroll: "auto", 494 fallbackToMouseEvents: !0, 495 excludedElements: ".noSwipe", 496 preventDefaultEvents: !0 497 }; 498 $.fn.swipe = function(method) { 499 var $this = $(this), 500 plugin = $this.data(PLUGIN_NS); 501 if (plugin && "string" == typeof method) { 502 if (plugin[method]) return plugin[method].apply(plugin, Array.prototype.slice.call(arguments, 1)); 503 $.error("Method " + method + " does not exist on jQuery.swipe") 504 } else if (plugin && "object" == typeof method) plugin.option.apply(plugin, arguments); 505 else if (!(plugin || "object" != typeof method && method)) return init.apply(this, arguments); 506 return $this 507 }, $.fn.swipe.version = VERSION, $.fn.swipe.defaults = defaults, $.fn.swipe.phases = { 508 PHASE_START: PHASE_START, 509 PHASE_MOVE: PHASE_MOVE, 510 PHASE_END: PHASE_END, 511 PHASE_CANCEL: PHASE_CANCEL 512 }, $.fn.swipe.directions = { 513 LEFT: LEFT, 514 RIGHT: RIGHT, 515 UP: UP, 516 DOWN: DOWN, 517 IN: IN, 518 OUT: OUT 519 }, $.fn.swipe.pageScroll = { 520 NONE: NONE, 521 HORIZONTAL: HORIZONTAL, 522 VERTICAL: VERTICAL, 523 AUTO: AUTO 524 }, $.fn.swipe.fingers = { 525 ONE: 1, 526 TWO: 2, 527 THREE: 3, 528 FOUR: 4, 529 FIVE: 5, 530 ALL: ALL_FINGERS 531 } 532});
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.