materialize-sass 0.99.0 → 0.100.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/app/assets/javascripts/materialize.js +6015 -5060
- data/app/assets/javascripts/materialize/animation.js +4 -5
- data/app/assets/javascripts/materialize/buttons.js +24 -38
- data/app/assets/javascripts/materialize/cards.js +13 -21
- data/app/assets/javascripts/materialize/carousel.js +122 -110
- data/app/assets/javascripts/materialize/character_counter.js +14 -22
- data/app/assets/javascripts/materialize/chips.js +41 -44
- data/app/assets/javascripts/materialize/collapsible.js +41 -46
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +965 -1167
- data/app/assets/javascripts/materialize/date_picker/picker.js +546 -634
- data/app/assets/javascripts/materialize/date_picker/picker.time.js +166 -212
- data/app/assets/javascripts/materialize/dropdown.js +53 -68
- data/app/assets/javascripts/materialize/extras/nouislider.js +3 -1
- data/app/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
- data/app/assets/javascripts/materialize/forms.js +156 -154
- data/app/assets/javascripts/materialize/global.js +34 -43
- data/app/assets/javascripts/materialize/hammer.min.js +424 -1
- data/app/assets/javascripts/materialize/initial.js +3 -3
- data/app/assets/javascripts/materialize/jquery.easing.1.4.js +120 -142
- data/app/assets/javascripts/materialize/jquery.hammer.js +9 -9
- data/app/assets/javascripts/materialize/materialbox.js +81 -107
- data/app/assets/javascripts/materialize/modal.js +373 -162
- data/app/assets/javascripts/materialize/parallax.js +11 -15
- data/app/assets/javascripts/materialize/pushpin.js +2 -5
- data/app/assets/javascripts/materialize/scrollFire.js +9 -11
- data/app/assets/javascripts/materialize/scrollspy.js +84 -92
- data/app/assets/javascripts/materialize/sideNav.js +128 -139
- data/app/assets/javascripts/materialize/slider.js +83 -112
- data/app/assets/javascripts/materialize/tabs.js +196 -196
- data/app/assets/javascripts/materialize/tapTarget.js +170 -173
- data/app/assets/javascripts/materialize/toasts.js +330 -112
- data/app/assets/javascripts/materialize/tooltip.js +134 -145
- data/app/assets/javascripts/materialize/transitions.js +43 -49
- data/app/assets/javascripts/materialize/velocity.min.js +623 -2
- data/app/assets/javascripts/materialize/waves.js +42 -47
- data/app/assets/stylesheets/materialize/components/_buttons.scss +1 -1
- data/app/assets/stylesheets/materialize/components/_carousel.scss +4 -5
- data/app/assets/stylesheets/materialize/components/_chips.scss +1 -0
- data/app/assets/stylesheets/materialize/components/_collapsible.scss +4 -7
- data/app/assets/stylesheets/materialize/components/_color.scss +1 -1
- data/app/assets/stylesheets/materialize/components/_global.scss +8 -14
- data/app/assets/stylesheets/materialize/components/_navbar.scss +0 -1
- data/app/assets/stylesheets/materialize/components/_tabs.scss +1 -7
- data/app/assets/stylesheets/materialize/components/_toast.scss +6 -12
- data/app/assets/stylesheets/materialize/components/_variables.scss +55 -43
- data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +1 -0
- data/app/assets/stylesheets/materialize/components/forms/_checkboxes.scss +2 -12
- data/app/assets/stylesheets/materialize/components/forms/_file-input.scss +6 -0
- data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +67 -37
- data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +1 -3
- data/app/assets/stylesheets/materialize/components/forms/_select.scss +72 -11
- data/app/assets/stylesheets/materialize/components/forms/_switches.scss +2 -4
- data/app/assets/stylesheets/materialize/extras/nouislider.css +8 -1
- data/lib/materialize-sass/version.rb +1 -1
- metadata +2 -5
- data/app/assets/javascripts/materialize/init.js +0 -214
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
- data/app/assets/javascripts/materialize/prism.js +0 -8
@@ -1,13 +1,12 @@
|
|
1
1
|
// Required for Meteor package, the use of window prevents export by Meteor
|
2
|
-
(function(window){
|
3
|
-
if(window.Package){
|
2
|
+
(function (window) {
|
3
|
+
if (window.Package) {
|
4
4
|
Materialize = {};
|
5
5
|
} else {
|
6
6
|
window.Materialize = {};
|
7
7
|
}
|
8
8
|
})(window);
|
9
9
|
|
10
|
-
|
11
10
|
/*
|
12
11
|
* raf.js
|
13
12
|
* https://github.com/ngryman/raf.js
|
@@ -18,12 +17,12 @@
|
|
18
17
|
* Copyright (c) 2013 ngryman
|
19
18
|
* Licensed under the MIT license.
|
20
19
|
*/
|
21
|
-
(function(window) {
|
20
|
+
(function (window) {
|
22
21
|
var lastTime = 0,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
vendors = ['webkit', 'moz'],
|
23
|
+
requestAnimationFrame = window.requestAnimationFrame,
|
24
|
+
cancelAnimationFrame = window.cancelAnimationFrame,
|
25
|
+
i = vendors.length;
|
27
26
|
|
28
27
|
// try to un-prefix existing raf
|
29
28
|
while (--i >= 0 && !requestAnimationFrame) {
|
@@ -34,10 +33,10 @@
|
|
34
33
|
// polyfill with setTimeout fallback
|
35
34
|
// heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
|
36
35
|
if (!requestAnimationFrame || !cancelAnimationFrame) {
|
37
|
-
requestAnimationFrame = function(callback) {
|
36
|
+
requestAnimationFrame = function (callback) {
|
38
37
|
var now = +Date.now(),
|
39
|
-
|
40
|
-
return setTimeout(function() {
|
38
|
+
nextTime = Math.max(lastTime + 16, now);
|
39
|
+
return setTimeout(function () {
|
41
40
|
callback(lastTime = nextTime);
|
42
41
|
}, nextTime - now);
|
43
42
|
};
|
@@ -48,68 +47,61 @@
|
|
48
47
|
// export to window
|
49
48
|
window.requestAnimationFrame = requestAnimationFrame;
|
50
49
|
window.cancelAnimationFrame = cancelAnimationFrame;
|
51
|
-
}(window)
|
52
|
-
|
50
|
+
})(window);
|
53
51
|
|
54
52
|
/**
|
55
53
|
* Generate approximated selector string for a jQuery object
|
56
54
|
* @param {jQuery} obj jQuery object to be parsed
|
57
55
|
* @returns {string}
|
58
56
|
*/
|
59
|
-
Materialize.objectSelectorString = function(obj) {
|
57
|
+
Materialize.objectSelectorString = function (obj) {
|
60
58
|
var tagStr = obj.prop('tagName') || '';
|
61
59
|
var idStr = obj.attr('id') || '';
|
62
60
|
var classStr = obj.attr('class') || '';
|
63
|
-
return (tagStr + idStr + classStr).replace(/\s/g,'');
|
61
|
+
return (tagStr + idStr + classStr).replace(/\s/g, '');
|
64
62
|
};
|
65
63
|
|
66
|
-
|
67
64
|
// Unique Random ID
|
68
|
-
Materialize.guid =
|
65
|
+
Materialize.guid = function () {
|
69
66
|
function s4() {
|
70
|
-
return Math.floor((1 + Math.random()) * 0x10000)
|
71
|
-
.toString(16)
|
72
|
-
.substring(1);
|
67
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
73
68
|
}
|
74
|
-
return function() {
|
75
|
-
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
76
|
-
s4() + '-' + s4() + s4() + s4();
|
69
|
+
return function () {
|
70
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
77
71
|
};
|
78
|
-
}
|
72
|
+
}();
|
79
73
|
|
80
74
|
/**
|
81
75
|
* Escapes hash from special characters
|
82
76
|
* @param {string} hash String returned from this.hash
|
83
77
|
* @returns {string}
|
84
78
|
*/
|
85
|
-
Materialize.escapeHash = function(hash) {
|
86
|
-
return hash.replace(
|
79
|
+
Materialize.escapeHash = function (hash) {
|
80
|
+
return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
|
87
81
|
};
|
88
82
|
|
89
|
-
Materialize.elementOrParentIsFixed = function(element) {
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
83
|
+
Materialize.elementOrParentIsFixed = function (element) {
|
84
|
+
var $element = $(element);
|
85
|
+
var $checkElements = $element.add($element.parents());
|
86
|
+
var isFixed = false;
|
87
|
+
$checkElements.each(function () {
|
88
|
+
if ($(this).css("position") === "fixed") {
|
89
|
+
isFixed = true;
|
90
|
+
return false;
|
91
|
+
}
|
92
|
+
});
|
93
|
+
return isFixed;
|
100
94
|
};
|
101
95
|
|
102
|
-
|
103
96
|
/**
|
104
97
|
* Get time in ms
|
105
98
|
* @license https://raw.github.com/jashkenas/underscore/master/LICENSE
|
106
99
|
* @type {function}
|
107
100
|
* @return {number}
|
108
101
|
*/
|
109
|
-
var getTime =
|
102
|
+
var getTime = Date.now || function () {
|
110
103
|
return new Date().getTime();
|
111
|
-
}
|
112
|
-
|
104
|
+
};
|
113
105
|
|
114
106
|
/**
|
115
107
|
* Returns a function, that, when invoked, will only be triggered at most once
|
@@ -123,7 +115,7 @@ var getTime = (Date.now || function () {
|
|
123
115
|
* @param {Object=} options
|
124
116
|
* @returns {Function}
|
125
117
|
*/
|
126
|
-
Materialize.throttle = function(func, wait, options) {
|
118
|
+
Materialize.throttle = function (func, wait, options) {
|
127
119
|
var context, args, result;
|
128
120
|
var timeout = null;
|
129
121
|
var previous = 0;
|
@@ -153,7 +145,6 @@ Materialize.throttle = function(func, wait, options) {
|
|
153
145
|
};
|
154
146
|
};
|
155
147
|
|
156
|
-
|
157
148
|
// Velocity has conflicts when loaded with jQuery, this will check for it
|
158
149
|
// First, check if in noConflict mode
|
159
150
|
var Vel;
|
@@ -1 +1,424 @@
|
|
1
|
-
!function(a,b,c,d){"use strict";function k(a,b,c){return setTimeout(q(a,c),b)}function l(a,b,c){return Array.isArray(a)?(m(a,c[b],c),!0):!1}function m(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function n(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a}function o(a,b){return n(a,b,!0)}function p(a,b,c){var e,d=b.prototype;e=a.prototype=Object.create(d),e.constructor=a,e._super=d,c&&n(e,c)}function q(a,b){return function(){return a.apply(b,arguments)}}function r(a,b){return typeof a==g?a.apply(b?b[0]||d:d,b):a}function s(a,b){return a===d?b:a}function t(a,b,c){m(x(b),function(b){a.addEventListener(b,c,!1)})}function u(a,b,c){m(x(b),function(b){a.removeEventListener(b,c,!1)})}function v(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function w(a,b){return a.indexOf(b)>-1}function x(a){return a.trim().split(/\s+/g)}function y(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function z(a){return Array.prototype.slice.call(a,0)}function A(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];y(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function B(a,b){for(var c,f,g=b[0].toUpperCase()+b.slice(1),h=0;h<e.length;){if(c=e[h],f=c?c+g:b,f in a)return f;h++}return d}function D(){return C++}function E(a){var b=a.ownerDocument;return b.defaultView||b.parentWindow}function ab(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){r(a.options.enable,[a])&&c.handler(b)},this.init()}function bb(a){var b,c=a.options.inputClass;return b=c?c:H?wb:I?Eb:G?Gb:rb,new b(a,cb)}function cb(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&O&&0===d-e,g=b&(Q|R)&&0===d-e;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,db(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function db(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=gb(b)),e>1&&!c.firstMultiple?c.firstMultiple=gb(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=hb(d);b.timeStamp=j(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=lb(h,i),b.distance=kb(h,i),eb(c,b),b.offsetDirection=jb(b.deltaX,b.deltaY),b.scale=g?nb(g.pointers,d):1,b.rotation=g?mb(g.pointers,d):0,fb(c,b);var k=a.element;v(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function eb(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(b.eventType===O||f.eventType===Q)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function fb(a,b){var f,g,h,j,c=a.lastInterval||b,e=b.timeStamp-c.timeStamp;if(b.eventType!=R&&(e>N||c.velocity===d)){var k=c.deltaX-b.deltaX,l=c.deltaY-b.deltaY,m=ib(e,k,l);g=m.x,h=m.y,f=i(m.x)>i(m.y)?m.x:m.y,j=jb(k,l),a.lastInterval=b}else f=c.velocity,g=c.velocityX,h=c.velocityY,j=c.direction;b.velocity=f,b.velocityX=g,b.velocityY=h,b.direction=j}function gb(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:h(a.pointers[c].clientX),clientY:h(a.pointers[c].clientY)},c++;return{timeStamp:j(),pointers:b,center:hb(b),deltaX:a.deltaX,deltaY:a.deltaY}}function hb(a){var b=a.length;if(1===b)return{x:h(a[0].clientX),y:h(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:h(c/b),y:h(d/b)}}function ib(a,b,c){return{x:b/a||0,y:c/a||0}}function jb(a,b){return a===b?S:i(a)>=i(b)?a>0?T:U:b>0?V:W}function kb(a,b,c){c||(c=$);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function lb(a,b,c){c||(c=$);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function mb(a,b){return lb(b[1],b[0],_)-lb(a[1],a[0],_)}function nb(a,b){return kb(b[0],b[1],_)/kb(a[0],a[1],_)}function rb(){this.evEl=pb,this.evWin=qb,this.allow=!0,this.pressed=!1,ab.apply(this,arguments)}function wb(){this.evEl=ub,this.evWin=vb,ab.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function Ab(){this.evTarget=yb,this.evWin=zb,this.started=!1,ab.apply(this,arguments)}function Bb(a,b){var c=z(a.touches),d=z(a.changedTouches);return b&(Q|R)&&(c=A(c.concat(d),"identifier",!0)),[c,d]}function Eb(){this.evTarget=Db,this.targetIds={},ab.apply(this,arguments)}function Fb(a,b){var c=z(a.touches),d=this.targetIds;if(b&(O|P)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=z(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return v(a.target,i)}),b===O)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Q|R)&&delete d[g[e].identifier],e++;return h.length?[A(f.concat(h),"identifier",!0),h]:void 0}function Gb(){ab.apply(this,arguments);var a=q(this.handler,this);this.touch=new Eb(this.manager,a),this.mouse=new rb(this.manager,a)}function Pb(a,b){this.manager=a,this.set(b)}function Qb(a){if(w(a,Mb))return Mb;var b=w(a,Nb),c=w(a,Ob);return b&&c?Nb+" "+Ob:b||c?b?Nb:Ob:w(a,Lb)?Lb:Kb}function Yb(a){this.id=D(),this.manager=null,this.options=o(a||{},this.defaults),this.options.enable=s(this.options.enable,!0),this.state=Rb,this.simultaneous={},this.requireFail=[]}function Zb(a){return a&Wb?"cancel":a&Ub?"end":a&Tb?"move":a&Sb?"start":""}function $b(a){return a==W?"down":a==V?"up":a==T?"left":a==U?"right":""}function _b(a,b){var c=b.manager;return c?c.get(a):a}function ac(){Yb.apply(this,arguments)}function bc(){ac.apply(this,arguments),this.pX=null,this.pY=null}function cc(){ac.apply(this,arguments)}function dc(){Yb.apply(this,arguments),this._timer=null,this._input=null}function ec(){ac.apply(this,arguments)}function fc(){ac.apply(this,arguments)}function gc(){Yb.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function hc(a,b){return b=b||{},b.recognizers=s(b.recognizers,hc.defaults.preset),new kc(a,b)}function kc(a,b){b=b||{},this.options=o(b,hc.defaults),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.element=a,this.input=bb(this),this.touchAction=new Pb(this,this.options.touchAction),lc(this,!0),m(b.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function lc(a,b){var c=a.element;m(a.options.cssProps,function(a,d){c.style[B(c.style,d)]=b?a:""})}function mc(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var e=["","webkit","moz","MS","ms","o"],f=b.createElement("div"),g="function",h=Math.round,i=Math.abs,j=Date.now,C=1,F=/mobile|tablet|ip(ad|hone|od)|android/i,G="ontouchstart"in a,H=B(a,"PointerEvent")!==d,I=G&&F.test(navigator.userAgent),J="touch",K="pen",L="mouse",M="kinect",N=25,O=1,P=2,Q=4,R=8,S=1,T=2,U=4,V=8,W=16,X=T|U,Y=V|W,Z=X|Y,$=["x","y"],_=["clientX","clientY"];ab.prototype={handler:function(){},init:function(){this.evEl&&t(this.element,this.evEl,this.domHandler),this.evTarget&&t(this.target,this.evTarget,this.domHandler),this.evWin&&t(E(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&u(this.element,this.evEl,this.domHandler),this.evTarget&&u(this.target,this.evTarget,this.domHandler),this.evWin&&u(E(this.element),this.evWin,this.domHandler)}};var ob={mousedown:O,mousemove:P,mouseup:Q},pb="mousedown",qb="mousemove mouseup";p(rb,ab,{handler:function(a){var b=ob[a.type];b&O&&0===a.button&&(this.pressed=!0),b&P&&1!==a.which&&(b=Q),this.pressed&&this.allow&&(b&Q&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:L,srcEvent:a}))}});var sb={pointerdown:O,pointermove:P,pointerup:Q,pointercancel:R,pointerout:R},tb={2:J,3:K,4:L,5:M},ub="pointerdown",vb="pointermove pointerup pointercancel";a.MSPointerEvent&&(ub="MSPointerDown",vb="MSPointerMove MSPointerUp MSPointerCancel"),p(wb,ab,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=sb[d],f=tb[a.pointerType]||a.pointerType,g=f==J,h=y(b,a.pointerId,"pointerId");e&O&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Q|R)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var xb={touchstart:O,touchmove:P,touchend:Q,touchcancel:R},yb="touchstart",zb="touchstart touchmove touchend touchcancel";p(Ab,ab,{handler:function(a){var b=xb[a.type];if(b===O&&(this.started=!0),this.started){var c=Bb.call(this,a,b);b&(Q|R)&&0===c[0].length-c[1].length&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:J,srcEvent:a})}}});var Cb={touchstart:O,touchmove:P,touchend:Q,touchcancel:R},Db="touchstart touchmove touchend touchcancel";p(Eb,ab,{handler:function(a){var b=Cb[a.type],c=Fb.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:J,srcEvent:a})}}),p(Gb,ab,{handler:function(a,b,c){var d=c.pointerType==J,e=c.pointerType==L;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(Q|R)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Hb=B(f.style,"touchAction"),Ib=Hb!==d,Jb="compute",Kb="auto",Lb="manipulation",Mb="none",Nb="pan-x",Ob="pan-y";Pb.prototype={set:function(a){a==Jb&&(a=this.compute()),Ib&&(this.manager.element.style[Hb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return m(this.manager.recognizers,function(b){r(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),Qb(a.join(" "))},preventDefaults:function(a){if(!Ib){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return b.preventDefault(),void 0;var d=this.actions,e=w(d,Mb),f=w(d,Ob),g=w(d,Nb);return e||f&&c&X||g&&c&Y?this.preventSrc(b):void 0}},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var Rb=1,Sb=2,Tb=4,Ub=8,Vb=Ub,Wb=16,Xb=32;Yb.prototype={defaults:{},set:function(a){return n(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(l(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_b(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return l(a,"dropRecognizeWith",this)?this:(a=_b(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(l(a,"requireFailure",this))return this;var b=this.requireFail;return a=_b(a,this),-1===y(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(l(a,"dropRequireFailure",this))return this;a=_b(a,this);var b=y(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function d(d){b.manager.emit(b.options.event+(d?Zb(c):""),a)}var b=this,c=this.state;Ub>c&&d(!0),d(),c>=Ub&&d(!0)},tryEmit:function(a){return this.canEmit()?this.emit(a):(this.state=Xb,void 0)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(Xb|Rb)))return!1;a++}return!0},recognize:function(a){var b=n({},a);return r(this.options.enable,[this,b])?(this.state&(Vb|Wb|Xb)&&(this.state=Rb),this.state=this.process(b),this.state&(Sb|Tb|Ub|Wb)&&this.tryEmit(b),void 0):(this.reset(),this.state=Xb,void 0)},process:function(){},getTouchAction:function(){},reset:function(){}},p(ac,Yb,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(Sb|Tb),e=this.attrTest(a);return d&&(c&R||!e)?b|Wb:d||e?c&Q?b|Ub:b&Sb?b|Tb:Sb:Xb}}),p(bc,ac,{defaults:{event:"pan",threshold:10,pointers:1,direction:Z},getTouchAction:function(){var a=this.options.direction,b=[];return a&X&&b.push(Ob),a&Y&&b.push(Nb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&X?(e=0===f?S:0>f?T:U,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?S:0>g?V:W,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return ac.prototype.attrTest.call(this,a)&&(this.state&Sb||!(this.state&Sb)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$b(a.direction);b&&this.manager.emit(this.options.event+b,a),this._super.emit.call(this,a)}}),p(cc,ac,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Mb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&Sb)},emit:function(a){if(this._super.emit.call(this,a),1!==a.scale){var b=a.scale<1?"in":"out";this.manager.emit(this.options.event+b,a)}}}),p(dc,Yb,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[Kb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,e=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Q|R)&&!e)this.reset();else if(a.eventType&O)this.reset(),this._timer=k(function(){this.state=Vb,this.tryEmit()},b.time,this);else if(a.eventType&Q)return Vb;return Xb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===Vb&&(a&&a.eventType&Q?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=j(),this.manager.emit(this.options.event,this._input)))}}),p(ec,ac,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Mb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&Sb)}}),p(fc,ac,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:X|Y,pointers:1},getTouchAction:function(){return bc.prototype.getTouchAction.call(this)},attrTest:function(a){var c,b=this.options.direction;return b&(X|Y)?c=a.velocity:b&X?c=a.velocityX:b&Y&&(c=a.velocityY),this._super.attrTest.call(this,a)&&b&a.direction&&a.distance>this.options.threshold&&i(c)>this.options.velocity&&a.eventType&Q},emit:function(a){var b=$b(a.direction);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),p(gc,Yb,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[Lb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,e=a.deltaTime<b.time;if(this.reset(),a.eventType&O&&0===this.count)return this.failTimeout();if(d&&e&&c){if(a.eventType!=Q)return this.failTimeout();var f=this.pTime?a.timeStamp-this.pTime<b.interval:!0,g=!this.pCenter||kb(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,g&&f?this.count+=1:this.count=1,this._input=a;var h=this.count%b.taps;if(0===h)return this.hasRequireFailures()?(this._timer=k(function(){this.state=Vb,this.tryEmit()},b.interval,this),Sb):Vb}return Xb},failTimeout:function(){return this._timer=k(function(){this.state=Xb},this.options.interval,this),Xb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Vb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),hc.VERSION="2.0.4",hc.defaults={domEvents:!1,touchAction:Jb,enable:!0,inputTarget:null,inputClass:null,preset:[[ec,{enable:!1}],[cc,{enable:!1},["rotate"]],[fc,{direction:X}],[bc,{direction:X},["swipe"]],[gc],[gc,{event:"doubletap",taps:2},["tap"]],[dc]],cssProps:{userSelect:"default",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ic=1,jc=2;kc.prototype={set:function(a){return n(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?jc:ic},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&Vb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===jc||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(Sb|Tb|Ub)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Yb)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(l(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(l(a,"remove",this))return this;var b=this.recognizers;return a=this.get(a),b.splice(y(b,a),1),this.touchAction.update(),this},on:function(a,b){var c=this.handlers;return m(x(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this},off:function(a,b){var c=this.handlers;return m(x(a),function(a){b?c[a].splice(y(c[a],b),1):delete c[a]}),this},emit:function(a,b){this.options.domEvents&&mc(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&lc(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},n(hc,{INPUT_START:O,INPUT_MOVE:P,INPUT_END:Q,INPUT_CANCEL:R,STATE_POSSIBLE:Rb,STATE_BEGAN:Sb,STATE_CHANGED:Tb,STATE_ENDED:Ub,STATE_RECOGNIZED:Vb,STATE_CANCELLED:Wb,STATE_FAILED:Xb,DIRECTION_NONE:S,DIRECTION_LEFT:T,DIRECTION_RIGHT:U,DIRECTION_UP:V,DIRECTION_DOWN:W,DIRECTION_HORIZONTAL:X,DIRECTION_VERTICAL:Y,DIRECTION_ALL:Z,Manager:kc,Input:ab,TouchAction:Pb,TouchInput:Eb,MouseInput:rb,PointerEventInput:wb,TouchMouseInput:Gb,SingleTouchInput:Ab,Recognizer:Yb,AttrRecognizer:ac,Tap:gc,Pan:bc,Swipe:fc,Pinch:cc,Rotate:ec,Press:dc,on:t,off:u,each:m,merge:o,extend:n,inherit:p,bindFn:q,prefixed:B}),typeof define==g&&define.amd?define(function(){return hc}):"undefined"!=typeof module&&module.exports?module.exports=hc:a[c]=hc}(window,document,"Hammer");
|
1
|
+
!function (a, b, c, d) {
|
2
|
+
"use strict";
|
3
|
+
function k(a, b, c) {
|
4
|
+
return setTimeout(q(a, c), b);
|
5
|
+
}function l(a, b, c) {
|
6
|
+
return Array.isArray(a) ? (m(a, c[b], c), !0) : !1;
|
7
|
+
}function m(a, b, c) {
|
8
|
+
var e;if (a) if (a.forEach) a.forEach(b, c);else if (a.length !== d) for (e = 0; e < a.length;) {
|
9
|
+
b.call(c, a[e], e, a), e++;
|
10
|
+
} else for (e in a) {
|
11
|
+
a.hasOwnProperty(e) && b.call(c, a[e], e, a);
|
12
|
+
}
|
13
|
+
}function n(a, b, c) {
|
14
|
+
for (var e = Object.keys(b), f = 0; f < e.length;) {
|
15
|
+
(!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++;
|
16
|
+
}return a;
|
17
|
+
}function o(a, b) {
|
18
|
+
return n(a, b, !0);
|
19
|
+
}function p(a, b, c) {
|
20
|
+
var e,
|
21
|
+
d = b.prototype;e = a.prototype = Object.create(d), e.constructor = a, e._super = d, c && n(e, c);
|
22
|
+
}function q(a, b) {
|
23
|
+
return function () {
|
24
|
+
return a.apply(b, arguments);
|
25
|
+
};
|
26
|
+
}function r(a, b) {
|
27
|
+
return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a;
|
28
|
+
}function s(a, b) {
|
29
|
+
return a === d ? b : a;
|
30
|
+
}function t(a, b, c) {
|
31
|
+
m(x(b), function (b) {
|
32
|
+
a.addEventListener(b, c, !1);
|
33
|
+
});
|
34
|
+
}function u(a, b, c) {
|
35
|
+
m(x(b), function (b) {
|
36
|
+
a.removeEventListener(b, c, !1);
|
37
|
+
});
|
38
|
+
}function v(a, b) {
|
39
|
+
for (; a;) {
|
40
|
+
if (a == b) return !0;a = a.parentNode;
|
41
|
+
}return !1;
|
42
|
+
}function w(a, b) {
|
43
|
+
return a.indexOf(b) > -1;
|
44
|
+
}function x(a) {
|
45
|
+
return a.trim().split(/\s+/g);
|
46
|
+
}function y(a, b, c) {
|
47
|
+
if (a.indexOf && !c) return a.indexOf(b);for (var d = 0; d < a.length;) {
|
48
|
+
if (c && a[d][c] == b || !c && a[d] === b) return d;d++;
|
49
|
+
}return -1;
|
50
|
+
}function z(a) {
|
51
|
+
return Array.prototype.slice.call(a, 0);
|
52
|
+
}function A(a, b, c) {
|
53
|
+
for (var d = [], e = [], f = 0; f < a.length;) {
|
54
|
+
var g = b ? a[f][b] : a[f];y(e, g) < 0 && d.push(a[f]), e[f] = g, f++;
|
55
|
+
}return c && (d = b ? d.sort(function (a, c) {
|
56
|
+
return a[b] > c[b];
|
57
|
+
}) : d.sort()), d;
|
58
|
+
}function B(a, b) {
|
59
|
+
for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
|
60
|
+
if (c = e[h], f = c ? c + g : b, f in a) return f;h++;
|
61
|
+
}return d;
|
62
|
+
}function D() {
|
63
|
+
return C++;
|
64
|
+
}function E(a) {
|
65
|
+
var b = a.ownerDocument;return b.defaultView || b.parentWindow;
|
66
|
+
}function ab(a, b) {
|
67
|
+
var c = this;this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) {
|
68
|
+
r(a.options.enable, [a]) && c.handler(b);
|
69
|
+
}, this.init();
|
70
|
+
}function bb(a) {
|
71
|
+
var b,
|
72
|
+
c = a.options.inputClass;return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb, new b(a, cb);
|
73
|
+
}function cb(a, b, c) {
|
74
|
+
var d = c.pointers.length,
|
75
|
+
e = c.changedPointers.length,
|
76
|
+
f = b & O && 0 === d - e,
|
77
|
+
g = b & (Q | R) && 0 === d - e;c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, db(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c;
|
78
|
+
}function db(a, b) {
|
79
|
+
var c = a.session,
|
80
|
+
d = b.pointers,
|
81
|
+
e = d.length;c.firstInput || (c.firstInput = gb(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1);var f = c.firstInput,
|
82
|
+
g = c.firstMultiple,
|
83
|
+
h = g ? g.center : f.center,
|
84
|
+
i = b.center = hb(d);b.timeStamp = j(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = lb(h, i), b.distance = kb(h, i), eb(c, b), b.offsetDirection = jb(b.deltaX, b.deltaY), b.scale = g ? nb(g.pointers, d) : 1, b.rotation = g ? mb(g.pointers, d) : 0, fb(c, b);var k = a.element;v(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k;
|
85
|
+
}function eb(a, b) {
|
86
|
+
var c = b.center,
|
87
|
+
d = a.offsetDelta || {},
|
88
|
+
e = a.prevDelta || {},
|
89
|
+
f = a.prevInput || {};(b.eventType === O || f.eventType === Q) && (e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }, d = a.offsetDelta = { x: c.x, y: c.y }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y);
|
90
|
+
}function fb(a, b) {
|
91
|
+
var f,
|
92
|
+
g,
|
93
|
+
h,
|
94
|
+
j,
|
95
|
+
c = a.lastInterval || b,
|
96
|
+
e = b.timeStamp - c.timeStamp;if (b.eventType != R && (e > N || c.velocity === d)) {
|
97
|
+
var k = c.deltaX - b.deltaX,
|
98
|
+
l = c.deltaY - b.deltaY,
|
99
|
+
m = ib(e, k, l);g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastInterval = b;
|
100
|
+
} else f = c.velocity, g = c.velocityX, h = c.velocityY, j = c.direction;b.velocity = f, b.velocityX = g, b.velocityY = h, b.direction = j;
|
101
|
+
}function gb(a) {
|
102
|
+
for (var b = [], c = 0; c < a.pointers.length;) {
|
103
|
+
b[c] = { clientX: h(a.pointers[c].clientX), clientY: h(a.pointers[c].clientY) }, c++;
|
104
|
+
}return { timeStamp: j(), pointers: b, center: hb(b), deltaX: a.deltaX, deltaY: a.deltaY };
|
105
|
+
}function hb(a) {
|
106
|
+
var b = a.length;if (1 === b) return { x: h(a[0].clientX), y: h(a[0].clientY) };for (var c = 0, d = 0, e = 0; b > e;) {
|
107
|
+
c += a[e].clientX, d += a[e].clientY, e++;
|
108
|
+
}return { x: h(c / b), y: h(d / b) };
|
109
|
+
}function ib(a, b, c) {
|
110
|
+
return { x: b / a || 0, y: c / a || 0 };
|
111
|
+
}function jb(a, b) {
|
112
|
+
return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
|
113
|
+
}function kb(a, b, c) {
|
114
|
+
c || (c = $);var d = b[c[0]] - a[c[0]],
|
115
|
+
e = b[c[1]] - a[c[1]];return Math.sqrt(d * d + e * e);
|
116
|
+
}function lb(a, b, c) {
|
117
|
+
c || (c = $);var d = b[c[0]] - a[c[0]],
|
118
|
+
e = b[c[1]] - a[c[1]];return 180 * Math.atan2(e, d) / Math.PI;
|
119
|
+
}function mb(a, b) {
|
120
|
+
return lb(b[1], b[0], _) - lb(a[1], a[0], _);
|
121
|
+
}function nb(a, b) {
|
122
|
+
return kb(b[0], b[1], _) / kb(a[0], a[1], _);
|
123
|
+
}function rb() {
|
124
|
+
this.evEl = pb, this.evWin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments);
|
125
|
+
}function wb() {
|
126
|
+
this.evEl = ub, this.evWin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
|
127
|
+
}function Ab() {
|
128
|
+
this.evTarget = yb, this.evWin = zb, this.started = !1, ab.apply(this, arguments);
|
129
|
+
}function Bb(a, b) {
|
130
|
+
var c = z(a.touches),
|
131
|
+
d = z(a.changedTouches);return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)), [c, d];
|
132
|
+
}function Eb() {
|
133
|
+
this.evTarget = Db, this.targetIds = {}, ab.apply(this, arguments);
|
134
|
+
}function Fb(a, b) {
|
135
|
+
var c = z(a.touches),
|
136
|
+
d = this.targetIds;if (b & (O | P) && 1 === c.length) return d[c[0].identifier] = !0, [c, c];var e,
|
137
|
+
f,
|
138
|
+
g = z(a.changedTouches),
|
139
|
+
h = [],
|
140
|
+
i = this.target;if (f = c.filter(function (a) {
|
141
|
+
return v(a.target, i);
|
142
|
+
}), b === O) for (e = 0; e < f.length;) {
|
143
|
+
d[f[e].identifier] = !0, e++;
|
144
|
+
}for (e = 0; e < g.length;) {
|
145
|
+
d[g[e].identifier] && h.push(g[e]), b & (Q | R) && delete d[g[e].identifier], e++;
|
146
|
+
}return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
|
147
|
+
}function Gb() {
|
148
|
+
ab.apply(this, arguments);var a = q(this.handler, this);this.touch = new Eb(this.manager, a), this.mouse = new rb(this.manager, a);
|
149
|
+
}function Pb(a, b) {
|
150
|
+
this.manager = a, this.set(b);
|
151
|
+
}function Qb(a) {
|
152
|
+
if (w(a, Mb)) return Mb;var b = w(a, Nb),
|
153
|
+
c = w(a, Ob);return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
|
154
|
+
}function Yb(a) {
|
155
|
+
this.id = D(), this.manager = null, this.options = o(a || {}, this.defaults), this.options.enable = s(this.options.enable, !0), this.state = Rb, this.simultaneous = {}, this.requireFail = [];
|
156
|
+
}function Zb(a) {
|
157
|
+
return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
|
158
|
+
}function $b(a) {
|
159
|
+
return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
|
160
|
+
}function _b(a, b) {
|
161
|
+
var c = b.manager;return c ? c.get(a) : a;
|
162
|
+
}function ac() {
|
163
|
+
Yb.apply(this, arguments);
|
164
|
+
}function bc() {
|
165
|
+
ac.apply(this, arguments), this.pX = null, this.pY = null;
|
166
|
+
}function cc() {
|
167
|
+
ac.apply(this, arguments);
|
168
|
+
}function dc() {
|
169
|
+
Yb.apply(this, arguments), this._timer = null, this._input = null;
|
170
|
+
}function ec() {
|
171
|
+
ac.apply(this, arguments);
|
172
|
+
}function fc() {
|
173
|
+
ac.apply(this, arguments);
|
174
|
+
}function gc() {
|
175
|
+
Yb.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
|
176
|
+
}function hc(a, b) {
|
177
|
+
return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b);
|
178
|
+
}function kc(a, b) {
|
179
|
+
b = b || {}, this.options = o(b, hc.defaults), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = bb(this), this.touchAction = new Pb(this, this.options.touchAction), lc(this, !0), m(b.recognizers, function (a) {
|
180
|
+
var b = this.add(new a[0](a[1]));a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
|
181
|
+
}, this);
|
182
|
+
}function lc(a, b) {
|
183
|
+
var c = a.element;m(a.options.cssProps, function (a, d) {
|
184
|
+
c.style[B(c.style, d)] = b ? a : "";
|
185
|
+
});
|
186
|
+
}function mc(a, c) {
|
187
|
+
var d = b.createEvent("Event");d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d);
|
188
|
+
}var e = ["", "webkit", "moz", "MS", "ms", "o"],
|
189
|
+
f = b.createElement("div"),
|
190
|
+
g = "function",
|
191
|
+
h = Math.round,
|
192
|
+
i = Math.abs,
|
193
|
+
j = Date.now,
|
194
|
+
C = 1,
|
195
|
+
F = /mobile|tablet|ip(ad|hone|od)|android/i,
|
196
|
+
G = "ontouchstart" in a,
|
197
|
+
H = B(a, "PointerEvent") !== d,
|
198
|
+
I = G && F.test(navigator.userAgent),
|
199
|
+
J = "touch",
|
200
|
+
K = "pen",
|
201
|
+
L = "mouse",
|
202
|
+
M = "kinect",
|
203
|
+
N = 25,
|
204
|
+
O = 1,
|
205
|
+
P = 2,
|
206
|
+
Q = 4,
|
207
|
+
R = 8,
|
208
|
+
S = 1,
|
209
|
+
T = 2,
|
210
|
+
U = 4,
|
211
|
+
V = 8,
|
212
|
+
W = 16,
|
213
|
+
X = T | U,
|
214
|
+
Y = V | W,
|
215
|
+
Z = X | Y,
|
216
|
+
$ = ["x", "y"],
|
217
|
+
_ = ["clientX", "clientY"];ab.prototype = { handler: function () {}, init: function () {
|
218
|
+
this.evEl && t(this.element, this.evEl, this.domHandler), this.evTarget && t(this.target, this.evTarget, this.domHandler), this.evWin && t(E(this.element), this.evWin, this.domHandler);
|
219
|
+
}, destroy: function () {
|
220
|
+
this.evEl && u(this.element, this.evEl, this.domHandler), this.evTarget && u(this.target, this.evTarget, this.domHandler), this.evWin && u(E(this.element), this.evWin, this.domHandler);
|
221
|
+
} };var ob = { mousedown: O, mousemove: P, mouseup: Q },
|
222
|
+
pb = "mousedown",
|
223
|
+
qb = "mousemove mouseup";p(rb, ab, { handler: function (a) {
|
224
|
+
var b = ob[a.type];b & O && 0 === a.button && (this.pressed = !0), b & P && 1 !== a.which && (b = Q), this.pressed && this.allow && (b & Q && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedPointers: [a], pointerType: L, srcEvent: a }));
|
225
|
+
} });var sb = { pointerdown: O, pointermove: P, pointerup: Q, pointercancel: R, pointerout: R },
|
226
|
+
tb = { 2: J, 3: K, 4: L, 5: M },
|
227
|
+
ub = "pointerdown",
|
228
|
+
vb = "pointermove pointerup pointercancel";a.MSPointerEvent && (ub = "MSPointerDown", vb = "MSPointerMove MSPointerUp MSPointerCancel"), p(wb, ab, { handler: function (a) {
|
229
|
+
var b = this.store,
|
230
|
+
c = !1,
|
231
|
+
d = a.type.toLowerCase().replace("ms", ""),
|
232
|
+
e = sb[d],
|
233
|
+
f = tb[a.pointerType] || a.pointerType,
|
234
|
+
g = f == J,
|
235
|
+
h = y(b, a.pointerId, "pointerId");e & O && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Q | R) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedPointers: [a], pointerType: f, srcEvent: a }), c && b.splice(h, 1));
|
236
|
+
} });var xb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
|
237
|
+
yb = "touchstart",
|
238
|
+
zb = "touchstart touchmove touchend touchcancel";p(Ab, ab, { handler: function (a) {
|
239
|
+
var b = xb[a.type];if (b === O && (this.started = !0), this.started) {
|
240
|
+
var c = Bb.call(this, a, b);b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
|
241
|
+
}
|
242
|
+
} });var Cb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
|
243
|
+
Db = "touchstart touchmove touchend touchcancel";p(Eb, ab, { handler: function (a) {
|
244
|
+
var b = Cb[a.type],
|
245
|
+
c = Fb.call(this, a, b);c && this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
|
246
|
+
} }), p(Gb, ab, { handler: function (a, b, c) {
|
247
|
+
var d = c.pointerType == J,
|
248
|
+
e = c.pointerType == L;if (d) this.mouse.allow = !1;else if (e && !this.mouse.allow) return;b & (Q | R) && (this.mouse.allow = !0), this.callback(a, b, c);
|
249
|
+
}, destroy: function () {
|
250
|
+
this.touch.destroy(), this.mouse.destroy();
|
251
|
+
} });var Hb = B(f.style, "touchAction"),
|
252
|
+
Ib = Hb !== d,
|
253
|
+
Jb = "compute",
|
254
|
+
Kb = "auto",
|
255
|
+
Lb = "manipulation",
|
256
|
+
Mb = "none",
|
257
|
+
Nb = "pan-x",
|
258
|
+
Ob = "pan-y";Pb.prototype = { set: function (a) {
|
259
|
+
a == Jb && (a = this.compute()), Ib && (this.manager.element.style[Hb] = a), this.actions = a.toLowerCase().trim();
|
260
|
+
}, update: function () {
|
261
|
+
this.set(this.manager.options.touchAction);
|
262
|
+
}, compute: function () {
|
263
|
+
var a = [];return m(this.manager.recognizers, function (b) {
|
264
|
+
r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
|
265
|
+
}), Qb(a.join(" "));
|
266
|
+
}, preventDefaults: function (a) {
|
267
|
+
if (!Ib) {
|
268
|
+
var b = a.srcEvent,
|
269
|
+
c = a.offsetDirection;if (this.manager.session.prevented) return b.preventDefault(), void 0;var d = this.actions,
|
270
|
+
e = w(d, Mb),
|
271
|
+
f = w(d, Ob),
|
272
|
+
g = w(d, Nb);return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
|
273
|
+
}
|
274
|
+
}, preventSrc: function (a) {
|
275
|
+
this.manager.session.prevented = !0, a.preventDefault();
|
276
|
+
} };var Rb = 1,
|
277
|
+
Sb = 2,
|
278
|
+
Tb = 4,
|
279
|
+
Ub = 8,
|
280
|
+
Vb = Ub,
|
281
|
+
Wb = 16,
|
282
|
+
Xb = 32;Yb.prototype = { defaults: {}, set: function (a) {
|
283
|
+
return n(this.options, a), this.manager && this.manager.touchAction.update(), this;
|
284
|
+
}, recognizeWith: function (a) {
|
285
|
+
if (l(a, "recognizeWith", this)) return this;var b = this.simultaneous;return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this;
|
286
|
+
}, dropRecognizeWith: function (a) {
|
287
|
+
return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this);
|
288
|
+
}, requireFailure: function (a) {
|
289
|
+
if (l(a, "requireFailure", this)) return this;var b = this.requireFail;return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requireFailure(this)), this;
|
290
|
+
}, dropRequireFailure: function (a) {
|
291
|
+
if (l(a, "dropRequireFailure", this)) return this;a = _b(a, this);var b = y(this.requireFail, a);return b > -1 && this.requireFail.splice(b, 1), this;
|
292
|
+
}, hasRequireFailures: function () {
|
293
|
+
return this.requireFail.length > 0;
|
294
|
+
}, canRecognizeWith: function (a) {
|
295
|
+
return !!this.simultaneous[a.id];
|
296
|
+
}, emit: function (a) {
|
297
|
+
function d(d) {
|
298
|
+
b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
|
299
|
+
}var b = this,
|
300
|
+
c = this.state;Ub > c && d(!0), d(), c >= Ub && d(!0);
|
301
|
+
}, tryEmit: function (a) {
|
302
|
+
return this.canEmit() ? this.emit(a) : (this.state = Xb, void 0);
|
303
|
+
}, canEmit: function () {
|
304
|
+
for (var a = 0; a < this.requireFail.length;) {
|
305
|
+
if (!(this.requireFail[a].state & (Xb | Rb))) return !1;a++;
|
306
|
+
}return !0;
|
307
|
+
}, recognize: function (a) {
|
308
|
+
var b = n({}, a);return r(this.options.enable, [this, b]) ? (this.state & (Vb | Wb | Xb) && (this.state = Rb), this.state = this.process(b), this.state & (Sb | Tb | Ub | Wb) && this.tryEmit(b), void 0) : (this.reset(), this.state = Xb, void 0);
|
309
|
+
}, process: function () {}, getTouchAction: function () {}, reset: function () {} }, p(ac, Yb, { defaults: { pointers: 1 }, attrTest: function (a) {
|
310
|
+
var b = this.options.pointers;return 0 === b || a.pointers.length === b;
|
311
|
+
}, process: function (a) {
|
312
|
+
var b = this.state,
|
313
|
+
c = a.eventType,
|
314
|
+
d = b & (Sb | Tb),
|
315
|
+
e = this.attrTest(a);return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
|
316
|
+
} }), p(bc, ac, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: Z }, getTouchAction: function () {
|
317
|
+
var a = this.options.direction,
|
318
|
+
b = [];return a & X && b.push(Ob), a & Y && b.push(Nb), b;
|
319
|
+
}, directionTest: function (a) {
|
320
|
+
var b = this.options,
|
321
|
+
c = !0,
|
322
|
+
d = a.distance,
|
323
|
+
e = a.direction,
|
324
|
+
f = a.deltaX,
|
325
|
+
g = a.deltaY;return e & b.direction || (b.direction & X ? (e = 0 === f ? S : 0 > f ? T : U, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? S : 0 > g ? V : W, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction;
|
326
|
+
}, attrTest: function (a) {
|
327
|
+
return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
|
328
|
+
}, emit: function (a) {
|
329
|
+
this.pX = a.deltaX, this.pY = a.deltaY;var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a);
|
330
|
+
} }), p(cc, ac, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function () {
|
331
|
+
return [Mb];
|
332
|
+
}, attrTest: function (a) {
|
333
|
+
return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
|
334
|
+
}, emit: function (a) {
|
335
|
+
if (this._super.emit.call(this, a), 1 !== a.scale) {
|
336
|
+
var b = a.scale < 1 ? "in" : "out";this.manager.emit(this.options.event + b, a);
|
337
|
+
}
|
338
|
+
} }), p(dc, Yb, { defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, getTouchAction: function () {
|
339
|
+
return [Kb];
|
340
|
+
}, process: function (a) {
|
341
|
+
var b = this.options,
|
342
|
+
c = a.pointers.length === b.pointers,
|
343
|
+
d = a.distance < b.threshold,
|
344
|
+
e = a.deltaTime > b.time;if (this._input = a, !d || !c || a.eventType & (Q | R) && !e) this.reset();else if (a.eventType & O) this.reset(), this._timer = k(function () {
|
345
|
+
this.state = Vb, this.tryEmit();
|
346
|
+
}, b.time, this);else if (a.eventType & Q) return Vb;return Xb;
|
347
|
+
}, reset: function () {
|
348
|
+
clearTimeout(this._timer);
|
349
|
+
}, emit: function (a) {
|
350
|
+
this.state === Vb && (a && a.eventType & Q ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = j(), this.manager.emit(this.options.event, this._input)));
|
351
|
+
} }), p(ec, ac, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function () {
|
352
|
+
return [Mb];
|
353
|
+
}, attrTest: function (a) {
|
354
|
+
return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
|
355
|
+
} }), p(fc, ac, { defaults: { event: "swipe", threshold: 10, velocity: .65, direction: X | Y, pointers: 1 }, getTouchAction: function () {
|
356
|
+
return bc.prototype.getTouchAction.call(this);
|
357
|
+
}, attrTest: function (a) {
|
358
|
+
var c,
|
359
|
+
b = this.options.direction;return b & (X | Y) ? c = a.velocity : b & X ? c = a.velocityX : b & Y && (c = a.velocityY), this._super.attrTest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventType & Q;
|
360
|
+
}, emit: function (a) {
|
361
|
+
var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a);
|
362
|
+
} }), p(gc, Yb, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posThreshold: 10 }, getTouchAction: function () {
|
363
|
+
return [Lb];
|
364
|
+
}, process: function (a) {
|
365
|
+
var b = this.options,
|
366
|
+
c = a.pointers.length === b.pointers,
|
367
|
+
d = a.distance < b.threshold,
|
368
|
+
e = a.deltaTime < b.time;if (this.reset(), a.eventType & O && 0 === this.count) return this.failTimeout();if (d && e && c) {
|
369
|
+
if (a.eventType != Q) return this.failTimeout();var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
|
370
|
+
g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold;this.pTime = a.timeStamp, this.pCenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a;var h = this.count % b.taps;if (0 === h) return this.hasRequireFailures() ? (this._timer = k(function () {
|
371
|
+
this.state = Vb, this.tryEmit();
|
372
|
+
}, b.interval, this), Sb) : Vb;
|
373
|
+
}return Xb;
|
374
|
+
}, failTimeout: function () {
|
375
|
+
return this._timer = k(function () {
|
376
|
+
this.state = Xb;
|
377
|
+
}, this.options.interval, this), Xb;
|
378
|
+
}, reset: function () {
|
379
|
+
clearTimeout(this._timer);
|
380
|
+
}, emit: function () {
|
381
|
+
this.state == Vb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
|
382
|
+
} }), hc.VERSION = "2.0.4", hc.defaults = { domEvents: !1, touchAction: Jb, enable: !0, inputTarget: null, inputClass: null, preset: [[ec, { enable: !1 }], [cc, { enable: !1 }, ["rotate"]], [fc, { direction: X }], [bc, { direction: X }, ["swipe"]], [gc], [gc, { event: "doubletap", taps: 2 }, ["tap"]], [dc]], cssProps: { userSelect: "default", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } };var ic = 1,
|
383
|
+
jc = 2;kc.prototype = { set: function (a) {
|
384
|
+
return n(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
|
385
|
+
}, stop: function (a) {
|
386
|
+
this.session.stopped = a ? jc : ic;
|
387
|
+
}, recognize: function (a) {
|
388
|
+
var b = this.session;if (!b.stopped) {
|
389
|
+
this.touchAction.preventDefaults(a);var c,
|
390
|
+
d = this.recognizers,
|
391
|
+
e = b.curRecognizer;(!e || e && e.state & Vb) && (e = b.curRecognizer = null);for (var f = 0; f < d.length;) {
|
392
|
+
c = d[f], b.stopped === jc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (Sb | Tb | Ub) && (e = b.curRecognizer = c), f++;
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}, get: function (a) {
|
396
|
+
if (a instanceof Yb) return a;for (var b = this.recognizers, c = 0; c < b.length; c++) {
|
397
|
+
if (b[c].options.event == a) return b[c];
|
398
|
+
}return null;
|
399
|
+
}, add: function (a) {
|
400
|
+
if (l(a, "add", this)) return this;var b = this.get(a.options.event);return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
|
401
|
+
}, remove: function (a) {
|
402
|
+
if (l(a, "remove", this)) return this;var b = this.recognizers;return a = this.get(a), b.splice(y(b, a), 1), this.touchAction.update(), this;
|
403
|
+
}, on: function (a, b) {
|
404
|
+
var c = this.handlers;return m(x(a), function (a) {
|
405
|
+
c[a] = c[a] || [], c[a].push(b);
|
406
|
+
}), this;
|
407
|
+
}, off: function (a, b) {
|
408
|
+
var c = this.handlers;return m(x(a), function (a) {
|
409
|
+
b ? c[a].splice(y(c[a], b), 1) : delete c[a];
|
410
|
+
}), this;
|
411
|
+
}, emit: function (a, b) {
|
412
|
+
this.options.domEvents && mc(a, b);var c = this.handlers[a] && this.handlers[a].slice();if (c && c.length) {
|
413
|
+
b.type = a, b.preventDefault = function () {
|
414
|
+
b.srcEvent.preventDefault();
|
415
|
+
};for (var d = 0; d < c.length;) {
|
416
|
+
c[d](b), d++;
|
417
|
+
}
|
418
|
+
}
|
419
|
+
}, destroy: function () {
|
420
|
+
this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
|
421
|
+
} }, n(hc, { INPUT_START: O, INPUT_MOVE: P, INPUT_END: Q, INPUT_CANCEL: R, STATE_POSSIBLE: Rb, STATE_BEGAN: Sb, STATE_CHANGED: Tb, STATE_ENDED: Ub, STATE_RECOGNIZED: Vb, STATE_CANCELLED: Wb, STATE_FAILED: Xb, DIRECTION_NONE: S, DIRECTION_LEFT: T, DIRECTION_RIGHT: U, DIRECTION_UP: V, DIRECTION_DOWN: W, DIRECTION_HORIZONTAL: X, DIRECTION_VERTICAL: Y, DIRECTION_ALL: Z, Manager: kc, Input: ab, TouchAction: Pb, TouchInput: Eb, MouseInput: rb, PointerEventInput: wb, TouchMouseInput: Gb, SingleTouchInput: Ab, Recognizer: Yb, AttrRecognizer: ac, Tap: gc, Pan: bc, Swipe: fc, Pinch: cc, Rotate: ec, Press: dc, on: t, off: u, each: m, merge: o, extend: n, inherit: p, bindFn: q, prefixed: B }), typeof define == g && define.amd ? define(function () {
|
422
|
+
return hc;
|
423
|
+
}) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
|
424
|
+
}(window, document, "Hammer");
|