Commit 81fcbe93 authored by nextime's avatar nextime

Fix error in repo

parent 310ff7f3
{
"json": "bower.json"
}
\ No newline at end of file
# ide
.idea
.iml
# node
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
npm-debug.log
node_modules
\ No newline at end of file
[submodule "hammer.js"]
path = hammer.js
url = https://github.com/EightMedia/hammer.js.git
language: node_js
node_js:
- "0.10"
before_script:
- npm install -g grunt-cli
script:
- grunt test
\ No newline at end of file
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
# meta options
meta:
banner: '
/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n
* <%= pkg.homepage %>\n
*\n
* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> <<%= pkg.author.email %>>;\n
* Licensed under the <%= _.pluck(pkg.licenses, "type").join(", ") %> license */'
# concat src files
concat:
options:
separator: '\n\n'
banner: '<%= meta.banner %>'
standalone:
src: [
'src/intro.js'
'src/plugin.js'
'src/outro.js']
dest: 'jquery.hammer-standalone.js'
full:
src: [
'hammer.js/hammer.js'
'jquery.hammer-standalone.js']
dest: 'jquery.hammer.js'
# minify the sourcecode
uglify:
options:
report: 'gzip'
banner: '<%= meta.banner %>'
standalone:
options:
sourceMap: 'jquery.hammer-standalone.min.map'
files:
'jquery.hammer-standalone.min.js': ['jquery.hammer-standalone.js']
full:
options:
sourceMap: 'jquery.hammer.min.map'
files:
'jquery.hammer.min.js': ['jquery.hammer.js']
# check for optimisations and errors
jshint:
options:
curly: true
expr: true
newcap: true
quotmark: 'single'
regexdash: true
trailing: true
undef: true
unused: true
maxerr: 100
eqnull: true
sub: false
browser: true
node: true
globals:
Hammer: true,
define: false
dist:
src: ['jquery.hammer-standalone.js']
# watch for changes
watch:
scripts:
files: ['src/*.js']
tasks: ['concat']
options:
interrupt: true
# simple node server
connect:
server:
options:
hostname: "0.0.0.0"
# tests
qunit:
all: ['tests/**/*.html']
# Load tasks
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-qunit'
# Default task(s).
grunt.registerTask 'default', ['connect','watch']
grunt.registerTask 'test', ['jshint','connect','qunit']
grunt.registerTask 'build', ['concat','uglify','test']
grunt.registerTask 'build-simple', ['concat','uglify','jshint']
Copyright (C) 2013 by Jorik Tangelder (Eight Media)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
jquery.hammer.js
================
[![Build Status](https://travis-ci.org/EightMedia/jquery.hammer.js.png)](https://travis-ci.org/EightMedia/jquery.hammer.js/)
jQuery plugin for [Hammer.js](https://github.com/EightMedia/hammer.js)
Since version 1.0.6 it is seperated from the main lib, and lives in this repository.
It still needs the main library to be included, but a combined version is on its way. :beer:
{
"name": "jquery-hammerjs",
"version": "1.0.0",
"main": ["jquery.hammer.js"],
"dependencies": {
"jquery": "*",
"hammerjs": "1.0.x"
},
"ignore": [
"tests",
"component.json",
"package.json",
"examples",
"src"
]
}
\ No newline at end of file
{
"name": "jquery-hammerjs",
"version": "1.0.0",
"main": "jquery.hammer.js",
"scripts": [
"jquery.hammer.js"
]
}
/*! jQuery plugin for Hammer.JS - v1.0.0 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license */(function(window, undefined) {
'use strict';
function setup(Hammer, $) {
/**
* bind dom events
* this overwrites addEventListener
* @param {HTMLElement} element
* @param {String} eventTypes
* @param {Function} handler
*/
Hammer.event.bindDom = function(element, eventTypes, handler) {
$(element).on(eventTypes, function(ev) {
var data = ev.originalEvent || ev;
if(data.pageX === undefined) {
data.pageX = ev.pageX;
data.pageY = ev.pageY;
}
if(!data.target) {
data.target = ev.target;
}
if(data.which === undefined) {
data.which = data.button;
}
if(!data.preventDefault) {
data.preventDefault = ev.preventDefault;
}
if(!data.stopPropagation) {
data.stopPropagation = ev.stopPropagation;
}
handler.call(this, data);
});
};
/**
* the methods are called by the instance, but with the jquery plugin
* we use the jquery event methods instead.
* @this {Hammer.Instance}
* @return {jQuery}
*/
Hammer.Instance.prototype.on = function(types, handler) {
return $(this.element).on(types, handler);
};
Hammer.Instance.prototype.off = function(types, handler) {
return $(this.element).off(types, handler);
};
/**
* trigger events
* this is called by the gestures to trigger an event like 'tap'
* @this {Hammer.Instance}
* @param {String} gesture
* @param {Object} eventData
* @return {jQuery}
*/
Hammer.Instance.prototype.trigger = function(gesture, eventData) {
var el = $(this.element);
if(el.has(eventData.target).length) {
el = $(eventData.target);
}
return el.trigger({
type : gesture,
gesture: eventData
});
};
/**
* jQuery plugin
* create instance of Hammer and watch for gestures,
* and when called again you can change the options
* @param {Object} [options={}]
* @return {jQuery}
*/
$.fn.hammer = function(options) {
return this.each(function() {
var el = $(this);
var inst = el.data('hammer');
// start new hammer instance
if(!inst) {
el.data('hammer', new Hammer(this, options || {}));
}
// change the options
else if(inst && options) {
Hammer.utils.extend(inst.options, options);
}
});
};
}
// Based off Lo-Dash's excellent UMD wrapper (slightly modified) - https://github.com/bestiejs/lodash/blob/master/lodash.js#L5515-L5543
// some AMD build optimizers, like r.js, check for specific condition patterns like the following:
if(typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
// define as an anonymous module
define(['hammer', 'jquery'], setup);
}
else {
setup(window.Hammer, window.jQuery || window.Zepto);
}
})(this);
\ No newline at end of file
/*! jQuery plugin for Hammer.JS - v1.0.0 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license */
!function(a,b){"use strict";function c(a,c){a.event.bindDom=function(a,d,e){c(a).on(d,function(a){var c=a.originalEvent||a;c.pageX===b&&(c.pageX=a.pageX,c.pageY=a.pageY),c.target||(c.target=a.target),c.which===b&&(c.which=c.button),c.preventDefault||(c.preventDefault=a.preventDefault),c.stopPropagation||(c.stopPropagation=a.stopPropagation),e.call(this,c)})},a.Instance.prototype.on=function(a,b){return c(this.element).on(a,b)},a.Instance.prototype.off=function(a,b){return c(this.element).off(a,b)},a.Instance.prototype.trigger=function(a,b){var d=c(this.element);return d.has(b.target).length&&(d=c(b.target)),d.trigger({type:a,gesture:b})},c.fn.hammer=function(b){return this.each(function(){var d=c(this),e=d.data("hammer");e?e&&b&&a.utils.extend(e.options,b):d.data("hammer",new a(this,b||{}))})}}"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(["hammer","jquery"],c):c(a.Hammer,a.jQuery||a.Zepto)}(this);
//# sourceMappingURL=jquery.hammer-standalone.min.map
\ No newline at end of file
{"version":3,"file":"jquery.hammer-standalone.min.js","sources":["jquery.hammer-standalone.js"],"names":["window","undefined","setup","Hammer","$","event","bindDom","element","eventTypes","handler","on","ev","data","originalEvent","pageX","pageY","target","which","button","preventDefault","stopPropagation","call","this","Instance","prototype","types","off","trigger","gesture","eventData","el","has","length","type","fn","hammer","options","each","inst","utils","extend","define","amd","jQuery","Zepto"],"mappings":";;;;;CAIoC,SAAUA,EAAQC,GACpD,YAEF,SAASC,GAAMC,EAAQC,GAQrBD,EAAOE,MAAMC,QAAU,SAASC,EAASC,EAAYC,GACnDL,EAAEG,GAASG,GAAGF,EAAY,SAASG,GACjC,GAAIC,GAAOD,EAAGE,eAAiBF,CAE5BC,GAAKE,QAAUb,IAChBW,EAAKE,MAAQH,EAAGG,MAChBF,EAAKG,MAAQJ,EAAGI,OAGdH,EAAKI,SACPJ,EAAKI,OAASL,EAAGK,QAGhBJ,EAAKK,QAAUhB,IAChBW,EAAKK,MAAQL,EAAKM,QAGhBN,EAAKO,iBACPP,EAAKO,eAAiBR,EAAGQ,gBAGvBP,EAAKQ,kBACPR,EAAKQ,gBAAkBT,EAAGS,iBAG5BX,EAAQY,KAAKC,KAAMV,MAUvBT,EAAOoB,SAASC,UAAUd,GAAK,SAASe,EAAOhB,GAC7C,MAAOL,GAAEkB,KAAKf,SAASG,GAAGe,EAAOhB,IAEnCN,EAAOoB,SAASC,UAAUE,IAAM,SAASD,EAAOhB,GAC9C,MAAOL,GAAEkB,KAAKf,SAASmB,IAAID,EAAOhB,IAYpCN,EAAOoB,SAASC,UAAUG,QAAU,SAASC,EAASC,GACpD,GAAIC,GAAK1B,EAAEkB,KAAKf,QAKhB,OAJGuB,GAAGC,IAAIF,EAAUb,QAAQgB,SAC1BF,EAAK1B,EAAEyB,EAAUb,SAGZc,EAAGH,SACRM,KAASL,EACTA,QAASC,KAYbzB,EAAE8B,GAAGC,OAAS,SAASC,GACrB,MAAOd,MAAKe,KAAK,WACf,GAAIP,GAAK1B,EAAEkB,MACPgB,EAAOR,EAAGlB,KAAK,SAEf0B,GAIIA,GAAQF,GACdjC,EAAOoC,MAAMC,OAAOF,EAAKF,QAASA,GAJlCN,EAAGlB,KAAK,SAAU,GAAIT,GAAOmB,KAAMc,WAYrB,kBAAVK,SAA6C,gBAAdA,QAAOC,KAAmBD,OAAOC,IAExED,QAAQ,SAAU,UAAWvC,GAI7BA,EAAMF,EAAOG,OAAQH,EAAO2C,QAAU3C,EAAO4C,QAE9CtB"}
\ No newline at end of file
/* jQuery plugin for Hammer.JS - v1.0.0 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license *//*! Hammer.JS - v1.0.6 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license */
(function(window, undefined) {
'use strict';
/**
* Hammer
* use this to create instances
* @param {HTMLElement} element
* @param {Object} options
* @returns {Hammer.Instance}
* @constructor
*/
var Hammer = function(element, options) {
return new Hammer.Instance(element, options || {});
};
// default settings
Hammer.defaults = {
// add styles and attributes to the element to prevent the browser from doing
// its native behavior. this doesnt prevent the scrolling, but cancels
// the contextmenu, tap highlighting etc
// set to false to disable this
stop_browser_behavior: {
// this also triggers onselectstart=false for IE
userSelect : 'none',
// this makes the element blocking in IE10 >, you could experiment with the value
// see for more options this issue; https://github.com/EightMedia/hammer.js/issues/241
touchAction : 'none',
touchCallout : 'none',
contentZooming : 'none',
userDrag : 'none',
tapHighlightColor: 'rgba(0,0,0,0)'
}
//
// more settings are defined per gesture at gestures.js
//
};
// detect touchevents
Hammer.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;
Hammer.HAS_TOUCHEVENTS = ('ontouchstart' in window);
// dont use mouseevents on mobile devices
Hammer.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;
Hammer.NO_MOUSEEVENTS = Hammer.HAS_TOUCHEVENTS && window.navigator.userAgent.match(Hammer.MOBILE_REGEX);
// eventtypes per touchevent (start, move, end)
// are filled by Hammer.event.determineEventTypes on setup
Hammer.EVENT_TYPES = {};
// direction defines
Hammer.DIRECTION_DOWN = 'down';
Hammer.DIRECTION_LEFT = 'left';
Hammer.DIRECTION_UP = 'up';
Hammer.DIRECTION_RIGHT = 'right';
// pointer type
Hammer.POINTER_MOUSE = 'mouse';
Hammer.POINTER_TOUCH = 'touch';
Hammer.POINTER_PEN = 'pen';
// touch event defines
Hammer.EVENT_START = 'start';
Hammer.EVENT_MOVE = 'move';
Hammer.EVENT_END = 'end';
// hammer document where the base events are added at
Hammer.DOCUMENT = window.document;
// plugins and gestures namespaces
Hammer.plugins = Hammer.plugins || {};
Hammer.gestures = Hammer.gestures || {};
// if the window events are set...
Hammer.READY = false;
/**
* setup events to detect gestures on the document
*/
function setup() {
if(Hammer.READY) {
return;
}
// find what eventtypes we add listeners to
Hammer.event.determineEventTypes();
// Register all gestures inside Hammer.gestures
Hammer.utils.each(Hammer.gestures, function(gesture){
Hammer.detection.register(gesture);
});
// Add touch events on the document
Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_MOVE, Hammer.detection.detect);
Hammer.event.onTouch(Hammer.DOCUMENT, Hammer.EVENT_END, Hammer.detection.detect);
// Hammer is ready...!
Hammer.READY = true;
}
Hammer.utils = {
/**
* extend method,
* also used for cloning when dest is an empty object
* @param {Object} dest
* @param {Object} src
* @parm {Boolean} merge do a merge
* @returns {Object} dest
*/
extend: function extend(dest, src, merge) {
for(var key in src) {
if(dest[key] !== undefined && merge) {
continue;
}
dest[key] = src[key];
}
return dest;
},
/**
* for each
* @param obj
* @param iterator
*/
each: function(obj, iterator, context) {
var i, length;
// native forEach on arrays
if ('forEach' in obj) {
obj.forEach(iterator, context);
}
// arrays
else if(obj.length !== undefined) {
for (i = 0, length = obj.length; i < length; i++) {
if (iterator.call(context, obj[i], i, obj) === false) {
return;
}
}
}
// objects
else {
for (i in obj) {
if (obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj) === false) {
return;
}
}
}
},
/**
* find if a node is in the given parent
* used for event delegation tricks
* @param {HTMLElement} node
* @param {HTMLElement} parent
* @returns {boolean} has_parent
*/
hasParent: function(node, parent) {
while(node) {
if(node == parent) {
return true;
}
node = node.parentNode;
}
return false;
},
/**
* get the center of all the touches
* @param {Array} touches
* @returns {Object} center
*/
getCenter: function getCenter(touches) {
var valuesX = [], valuesY = [];
Hammer.utils.each(touches, function(touch) {
// I prefer clientX because it ignore the scrolling position
valuesX.push(typeof touch.clientX !== 'undefined' ? touch.clientX : touch.pageX );
valuesY.push(typeof touch.clientY !== 'undefined' ? touch.clientY : touch.pageY );
});
return {
pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),
pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)
};
},
/**
* calculate the velocity between two points
* @param {Number} delta_time
* @param {Number} delta_x
* @param {Number} delta_y
* @returns {Object} velocity
*/
getVelocity: function getVelocity(delta_time, delta_x, delta_y) {
return {
x: Math.abs(delta_x / delta_time) || 0,
y: Math.abs(delta_y / delta_time) || 0
};
},
/**
* calculate the angle between two coordinates
* @param {Touch} touch1
* @param {Touch} touch2
* @returns {Number} angle
*/
getAngle: function getAngle(touch1, touch2) {
var y = touch2.pageY - touch1.pageY,
x = touch2.pageX - touch1.pageX;
return Math.atan2(y, x) * 180 / Math.PI;
},
/**
* angle to direction define
* @param {Touch} touch1
* @param {Touch} touch2
* @returns {String} direction constant, like Hammer.DIRECTION_LEFT
*/
getDirection: function getDirection(touch1, touch2) {
var x = Math.abs(touch1.pageX - touch2.pageX),
y = Math.abs(touch1.pageY - touch2.pageY);
if(x >= y) {
return touch1.pageX - touch2.pageX > 0 ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
}
else {
return touch1.pageY - touch2.pageY > 0 ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
}
},
/**
* calculate the distance between two touches
* @param {Touch} touch1
* @param {Touch} touch2
* @returns {Number} distance
*/
getDistance: function getDistance(touch1, touch2) {
var x = touch2.pageX - touch1.pageX,
y = touch2.pageY - touch1.pageY;
return Math.sqrt((x * x) + (y * y));
},
/**
* calculate the scale factor between two touchLists (fingers)
* no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
* @param {Array} start
* @param {Array} end
* @returns {Number} scale
*/
getScale: function getScale(start, end) {
// need two fingers...
if(start.length >= 2 && end.length >= 2) {
return this.getDistance(end[0], end[1]) /
this.getDistance(start[0], start[1]);
}
return 1;
},
/**
* calculate the rotation degrees between two touchLists (fingers)
* @param {Array} start
* @param {Array} end
* @returns {Number} rotation
*/
getRotation: function getRotation(start, end) {
// need two fingers
if(start.length >= 2 && end.length >= 2) {
return this.getAngle(end[1], end[0]) -
this.getAngle(start[1], start[0]);
}
return 0;
},
/**
* boolean if the direction is vertical
* @param {String} direction
* @returns {Boolean} is_vertical
*/
isVertical: function isVertical(direction) {
return (direction == Hammer.DIRECTION_UP || direction == Hammer.DIRECTION_DOWN);
},
/**
* stop browser default behavior with css props
* @param {HtmlElement} element
* @param {Object} css_props
*/
stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_props) {
if(!css_props || !element || !element.style) {
return;
}
// with css properties for modern browsers
Hammer.utils.each(['webkit', 'khtml', 'moz', 'Moz', 'ms', 'o', ''], function(vendor) {
Hammer.utils.each(css_props, function(prop) {
// vender prefix at the property
if(vendor) {
prop = vendor + prop.substring(0, 1).toUpperCase() + prop.substring(1);
}
// set the style
if(prop in element.style) {
element.style[prop] = prop;
}
});
});
// also the disable onselectstart
if(css_props.userSelect == 'none') {
element.onselectstart = function() {
return false;
};
}
// and disable ondragstart
if(css_props.userDrag == 'none') {
element.ondragstart = function() {
return false;
};
}
}
};
/**
* create new hammer instance
* all methods should return the instance itself, so it is chainable.
* @param {HTMLElement} element
* @param {Object} [options={}]
* @returns {Hammer.Instance}
* @constructor
*/
Hammer.Instance = function(element, options) {
var self = this;
// setup HammerJS window events and register all gestures
// this also sets up the default options
setup();
this.element = element;
// start/stop detection option
this.enabled = true;
// merge options
this.options = Hammer.utils.extend(
Hammer.utils.extend({}, Hammer.defaults),
options || {});
// add some css to the element to prevent the browser from doing its native behavoir
if(this.options.stop_browser_behavior) {
Hammer.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);
}
// start detection on touchstart
Hammer.event.onTouch(element, Hammer.EVENT_START, function(ev) {
if(self.enabled) {
Hammer.detection.startDetect(self, ev);
}
});
// return instance
return this;
};
Hammer.Instance.prototype = {
/**
* bind events to the instance
* @param {String} gesture
* @param {Function} handler
* @returns {Hammer.Instance}
*/
on: function onEvent(gesture, handler) {
var gestures = gesture.split(' ');
Hammer.utils.each(gestures, function(gesture) {
this.element.addEventListener(gesture, handler, false);
}, this);
return this;
},
/**
* unbind events to the instance
* @param {String} gesture
* @param {Function} handler
* @returns {Hammer.Instance}
*/
off: function offEvent(gesture, handler) {
var gestures = gesture.split(' ');
Hammer.utils.each(gestures, function(gesture) {
this.element.removeEventListener(gesture, handler, false);
}, this);
return this;
},
/**
* trigger gesture event
* @param {String} gesture
* @param {Object} [eventData]
* @returns {Hammer.Instance}
*/
trigger: function triggerEvent(gesture, eventData) {
// optional
if(!eventData) {
eventData = {};
}
// create DOM event
var event = Hammer.DOCUMENT.createEvent('Event');
event.initEvent(gesture, true, true);
event.gesture = eventData;
// trigger on the target if it is in the instance element,
// this is for event delegation tricks
var element = this.element;
if(Hammer.utils.hasParent(eventData.target, element)) {
element = eventData.target;
}
element.dispatchEvent(event);
return this;
},
/**
* enable of disable hammer.js detection
* @param {Boolean} state
* @returns {Hammer.Instance}
*/
enable: function enable(state) {
this.enabled = state;
return this;
}
};
/**
* this holds the last move event,
* used to fix empty touchend issue
* see the onTouch event for an explanation
* @type {Object}
*/
var last_move_event = null;
/**
* when the mouse is hold down, this is true
* @type {Boolean}
*/
var enable_detect = false;
/**
* when touch events have been fired, this is true
* @type {Boolean}
*/
var touch_triggered = false;
Hammer.event = {
/**
* simple addEventListener
* @param {HTMLElement} element
* @param {String} type
* @param {Function} handler
*/
bindDom: function(element, type, handler) {
var types = type.split(' ');
Hammer.utils.each(types, function(type){
element.addEventListener(type, handler, false);
});
},
/**
* touch events with mouse fallback
* @param {HTMLElement} element
* @param {String} eventType like Hammer.EVENT_MOVE
* @param {Function} handler
*/
onTouch: function onTouch(element, eventType, handler) {
var self = this;
this.bindDom(element, Hammer.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {
var sourceEventType = ev.type.toLowerCase();
// onmouseup, but when touchend has been fired we do nothing.
// this is for touchdevices which also fire a mouseup on touchend
if(sourceEventType.match(/mouse/) && touch_triggered) {
return;
}
// mousebutton must be down or a touch event
else if(sourceEventType.match(/touch/) || // touch events are always on screen
sourceEventType.match(/pointerdown/) || // pointerevents touch
(sourceEventType.match(/mouse/) && ev.which === 1) // mouse is pressed
) {
enable_detect = true;
}
// mouse isn't pressed
else if(sourceEventType.match(/mouse/) && !ev.which) {
enable_detect = false;
}
// we are in a touch event, set the touch triggered bool to true,
// this for the conflicts that may occur on ios and android
if(sourceEventType.match(/touch|pointer/)) {
touch_triggered = true;
}
// count the total touches on the screen
var count_touches = 0;
// when touch has been triggered in this detection session
// and we are now handling a mouse event, we stop that to prevent conflicts
if(enable_detect) {
// update pointerevent
if(Hammer.HAS_POINTEREVENTS && eventType != Hammer.EVENT_END) {
count_touches = Hammer.PointerEvent.updatePointer(eventType, ev);
}
// touch
else if(sourceEventType.match(/touch/)) {
count_touches = ev.touches.length;
}
// mouse
else if(!touch_triggered) {
count_touches = sourceEventType.match(/up/) ? 0 : 1;
}
// if we are in a end event, but when we remove one touch and
// we still have enough, set eventType to move
if(count_touches > 0 && eventType == Hammer.EVENT_END) {
eventType = Hammer.EVENT_MOVE;
}
// no touches, force the end event
else if(!count_touches) {
eventType = Hammer.EVENT_END;
}
// store the last move event
if(count_touches || last_move_event === null) {
last_move_event = ev;
}
// trigger the handler
handler.call(Hammer.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));
// remove pointerevent from list
if(Hammer.HAS_POINTEREVENTS && eventType == Hammer.EVENT_END) {
count_touches = Hammer.PointerEvent.updatePointer(eventType, ev);
}
}
// on the end we reset everything
if(!count_touches) {
last_move_event = null;
enable_detect = false;
touch_triggered = false;
Hammer.PointerEvent.reset();
}
});
},
/**
* we have different events for each device/browser
* determine what we need and set them in the Hammer.EVENT_TYPES constant
*/
determineEventTypes: function determineEventTypes() {
// determine the eventtype we want to set
var types;
// pointerEvents magic
if(Hammer.HAS_POINTEREVENTS) {
types = Hammer.PointerEvent.getEvents();
}
// on Android, iOS, blackberry, windows mobile we dont want any mouseevents
else if(Hammer.NO_MOUSEEVENTS) {
types = [
'touchstart',
'touchmove',
'touchend touchcancel'];
}
// for non pointer events browsers and mixed browsers,
// like chrome on windows8 touch laptop
else {
types = [
'touchstart mousedown',
'touchmove mousemove',
'touchend touchcancel mouseup'];
}
Hammer.EVENT_TYPES[Hammer.EVENT_START] = types[0];
Hammer.EVENT_TYPES[Hammer.EVENT_MOVE] = types[1];
Hammer.EVENT_TYPES[Hammer.EVENT_END] = types[2];
},
/**
* create touchlist depending on the event
* @param {Object} ev
* @param {String} eventType used by the fakemultitouch plugin
*/
getTouchList: function getTouchList(ev/*, eventType*/) {
// get the fake pointerEvent touchlist
if(Hammer.HAS_POINTEREVENTS) {
return Hammer.PointerEvent.getTouchList();
}
// get the touchlist
else if(ev.touches) {
return ev.touches;
}
// make fake touchlist from mouse position
else {
ev.identifier = 1;
return [ev];
}
},
/**
* collect event data for Hammer js
* @param {HTMLElement} element
* @param {String} eventType like Hammer.EVENT_MOVE
* @param {Object} eventData
*/
collectEventData: function collectEventData(element, eventType, touches, ev) {
// find out pointerType
var pointerType = Hammer.POINTER_TOUCH;
if(ev.type.match(/mouse/) || Hammer.PointerEvent.matchType(Hammer.POINTER_MOUSE, ev)) {
pointerType = Hammer.POINTER_MOUSE;
}
return {
center : Hammer.utils.getCenter(touches),
timeStamp : new Date().getTime(),
target : ev.target,
touches : touches,
eventType : eventType,
pointerType: pointerType,
srcEvent : ev,
/**
* prevent the browser default actions
* mostly used to disable scrolling of the browser
*/
preventDefault: function() {
if(this.srcEvent.preventManipulation) {
this.srcEvent.preventManipulation();
}
if(this.srcEvent.preventDefault) {
this.srcEvent.preventDefault();
}
},
/**
* stop bubbling the event up to its parents
*/
stopPropagation: function() {
this.srcEvent.stopPropagation();
},
/**
* immediately stop gesture detection
* might be useful after a swipe was detected
* @return {*}
*/
stopDetect: function() {
return Hammer.detection.stopDetect();
}
};
}
};
Hammer.PointerEvent = {
/**
* holds all pointers
* @type {Object}
*/
pointers: {},
/**
* get a list of pointers
* @returns {Array} touchlist
*/
getTouchList: function() {
var self = this;
var touchlist = [];
// we can use forEach since pointerEvents only is in IE10
Hammer.utils.each(self.pointers, function(pointer){
touchlist.push(pointer);
});
return touchlist;
},
/**
* update the position of a pointer
* @param {String} type Hammer.EVENT_END
* @param {Object} pointerEvent
*/
updatePointer: function(type, pointerEvent) {
if(type == Hammer.EVENT_END) {
this.pointers = {};
}
else {
pointerEvent.identifier = pointerEvent.pointerId;
this.pointers[pointerEvent.pointerId] = pointerEvent;
}
return Object.keys(this.pointers).length;
},
/**
* check if ev matches pointertype
* @param {String} pointerType Hammer.POINTER_MOUSE
* @param {PointerEvent} ev
*/
matchType: function(pointerType, ev) {
if(!ev.pointerType) {
return false;
}
var pt = ev.pointerType,
types = {};
types[Hammer.POINTER_MOUSE] = (pt === ev.MSPOINTER_TYPE_MOUSE || pt === Hammer.POINTER_MOUSE);
types[Hammer.POINTER_TOUCH] = (pt === ev.MSPOINTER_TYPE_TOUCH || pt === Hammer.POINTER_TOUCH);
types[Hammer.POINTER_PEN] = (pt === ev.MSPOINTER_TYPE_PEN || pt === Hammer.POINTER_PEN);
return types[pointerType];
},
/**
* get events
*/
getEvents: function() {
return [
'pointerdown MSPointerDown',
'pointermove MSPointerMove',
'pointerup pointercancel MSPointerUp MSPointerCancel'
];
},
/**
* reset the list
*/
reset: function() {
this.pointers = {};
}
};
Hammer.detection = {
// contains all registred Hammer.gestures in the correct order
gestures: [],
// data of the current Hammer.gesture detection session
current : null,
// the previous Hammer.gesture session data
// is a full clone of the previous gesture.current object
previous: null,
// when this becomes true, no gestures are fired
stopped : false,
/**
* start Hammer.gesture detection
* @param {Hammer.Instance} inst
* @param {Object} eventData
*/
startDetect: function startDetect(inst, eventData) {
// already busy with a Hammer.gesture detection on an element
if(this.current) {
return;
}
this.stopped = false;
this.current = {
inst : inst, // reference to HammerInstance we're working for
startEvent: Hammer.utils.extend({}, eventData), // start eventData for distances, timing etc
lastEvent : false, // last eventData
name : '' // current gesture we're in/detected, can be 'tap', 'hold' etc
};
this.detect(eventData);
},
/**
* Hammer.gesture detection
* @param {Object} eventData
*/
detect: function detect(eventData) {
if(!this.current || this.stopped) {
return;
}
// extend event data with calculations about scale, distance etc
eventData = this.extendEventData(eventData);
// instance options
var inst_options = this.current.inst.options;
// call Hammer.gesture handlers
Hammer.utils.each(this.gestures, function(gesture) {
// only when the instance options have enabled this gesture
if(!this.stopped && inst_options[gesture.name] !== false) {
// if a handler returns false, we stop with the detection
if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {
this.stopDetect();
return false;
}
}
}, this);
// store as previous event event
if(this.current) {
this.current.lastEvent = eventData;
}
// endevent, but not the last touch, so dont stop
if(eventData.eventType == Hammer.EVENT_END && !eventData.touches.length - 1) {
this.stopDetect();
}
return eventData;
},
/**
* clear the Hammer.gesture vars
* this is called on endDetect, but can also be used when a final Hammer.gesture has been detected
* to stop other Hammer.gestures from being fired
*/
stopDetect: function stopDetect() {
// clone current data to the store as the previous gesture
// used for the double tap gesture, since this is an other gesture detect session
this.previous = Hammer.utils.extend({}, this.current);
// reset the current
this.current = null;
// stopped!
this.stopped = true;
},
/**
* extend eventData for Hammer.gestures
* @param {Object} ev
* @returns {Object} ev
*/
extendEventData: function extendEventData(ev) {
var startEv = this.current.startEvent;
// if the touches change, set the new touches over the startEvent touches
// this because touchevents don't have all the touches on touchstart, or the
// user must place his fingers at the EXACT same time on the screen, which is not realistic
// but, sometimes it happens that both fingers are touching at the EXACT same time
if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {
// extend 1 level deep to get the touchlist with the touch objects
startEv.touches = [];
Hammer.utils.each(ev.touches, function(touch) {
startEv.touches.push(Hammer.utils.extend({}, touch));
});
}
var delta_time = ev.timeStamp - startEv.timeStamp
, delta_x = ev.center.pageX - startEv.center.pageX
, delta_y = ev.center.pageY - startEv.center.pageY
, velocity = Hammer.utils.getVelocity(delta_time, delta_x, delta_y)
, interimAngle
, interimDirection;
// end events (e.g. dragend) don't have useful values for interimDirection & interimAngle
// because the previous event has exactly the same coordinates
// so for end events, take the previous values of interimDirection & interimAngle
// instead of recalculating them and getting a spurious '0'
if(ev.eventType === 'end') {
interimAngle = this.current.lastEvent && this.current.lastEvent.interimAngle;
interimDirection = this.current.lastEvent && this.current.lastEvent.interimDirection;
}
else {
interimAngle = this.current.lastEvent && Hammer.utils.getAngle(this.current.lastEvent.center, ev.center);
interimDirection = this.current.lastEvent && Hammer.utils.getDirection(this.current.lastEvent.center, ev.center);
}
Hammer.utils.extend(ev, {
deltaTime: delta_time,
deltaX: delta_x,
deltaY: delta_y,
velocityX: velocity.x,
velocityY: velocity.y,
distance: Hammer.utils.getDistance(startEv.center, ev.center),
angle: Hammer.utils.getAngle(startEv.center, ev.center),
interimAngle: interimAngle,
direction: Hammer.utils.getDirection(startEv.center, ev.center),
interimDirection: interimDirection,
scale: Hammer.utils.getScale(startEv.touches, ev.touches),
rotation: Hammer.utils.getRotation(startEv.touches, ev.touches),
startEvent: startEv
});
return ev;
},
/**
* register new gesture
* @param {Object} gesture object, see gestures.js for documentation
* @returns {Array} gestures
*/
register: function register(gesture) {
// add an enable gesture options if there is no given
var options = gesture.defaults || {};
if(options[gesture.name] === undefined) {
options[gesture.name] = true;
}
// extend Hammer default options with the Hammer.gesture options
Hammer.utils.extend(Hammer.defaults, options, true);
// set its index
gesture.index = gesture.index || 1000;
// add Hammer.gesture to the list
this.gestures.push(gesture);
// sort the list by index
this.gestures.sort(function(a, b) {
if(a.index < b.index) { return -1; }
if(a.index > b.index) { return 1; }
return 0;
});
return this.gestures;
}
};
/**
* Drag
* Move with x fingers (default 1) around on the page. Blocking the scrolling when
* moving left and right is a good practice. When all the drag events are blocking
* you disable scrolling on that area.
* @events drag, drapleft, dragright, dragup, dragdown
*/
Hammer.gestures.Drag = {
name : 'drag',
index : 50,
defaults : {
drag_min_distance : 10,
// Set correct_for_drag_min_distance to true to make the starting point of the drag
// be calculated from where the drag was triggered, not from where the touch started.
// Useful to avoid a jerk-starting drag, which can make fine-adjustments
// through dragging difficult, and be visually unappealing.
correct_for_drag_min_distance: true,
// set 0 for unlimited, but this can conflict with transform
drag_max_touches : 1,
// prevent default browser behavior when dragging occurs
// be careful with it, it makes the element a blocking element
// when you are using the drag gesture, it is a good practice to set this true
drag_block_horizontal : false,
drag_block_vertical : false,
// drag_lock_to_axis keeps the drag gesture on the axis that it started on,
// It disallows vertical directions if the initial direction was horizontal, and vice versa.
drag_lock_to_axis : false,
// drag lock only kicks in when distance > drag_lock_min_distance
// This way, locking occurs only when the distance has become large enough to reliably determine the direction
drag_lock_min_distance : 25
},
triggered: false,
handler : function dragGesture(ev, inst) {
// current gesture isnt drag, but dragged is true
// this means an other gesture is busy. now call dragend
if(Hammer.detection.current.name != this.name && this.triggered) {
inst.trigger(this.name + 'end', ev);
this.triggered = false;
return;
}
// max touches
if(inst.options.drag_max_touches > 0 &&
ev.touches.length > inst.options.drag_max_touches) {
return;
}
switch(ev.eventType) {
case Hammer.EVENT_START:
this.triggered = false;
break;
case Hammer.EVENT_MOVE:
// when the distance we moved is too small we skip this gesture
// or we can be already in dragging
if(ev.distance < inst.options.drag_min_distance &&
Hammer.detection.current.name != this.name) {
return;
}
// we are dragging!
if(Hammer.detection.current.name != this.name) {
Hammer.detection.current.name = this.name;
if(inst.options.correct_for_drag_min_distance && ev.distance > 0) {
// When a drag is triggered, set the event center to drag_min_distance pixels from the original event center.
// Without this correction, the dragged distance would jumpstart at drag_min_distance pixels instead of at 0.
// It might be useful to save the original start point somewhere
var factor = Math.abs(inst.options.drag_min_distance / ev.distance);
Hammer.detection.current.startEvent.center.pageX += ev.deltaX * factor;
Hammer.detection.current.startEvent.center.pageY += ev.deltaY * factor;
// recalculate event data using new start point
ev = Hammer.detection.extendEventData(ev);
}
}
// lock drag to axis?
if(Hammer.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance <= ev.distance)) {
ev.drag_locked_to_axis = true;
}
var last_direction = Hammer.detection.current.lastEvent.direction;
if(ev.drag_locked_to_axis && last_direction !== ev.direction) {
// keep direction on the axis that the drag gesture started on
if(Hammer.utils.isVertical(last_direction)) {
ev.direction = (ev.deltaY < 0) ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
}
else {
ev.direction = (ev.deltaX < 0) ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
}
}
// first time, trigger dragstart event
if(!this.triggered) {
inst.trigger(this.name + 'start', ev);
this.triggered = true;
}
// trigger normal event
inst.trigger(this.name, ev);
// direction event, like dragdown
inst.trigger(this.name + ev.direction, ev);
// block the browser events
if((inst.options.drag_block_vertical && Hammer.utils.isVertical(ev.direction)) ||
(inst.options.drag_block_horizontal && !Hammer.utils.isVertical(ev.direction))) {
ev.preventDefault();
}
break;
case Hammer.EVENT_END:
// trigger dragend
if(this.triggered) {
inst.trigger(this.name + 'end', ev);
}
this.triggered = false;
break;
}
}
};
/**
* Hold
* Touch stays at the same place for x time
* @events hold
*/
Hammer.gestures.Hold = {
name : 'hold',
index : 10,
defaults: {
hold_timeout : 500,
hold_threshold: 1
},
timer : null,
handler : function holdGesture(ev, inst) {
switch(ev.eventType) {
case Hammer.EVENT_START:
// clear any running timers
clearTimeout(this.timer);
// set the gesture so we can check in the timeout if it still is
Hammer.detection.current.name = this.name;
// set timer and if after the timeout it still is hold,
// we trigger the hold event
this.timer = setTimeout(function() {
if(Hammer.detection.current.name == 'hold') {
inst.trigger('hold', ev);
}
}, inst.options.hold_timeout);
break;
// when you move or end we clear the timer
case Hammer.EVENT_MOVE:
if(ev.distance > inst.options.hold_threshold) {
clearTimeout(this.timer);
}
break;
case Hammer.EVENT_END:
clearTimeout(this.timer);
break;
}
}
};
/**
* Release
* Called as last, tells the user has released the screen
* @events release
*/
Hammer.gestures.Release = {
name : 'release',
index : Infinity,
handler: function releaseGesture(ev, inst) {
if(ev.eventType == Hammer.EVENT_END) {
inst.trigger(this.name, ev);
}
}
};
/**
* Swipe
* triggers swipe events when the end velocity is above the threshold
* @events swipe, swipeleft, swiperight, swipeup, swipedown
*/
Hammer.gestures.Swipe = {
name : 'swipe',
index : 40,
defaults: {
// set 0 for unlimited, but this can conflict with transform
swipe_min_touches: 1,
swipe_max_touches: 1,
swipe_velocity : 0.7
},
handler : function swipeGesture(ev, inst) {
if(ev.eventType == Hammer.EVENT_END) {
// max touches
if(inst.options.swipe_max_touches > 0 &&
ev.touches.length < inst.options.swipe_min_touches &&
ev.touches.length > inst.options.swipe_max_touches) {
return;
}
// when the distance we moved is too small we skip this gesture
// or we can be already in dragging
if(ev.velocityX > inst.options.swipe_velocity ||
ev.velocityY > inst.options.swipe_velocity) {
// trigger swipe events
inst.trigger(this.name, ev);
inst.trigger(this.name + ev.direction, ev);
}
}
}
};
/**
* Tap/DoubleTap
* Quick touch at a place or double at the same place
* @events tap, doubletap
*/
Hammer.gestures.Tap = {
name : 'tap',
index : 100,
defaults: {
tap_max_touchtime : 250,
tap_max_distance : 10,
tap_always : true,
doubletap_distance: 20,
doubletap_interval: 300
},
handler : function tapGesture(ev, inst) {
if(ev.eventType == Hammer.EVENT_END && ev.srcEvent.type != 'touchcancel') {
// previous gesture, for the double tap since these are two different gesture detections
var prev = Hammer.detection.previous,
did_doubletap = false;
// when the touchtime is higher then the max touch time
// or when the moving distance is too much
if(ev.deltaTime > inst.options.tap_max_touchtime ||
ev.distance > inst.options.tap_max_distance) {
return;
}
// check if double tap
if(prev && prev.name == 'tap' &&
(ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&
ev.distance < inst.options.doubletap_distance) {
inst.trigger('doubletap', ev);
did_doubletap = true;
}
// do a single tap
if(!did_doubletap || inst.options.tap_always) {
Hammer.detection.current.name = 'tap';
inst.trigger(Hammer.detection.current.name, ev);
}
}
}
};
/**
* Touch
* Called as first, tells the user has touched the screen
* @events touch
*/
Hammer.gestures.Touch = {
name : 'touch',
index : -Infinity,
defaults: {
// call preventDefault at touchstart, and makes the element blocking by
// disabling the scrolling of the page, but it improves gestures like
// transforming and dragging.
// be careful with using this, it can be very annoying for users to be stuck
// on the page
prevent_default : false,
// disable mouse events, so only touch (or pen!) input triggers events
prevent_mouseevents: false
},
handler : function touchGesture(ev, inst) {
if(inst.options.prevent_mouseevents && ev.pointerType == Hammer.POINTER_MOUSE) {
ev.stopDetect();
return;
}
if(inst.options.prevent_default) {
ev.preventDefault();
}
if(ev.eventType == Hammer.EVENT_START) {
inst.trigger(this.name, ev);
}
}
};
/**
* Transform
* User want to scale or rotate with 2 fingers
* @events transform, pinch, pinchin, pinchout, rotate
*/
Hammer.gestures.Transform = {
name : 'transform',
index : 45,
defaults : {
// factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1
transform_min_scale : 0.01,
// rotation in degrees
transform_min_rotation: 1,
// prevent default browser behavior when two touches are on the screen
// but it makes the element a blocking element
// when you are using the transform gesture, it is a good practice to set this true
transform_always_block: false
},
triggered: false,
handler : function transformGesture(ev, inst) {
// current gesture isnt drag, but dragged is true
// this means an other gesture is busy. now call dragend
if(Hammer.detection.current.name != this.name && this.triggered) {
inst.trigger(this.name + 'end', ev);
this.triggered = false;
return;
}
// atleast multitouch
if(ev.touches.length < 2) {
return;
}
// prevent default when two fingers are on the screen
if(inst.options.transform_always_block) {
ev.preventDefault();
}
switch(ev.eventType) {
case Hammer.EVENT_START:
this.triggered = false;
break;
case Hammer.EVENT_MOVE:
var scale_threshold = Math.abs(1 - ev.scale);
var rotation_threshold = Math.abs(ev.rotation);
// when the distance we moved is too small we skip this gesture
// or we can be already in dragging
if(scale_threshold < inst.options.transform_min_scale &&
rotation_threshold < inst.options.transform_min_rotation) {
return;
}
// we are transforming!
Hammer.detection.current.name = this.name;
// first time, trigger dragstart event
if(!this.triggered) {
inst.trigger(this.name + 'start', ev);
this.triggered = true;
}
inst.trigger(this.name, ev); // basic transform event
// trigger rotate event
if(rotation_threshold > inst.options.transform_min_rotation) {
inst.trigger('rotate', ev);
}
// trigger pinch event
if(scale_threshold > inst.options.transform_min_scale) {
inst.trigger('pinch', ev);
inst.trigger('pinch' + ((ev.scale < 1) ? 'in' : 'out'), ev);
}
break;
case Hammer.EVENT_END:
// trigger dragend
if(this.triggered) {
inst.trigger(this.name + 'end', ev);
}
this.triggered = false;
break;
}
}
};
// Based off Lo-Dash's excellent UMD wrapper (slightly modified) - https://github.com/bestiejs/lodash/blob/master/lodash.js#L5515-L5543
// some AMD build optimizers, like r.js, check for specific condition patterns like the following:
if(typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
// define as an anonymous module
define(function() {
return Hammer;
});
// check for `exports` after `define` in case a build optimizer adds an `exports` object
}
else if(typeof module === 'object' && typeof module.exports === 'object') {
module.exports = Hammer;
}
else {
window.Hammer = Hammer;
}
})(this);
/*! jQuery plugin for Hammer.JS - v1.0.0 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license */(function(window, undefined) {
'use strict';
function setup(Hammer, $) {
/**
* bind dom events
* this overwrites addEventListener
* @param {HTMLElement} element
* @param {String} eventTypes
* @param {Function} handler
*/
Hammer.event.bindDom = function(element, eventTypes, handler) {
$(element).on(eventTypes, function(ev) {
var data = ev.originalEvent || ev;
if(data.pageX === undefined) {
data.pageX = ev.pageX;
data.pageY = ev.pageY;
}
if(!data.target) {
data.target = ev.target;
}
if(data.which === undefined) {
data.which = data.button;
}
if(!data.preventDefault) {
data.preventDefault = ev.preventDefault;
}
if(!data.stopPropagation) {
data.stopPropagation = ev.stopPropagation;
}
handler.call(this, data);
});
};
/**
* the methods are called by the instance, but with the jquery plugin
* we use the jquery event methods instead.
* @this {Hammer.Instance}
* @return {jQuery}
*/
Hammer.Instance.prototype.on = function(types, handler) {
return $(this.element).on(types, handler);
};
Hammer.Instance.prototype.off = function(types, handler) {
return $(this.element).off(types, handler);
};
/**
* trigger events
* this is called by the gestures to trigger an event like 'tap'
* @this {Hammer.Instance}
* @param {String} gesture
* @param {Object} eventData
* @return {jQuery}
*/
Hammer.Instance.prototype.trigger = function(gesture, eventData) {
var el = $(this.element);
if(el.has(eventData.target).length) {
el = $(eventData.target);
}
return el.trigger({
type : gesture,
gesture: eventData
});
};
/**
* jQuery plugin
* create instance of Hammer and watch for gestures,
* and when called again you can change the options
* @param {Object} [options={}]
* @return {jQuery}
*/
$.fn.hammer = function(options) {
return this.each(function() {
var el = $(this);
var inst = el.data('hammer');
// start new hammer instance
if(!inst) {
el.data('hammer', new Hammer(this, options || {}));
}
// change the options
else if(inst && options) {
Hammer.utils.extend(inst.options, options);
}
});
};
}
// Based off Lo-Dash's excellent UMD wrapper (slightly modified) - https://github.com/bestiejs/lodash/blob/master/lodash.js#L5515-L5543
// some AMD build optimizers, like r.js, check for specific condition patterns like the following:
if(typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
// define as an anonymous module
define(['hammer', 'jquery'], setup);
}
else {
setup(window.Hammer, window.jQuery || window.Zepto);
}
})(this);
/* jQuery plugin for Hammer.JS - v1.0.0 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
* Licensed under the MIT license */
!function(a,b){"use strict";function c(){d.READY||(d.event.determineEventTypes(),d.utils.each(d.gestures,function(a){d.detection.register(a)}),d.event.onTouch(d.DOCUMENT,d.EVENT_MOVE,d.detection.detect),d.event.onTouch(d.DOCUMENT,d.EVENT_END,d.detection.detect),d.READY=!0)}var d=function(a,b){return new d.Instance(a,b||{})};d.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},d.HAS_POINTEREVENTS=a.navigator.pointerEnabled||a.navigator.msPointerEnabled,d.HAS_TOUCHEVENTS="ontouchstart"in a,d.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,d.NO_MOUSEEVENTS=d.HAS_TOUCHEVENTS&&a.navigator.userAgent.match(d.MOBILE_REGEX),d.EVENT_TYPES={},d.DIRECTION_DOWN="down",d.DIRECTION_LEFT="left",d.DIRECTION_UP="up",d.DIRECTION_RIGHT="right",d.POINTER_MOUSE="mouse",d.POINTER_TOUCH="touch",d.POINTER_PEN="pen",d.EVENT_START="start",d.EVENT_MOVE="move",d.EVENT_END="end",d.DOCUMENT=a.document,d.plugins=d.plugins||{},d.gestures=d.gestures||{},d.READY=!1,d.utils={extend:function(a,c,d){for(var e in c)a[e]!==b&&d||(a[e]=c[e]);return a},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},hasParent:function(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1},getCenter:function(a){var b=[],c=[];return d.utils.each(a,function(a){b.push("undefined"!=typeof a.clientX?a.clientX:a.pageX),c.push("undefined"!=typeof a.clientY?a.clientY:a.pageY)}),{pageX:(Math.min.apply(Math,b)+Math.max.apply(Math,b))/2,pageY:(Math.min.apply(Math,c)+Math.max.apply(Math,c))/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.pageY-a.pageY,d=b.pageX-a.pageX;return 180*Math.atan2(c,d)/Math.PI},getDirection:function(a,b){var c=Math.abs(a.pageX-b.pageX),e=Math.abs(a.pageY-b.pageY);return c>=e?a.pageX-b.pageX>0?d.DIRECTION_LEFT:d.DIRECTION_RIGHT:a.pageY-b.pageY>0?d.DIRECTION_UP:d.DIRECTION_DOWN},getDistance:function(a,b){var c=b.pageX-a.pageX,d=b.pageY-a.pageY;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==d.DIRECTION_UP||a==d.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(a,b){b&&a&&a.style&&(d.utils.each(["webkit","khtml","moz","Moz","ms","o",""],function(c){d.utils.each(b,function(b){c&&(b=c+b.substring(0,1).toUpperCase()+b.substring(1)),b in a.style&&(a.style[b]=b)})}),"none"==b.userSelect&&(a.onselectstart=function(){return!1}),"none"==b.userDrag&&(a.ondragstart=function(){return!1}))}},d.Instance=function(a,b){var e=this;return c(),this.element=a,this.enabled=!0,this.options=d.utils.extend(d.utils.extend({},d.defaults),b||{}),this.options.stop_browser_behavior&&d.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),d.event.onTouch(a,d.EVENT_START,function(a){e.enabled&&d.detection.startDetect(e,a)}),this},d.Instance.prototype={on:function(a,b){var c=a.split(" ");return d.utils.each(c,function(a){this.element.addEventListener(a,b,!1)},this),this},off:function(a,b){var c=a.split(" ");return d.utils.each(c,function(a){this.element.removeEventListener(a,b,!1)},this),this},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 d.utils.hasParent(b.target,e)&&(e=b.target),e.dispatchEvent(c),this},enable:function(a){return this.enabled=a,this}};var e=null,f=!1,g=!1;d.event={bindDom:function(a,b,c){var e=b.split(" ");d.utils.each(e,function(b){a.addEventListener(b,c,!1)})},onTouch:function(a,b,c){var h=this;this.bindDom(a,d.EVENT_TYPES[b],function(i){var j=i.type.toLowerCase();if(!j.match(/mouse/)||!g){j.match(/touch/)||j.match(/pointerdown/)||j.match(/mouse/)&&1===i.which?f=!0:j.match(/mouse/)&&!i.which&&(f=!1),j.match(/touch|pointer/)&&(g=!0);var k=0;f&&(d.HAS_POINTEREVENTS&&b!=d.EVENT_END?k=d.PointerEvent.updatePointer(b,i):j.match(/touch/)?k=i.touches.length:g||(k=j.match(/up/)?0:1),k>0&&b==d.EVENT_END?b=d.EVENT_MOVE:k||(b=d.EVENT_END),(k||null===e)&&(e=i),c.call(d.detection,h.collectEventData(a,b,h.getTouchList(e,b),i)),d.HAS_POINTEREVENTS&&b==d.EVENT_END&&(k=d.PointerEvent.updatePointer(b,i))),k||(e=null,f=!1,g=!1,d.PointerEvent.reset())}})},determineEventTypes:function(){var a;a=d.HAS_POINTEREVENTS?d.PointerEvent.getEvents():d.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],d.EVENT_TYPES[d.EVENT_START]=a[0],d.EVENT_TYPES[d.EVENT_MOVE]=a[1],d.EVENT_TYPES[d.EVENT_END]=a[2]},getTouchList:function(a){return d.HAS_POINTEREVENTS?d.PointerEvent.getTouchList():a.touches?a.touches:(a.identifier=1,[a])},collectEventData:function(a,b,c,e){var f=d.POINTER_TOUCH;return(e.type.match(/mouse/)||d.PointerEvent.matchType(d.POINTER_MOUSE,e))&&(f=d.POINTER_MOUSE),{center:d.utils.getCenter(c),timeStamp:(new Date).getTime(),target:e.target,touches:c,eventType:b,pointerType:f,srcEvent:e,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault&&this.srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return d.detection.stopDetect()}}}},d.PointerEvent={pointers:{},getTouchList:function(){var a=this,b=[];return d.utils.each(a.pointers,function(a){b.push(a)}),b},updatePointer:function(a,b){return a==d.EVENT_END?this.pointers={}:(b.identifier=b.pointerId,this.pointers[b.pointerId]=b),Object.keys(this.pointers).length},matchType:function(a,b){if(!b.pointerType)return!1;var c=b.pointerType,e={};return e[d.POINTER_MOUSE]=c===b.MSPOINTER_TYPE_MOUSE||c===d.POINTER_MOUSE,e[d.POINTER_TOUCH]=c===b.MSPOINTER_TYPE_TOUCH||c===d.POINTER_TOUCH,e[d.POINTER_PEN]=c===b.MSPOINTER_TYPE_PEN||c===d.POINTER_PEN,e[a]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},d.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(a,b){this.current||(this.stopped=!1,this.current={inst:a,startEvent:d.utils.extend({},b),lastEvent:!1,name:""},this.detect(b))},detect:function(a){if(this.current&&!this.stopped){a=this.extendEventData(a);var b=this.current.inst.options;return d.utils.each(this.gestures,function(c){return this.stopped||b[c.name]===!1||c.handler.call(c,a,this.current.inst)!==!1?void 0:(this.stopDetect(),!1)},this),this.current&&(this.current.lastEvent=a),a.eventType==d.EVENT_END&&!a.touches.length-1&&this.stopDetect(),a}},stopDetect:function(){this.previous=d.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(a){var b=this.current.startEvent;!b||a.touches.length==b.touches.length&&a.touches!==b.touches||(b.touches=[],d.utils.each(a.touches,function(a){b.touches.push(d.utils.extend({},a))}));var c,e,f=a.timeStamp-b.timeStamp,g=a.center.pageX-b.center.pageX,h=a.center.pageY-b.center.pageY,i=d.utils.getVelocity(f,g,h);return"end"===a.eventType?(c=this.current.lastEvent&&this.current.lastEvent.interimAngle,e=this.current.lastEvent&&this.current.lastEvent.interimDirection):(c=this.current.lastEvent&&d.utils.getAngle(this.current.lastEvent.center,a.center),e=this.current.lastEvent&&d.utils.getDirection(this.current.lastEvent.center,a.center)),d.utils.extend(a,{deltaTime:f,deltaX:g,deltaY:h,velocityX:i.x,velocityY:i.y,distance:d.utils.getDistance(b.center,a.center),angle:d.utils.getAngle(b.center,a.center),interimAngle:c,direction:d.utils.getDirection(b.center,a.center),interimDirection:e,scale:d.utils.getScale(b.touches,a.touches),rotation:d.utils.getRotation(b.touches,a.touches),startEvent:b}),a},register:function(a){var c=a.defaults||{};return c[a.name]===b&&(c[a.name]=!0),d.utils.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.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(a,b){if(d.detection.current.name!=this.name&&this.triggered)return b.trigger(this.name+"end",a),this.triggered=!1,void 0;if(!(b.options.drag_max_touches>0&&a.touches.length>b.options.drag_max_touches))switch(a.eventType){case d.EVENT_START:this.triggered=!1;break;case d.EVENT_MOVE:if(a.distance<b.options.drag_min_distance&&d.detection.current.name!=this.name)return;if(d.detection.current.name!=this.name&&(d.detection.current.name=this.name,b.options.correct_for_drag_min_distance&&a.distance>0)){var c=Math.abs(b.options.drag_min_distance/a.distance);d.detection.current.startEvent.center.pageX+=a.deltaX*c,d.detection.current.startEvent.center.pageY+=a.deltaY*c,a=d.detection.extendEventData(a)}(d.detection.current.lastEvent.drag_locked_to_axis||b.options.drag_lock_to_axis&&b.options.drag_lock_min_distance<=a.distance)&&(a.drag_locked_to_axis=!0);var e=d.detection.current.lastEvent.direction;a.drag_locked_to_axis&&e!==a.direction&&(a.direction=d.utils.isVertical(e)?a.deltaY<0?d.DIRECTION_UP:d.DIRECTION_DOWN:a.deltaX<0?d.DIRECTION_LEFT:d.DIRECTION_RIGHT),this.triggered||(b.trigger(this.name+"start",a),this.triggered=!0),b.trigger(this.name,a),b.trigger(this.name+a.direction,a),(b.options.drag_block_vertical&&d.utils.isVertical(a.direction)||b.options.drag_block_horizontal&&!d.utils.isVertical(a.direction))&&a.preventDefault();break;case d.EVENT_END:this.triggered&&b.trigger(this.name+"end",a),this.triggered=!1}}},d.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:1},timer:null,handler:function(a,b){switch(a.eventType){case d.EVENT_START:clearTimeout(this.timer),d.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==d.detection.current.name&&b.trigger("hold",a)},b.options.hold_timeout);break;case d.EVENT_MOVE:a.distance>b.options.hold_threshold&&clearTimeout(this.timer);break;case d.EVENT_END:clearTimeout(this.timer)}}},d.gestures.Release={name:"release",index:1/0,handler:function(a,b){a.eventType==d.EVENT_END&&b.trigger(this.name,a)}},d.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_min_touches:1,swipe_max_touches:1,swipe_velocity:.7},handler:function(a,b){if(a.eventType==d.EVENT_END){if(b.options.swipe_max_touches>0&&a.touches.length<b.options.swipe_min_touches&&a.touches.length>b.options.swipe_max_touches)return;(a.velocityX>b.options.swipe_velocity||a.velocityY>b.options.swipe_velocity)&&(b.trigger(this.name,a),b.trigger(this.name+a.direction,a))}}},d.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},handler:function(a,b){if(a.eventType==d.EVENT_END&&"touchcancel"!=a.srcEvent.type){var c=d.detection.previous,e=!1;if(a.deltaTime>b.options.tap_max_touchtime||a.distance>b.options.tap_max_distance)return;c&&"tap"==c.name&&a.timeStamp-c.lastEvent.timeStamp<b.options.doubletap_interval&&a.distance<b.options.doubletap_distance&&(b.trigger("doubletap",a),e=!0),(!e||b.options.tap_always)&&(d.detection.current.name="tap",b.trigger(d.detection.current.name,a))}}},d.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(a,b){return b.options.prevent_mouseevents&&a.pointerType==d.POINTER_MOUSE?(a.stopDetect(),void 0):(b.options.prevent_default&&a.preventDefault(),a.eventType==d.EVENT_START&&b.trigger(this.name,a),void 0)}},d.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(a,b){if(d.detection.current.name!=this.name&&this.triggered)return b.trigger(this.name+"end",a),this.triggered=!1,void 0;if(!(a.touches.length<2))switch(b.options.transform_always_block&&a.preventDefault(),a.eventType){case d.EVENT_START:this.triggered=!1;break;case d.EVENT_MOVE:var c=Math.abs(1-a.scale),e=Math.abs(a.rotation);if(c<b.options.transform_min_scale&&e<b.options.transform_min_rotation)return;d.detection.current.name=this.name,this.triggered||(b.trigger(this.name+"start",a),this.triggered=!0),b.trigger(this.name,a),e>b.options.transform_min_rotation&&b.trigger("rotate",a),c>b.options.transform_min_scale&&(b.trigger("pinch",a),b.trigger("pinch"+(a.scale<1?"in":"out"),a));break;case d.EVENT_END:this.triggered&&b.trigger(this.name+"end",a),this.triggered=!1}}},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return d}):"object"==typeof module&&"object"==typeof module.exports?module.exports=d:a.Hammer=d}(this),function(a,b){"use strict";function c(a,c){a.event.bindDom=function(a,d,e){c(a).on(d,function(a){var c=a.originalEvent||a;c.pageX===b&&(c.pageX=a.pageX,c.pageY=a.pageY),c.target||(c.target=a.target),c.which===b&&(c.which=c.button),c.preventDefault||(c.preventDefault=a.preventDefault),c.stopPropagation||(c.stopPropagation=a.stopPropagation),e.call(this,c)})},a.Instance.prototype.on=function(a,b){return c(this.element).on(a,b)},a.Instance.prototype.off=function(a,b){return c(this.element).off(a,b)},a.Instance.prototype.trigger=function(a,b){var d=c(this.element);return d.has(b.target).length&&(d=c(b.target)),d.trigger({type:a,gesture:b})},c.fn.hammer=function(b){return this.each(function(){var d=c(this),e=d.data("hammer");e?e&&b&&a.utils.extend(e.options,b):d.data("hammer",new a(this,b||{}))})}}"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(["hammer","jquery"],c):c(a.Hammer,a.jQuery||a.Zepto)}(this);
//# sourceMappingURL=jquery.hammer.min.map
{"version":3,"file":"jquery.hammer.min.js","sources":["jquery.hammer.js"],"names":["window","undefined","setup","Hammer","READY","event","determineEventTypes","utils","each","gestures","gesture","detection","register","onTouch","DOCUMENT","EVENT_MOVE","detect","EVENT_END","element","options","Instance","defaults","stop_browser_behavior","userSelect","touchAction","touchCallout","contentZooming","userDrag","tapHighlightColor","HAS_POINTEREVENTS","navigator","pointerEnabled","msPointerEnabled","HAS_TOUCHEVENTS","MOBILE_REGEX","NO_MOUSEEVENTS","userAgent","match","EVENT_TYPES","DIRECTION_DOWN","DIRECTION_LEFT","DIRECTION_UP","DIRECTION_RIGHT","POINTER_MOUSE","POINTER_TOUCH","POINTER_PEN","EVENT_START","document","plugins","extend","dest","src","merge","key","obj","iterator","context","i","length","forEach","call","hasOwnProperty","hasParent","node","parent","parentNode","getCenter","touches","valuesX","valuesY","touch","push","clientX","pageX","clientY","pageY","Math","min","apply","max","getVelocity","delta_time","delta_x","delta_y","x","abs","y","getAngle","touch1","touch2","atan2","PI","getDirection","getDistance","sqrt","getScale","start","end","this","getRotation","isVertical","direction","stopDefaultBrowserBehavior","css_props","style","vendor","prop","substring","toUpperCase","onselectstart","ondragstart","self","enabled","ev","startDetect","prototype","on","handler","split","addEventListener","off","removeEventListener","trigger","eventData","createEvent","initEvent","target","dispatchEvent","enable","state","last_move_event","enable_detect","touch_triggered","bindDom","type","types","eventType","sourceEventType","toLowerCase","which","count_touches","PointerEvent","updatePointer","collectEventData","getTouchList","reset","getEvents","identifier","pointerType","matchType","center","timeStamp","Date","getTime","srcEvent","preventDefault","preventManipulation","stopPropagation","stopDetect","pointers","touchlist","pointer","pointerEvent","pointerId","Object","keys","pt","MSPOINTER_TYPE_MOUSE","MSPOINTER_TYPE_TOUCH","MSPOINTER_TYPE_PEN","current","previous","stopped","inst","startEvent","lastEvent","name","extendEventData","inst_options","startEv","interimAngle","interimDirection","velocity","deltaTime","deltaX","deltaY","velocityX","velocityY","distance","angle","scale","rotation","index","sort","a","b","Drag","drag_min_distance","correct_for_drag_min_distance","drag_max_touches","drag_block_horizontal","drag_block_vertical","drag_lock_to_axis","drag_lock_min_distance","triggered","factor","drag_locked_to_axis","last_direction","Hold","hold_timeout","hold_threshold","timer","clearTimeout","setTimeout","Release","Infinity","Swipe","swipe_min_touches","swipe_max_touches","swipe_velocity","Tap","tap_max_touchtime","tap_max_distance","tap_always","doubletap_distance","doubletap_interval","prev","did_doubletap","Touch","prevent_default","prevent_mouseevents","Transform","transform_min_scale","transform_min_rotation","transform_always_block","scale_threshold","rotation_threshold","define","amd","module","exports","$","eventTypes","data","originalEvent","button","el","has","fn","hammer","jQuery","Zepto"],"mappings":";;;;;CAUA,SAAUA,EAAQC,GAChB,YA8EF,SAASC,KACJC,EAAOC,QAKVD,EAAOE,MAAMC,sBAGbH,EAAOI,MAAMC,KAAKL,EAAOM,SAAU,SAASC,GAC1CP,EAAOQ,UAAUC,SAASF,KAI5BP,EAAOE,MAAMQ,QAAQV,EAAOW,SAAUX,EAAOY,WAAYZ,EAAOQ,UAAUK,QAC1Eb,EAAOE,MAAMQ,QAAQV,EAAOW,SAAUX,EAAOc,UAAWd,EAAOQ,UAAUK,QAGzEb,EAAOC,OAAQ,GAtFjB,GAAID,GAAS,SAASe,EAASC,GAC7B,MAAO,IAAIhB,GAAOiB,SAASF,EAASC,OAItChB,GAAOkB,UAKLC,uBAEEC,WAAmB,OAGnBC,YAAmB,OACnBC,aAAmB,OACnBC,eAAmB,OACnBC,SAAmB,OACnBC,kBAAmB,kBASvBzB,EAAO0B,kBAAoB7B,EAAO8B,UAAUC,gBAAkB/B,EAAO8B,UAAUE,iBAC/E7B,EAAO8B,gBAAmB,gBAAkBjC,GAG5CG,EAAO+B,aAAe,6CACtB/B,EAAOgC,eAAiBhC,EAAO8B,iBAAmBjC,EAAO8B,UAAUM,UAAUC,MAAMlC,EAAO+B,cAI1F/B,EAAOmC,eAGPnC,EAAOoC,eAAiB,OACxBpC,EAA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AAO4H,GAAE/I,KAAKhF,SAASkG,GAAGmB,EAAOlB,IAEnClH,EAAOiB,SAAS+F,UAAUK,IAAM,SAASe,EAAOlB,GAC9C,MAAO4H,GAAE/I,KAAKhF,SAASsG,IAAIe,EAAOlB,IAYpClH,EAAOiB,SAAS+F,UAAUO,QAAU,SAAShH,EAASiH,GACpD,GAAI2H,GAAKL,EAAE/I,KAAKhF,QAKhB,OAJGoO,GAAGC,IAAI5H,EAAUG,QAAQpE,SAC1B4L,EAAKL,EAAEtH,EAAUG,SAGZwH,EAAG5H,SACRY,KAAS5H,EACTA,QAASiH,KAYbsH,EAAEO,GAAGC,OAAS,SAAStO,GACrB,MAAO+E,MAAK1F,KAAK,WACf,GAAI8O,GAAKL,EAAE/I,MACP2E,EAAOyE,EAAGH,KAAK,SAEftE,GAIIA,GAAQ1J,GACdhB,EAAOI,MAAM0C,OAAO4H,EAAK1J,QAASA,GAJlCmO,EAAGH,KAAK,SAAU,GAAIhP,GAAO+F,KAAM/E,WAYrB,kBAAV0N,SAA6C,gBAAdA,QAAOC,KAAmBD,OAAOC,IAExED,QAAQ,SAAU,UAAW3O,GAI7BA,EAAMF,EAAOG,OAAQH,EAAO0P,QAAU1P,EAAO2P,QAE9CzJ"}
\ No newline at end of file
{
"name": "jquery-hammerjs",
"title": "jQuery plugin for Hammer.JS",
"description": "A javascript library for multi-touch gestures",
"version": "1.0.0",
"homepage": "http://eightmedia.github.com/hammer.js",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/eightmedia/jquery.hammer.js/blob/master/LICENSE"
}
],
"keywords": [
"jquery",
"touch",
"gestures"
],
"author": {
"name": "Jorik Tangelder",
"email": "j.tangelder@gmail.com"
},
"repository": {
"type": "git",
"url": "git://github.com/EightMedia/jquery.hammer.js.git"
},
"bugs": {
"url": "https://github.com/EightMedia/jquery.hammer.js/issues"
},
"devDependencies": {
"grunt": "0.4.x",
"grunt-contrib-connect": "0.5.x",
"grunt-contrib-concat": "0.3.x",
"grunt-contrib-uglify": "0.2.x",
"grunt-contrib-jshint": "0.7.x",
"grunt-contrib-watch": "0.5.x",
"faketouches": "git://github.com/jtangelder/faketouches.js.git",
"underscore": "1.5.x",
"grunt-contrib-qunit": "~0.3.0"
},
"main": "jquery.hammer.js",
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}
(function(window, undefined) {
'use strict';
\ No newline at end of file
// Based off Lo-Dash's excellent UMD wrapper (slightly modified) - https://github.com/bestiejs/lodash/blob/master/lodash.js#L5515-L5543
// some AMD build optimizers, like r.js, check for specific condition patterns like the following:
if(typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
// define as an anonymous module
define(['hammer', 'jquery'], setup);
}
else {
setup(window.Hammer, window.jQuery || window.Zepto);
}
})(this);
\ No newline at end of file
function setup(Hammer, $) {
/**
* bind dom events
* this overwrites addEventListener
* @param {HTMLElement} element
* @param {String} eventTypes
* @param {Function} handler
*/
Hammer.event.bindDom = function(element, eventTypes, handler) {
$(element).on(eventTypes, function(ev) {
var data = ev.originalEvent || ev;
if(data.pageX === undefined) {
data.pageX = ev.pageX;
data.pageY = ev.pageY;
}
if(!data.target) {
data.target = ev.target;
}
if(data.which === undefined) {
data.which = data.button;
}
if(!data.preventDefault) {
data.preventDefault = ev.preventDefault;
}
if(!data.stopPropagation) {
data.stopPropagation = ev.stopPropagation;
}
handler.call(this, data);
});
};
/**
* the methods are called by the instance, but with the jquery plugin
* we use the jquery event methods instead.
* @this {Hammer.Instance}
* @return {jQuery}
*/
Hammer.Instance.prototype.on = function(types, handler) {
return $(this.element).on(types, handler);
};
Hammer.Instance.prototype.off = function(types, handler) {
return $(this.element).off(types, handler);
};
/**
* trigger events
* this is called by the gestures to trigger an event like 'tap'
* @this {Hammer.Instance}
* @param {String} gesture
* @param {Object} eventData
* @return {jQuery}
*/
Hammer.Instance.prototype.trigger = function(gesture, eventData) {
var el = $(this.element);
if(el.has(eventData.target).length) {
el = $(eventData.target);
}
return el.trigger({
type : gesture,
gesture: eventData
});
};
/**
* jQuery plugin
* create instance of Hammer and watch for gestures,
* and when called again you can change the options
* @param {Object} [options={}]
* @return {jQuery}
*/
$.fn.hammer = function(options) {
return this.each(function() {
var el = $(this);
var inst = el.data('hammer');
// start new hammer instance
if(!inst) {
el.data('hammer', new Hammer(this, options || {}));
}
// change the options
else if(inst && options) {
Hammer.utils.extend(inst.options, options);
}
});
};
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../hammer.js/tests/libs/qunit.css" media="screen">
<script src="../hammer.js/tests/libs/jquery.js"></script>
<script src="../hammer.js/tests/libs/qunit.js"></script>
<script src="../hammer.js/tests/libs/underscore.js"></script>
<script src="../node_modules/faketouches/faketouches.js"></script>
<script src="../jquery.hammer.js"></script>
<script src="../hammer.js/plugins/hammer.showtouches.js"></script>
</head>
<body>
<script>
Hammer.HAS_POINTEREVENTS = false;
Hammer.HAS_TOUCHEVENTS = false;
var set_faketouches_type = FakeTouches.MOUSE_EVENTS;
</script>
<div id="toucharea" style="width:500px;height:500px;"></div>
<div id="qunit"></div>
<script src="../hammer.js/tests/gestures.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../hammer.js/tests/libs/qunit.css" media="screen">
<script src="../hammer.js/tests/libs/jquery.js"></script>
<script src="../hammer.js/tests/libs/qunit.js"></script>
<script src="../hammer.js/tests/libs/underscore.js"></script>
<script src="../node_modules/faketouches/faketouches.js"></script>
<script src="../jquery.hammer.js"></script>
<script src="../hammer.js/plugins/hammer.showtouches.js"></script>
</head>
<body>
<script>
Hammer.HAS_POINTEREVENTS = false;
Hammer.HAS_TOUCHEVENTS = true;
var set_faketouches_type = FakeTouches.TOUCH_AND_MOUSE_EVENTS;
</script>
<div id="toucharea" style="width:500px;height:500px;"></div>
<div id="qunit"></div>
<script src="../hammer.js/tests/gestures.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../hammer.js/tests/libs/qunit.css" media="screen">
<script src="../hammer.js/tests/libs/jquery.js"></script>
<script src="../hammer.js/tests/libs/qunit.js"></script>
<script src="../hammer.js/tests/libs/underscore.js"></script>
<script src="../node_modules/faketouches/faketouches.js"></script>
<script src="../jquery.hammer.js"></script>
<script src="../hammer.js/plugins/hammer.showtouches.js"></script>
</head>
<body>
<script>
Hammer.HAS_POINTEREVENTS = true;
Hammer.HAS_TOUCHEVENTS = false;
var set_faketouches_type = FakeTouches.POINTER_MOUSE_EVENTS;
</script>
<div id="toucharea" style="width:500px;height:500px;"></div>
<div id="qunit"></div>
<script src="../hammer.js/tests/gestures.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../hammer.js/tests/libs/qunit.css" media="screen">
<script src="../hammer.js/tests/libs/jquery.js"></script>
<script src="../hammer.js/tests/libs/qunit.js"></script>
<script src="../hammer.js/tests/libs/underscore.js"></script>
<script src="../node_modules/faketouches/faketouches.js"></script>
<script src="../jquery.hammer.js"></script>
<script src="../hammer.js/plugins/hammer.showtouches.js"></script>
</head>
<body>
<script>
Hammer.HAS_POINTEREVENTS = true;
Hammer.HAS_TOUCHEVENTS = false;
var set_faketouches_type = FakeTouches.POINTER_TOUCH_EVENTS;
</script>
<div id="toucharea" style="width:500px;height:500px;"></div>
<div id="qunit"></div>
<script src="../hammer.js/tests/gestures.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../hammer.js/tests/libs/qunit.css" media="screen">
<script src="../hammer.js/tests/libs/jquery.js"></script>
<script src="../hammer.js/tests/libs/qunit.js"></script>
<script src="../hammer.js/tests/libs/underscore.js"></script>
<script src="../node_modules/faketouches/faketouches.js"></script>
<script src="../jquery.hammer.js"></script>
<script src="../hammer.js/plugins/hammer.showtouches.js"></script>
</head>
<body>
<script>
Hammer.HAS_POINTEREVENTS = false;
Hammer.HAS_TOUCHEVENTS = true;
var set_faketouches_type = FakeTouches.TOUCH_EVENTS;
</script>
<div id="toucharea" style="width:500px;height:500px;"></div>
<div id="qunit"></div>
<script src="../hammer.js/tests/gestures.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../hammer.js/tests/libs/qunit.css" media="screen">
<script src="../hammer.js/tests/libs/jquery.js"></script>
<script src="../hammer.js/tests/libs/qunit.js"></script>
<script src="../hammer.js/tests/libs/underscore.js"></script>
<script src="../node_modules/faketouches/faketouches.js"></script>
<script src="../jquery.hammer.js"></script>
<script src="../hammer.js/plugins/hammer.showtouches.js"></script>
</head>
<body>
<div id="qunit"></div>
<script src="../hammer.js/tests/utils.js"></script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment