uikit-sass-rails 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +15 -12
  4. data/lib/uikit/sass/rails/engine.rb +1 -1
  5. data/lib/uikit/sass/rails/version.rb +1 -1
  6. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
  8. data/vendor/assets/fonts/fontawesome-webfont.svg +525 -464
  9. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  10. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  11. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  12. data/vendor/assets/javascripts/uikit.js +30 -3
  13. data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
  14. data/vendor/assets/javascripts/uikit/components/autocomplete.js +48 -27
  15. data/vendor/assets/javascripts/uikit/components/datepicker.js +2887 -97
  16. data/vendor/assets/javascripts/uikit/components/form-password.js +24 -19
  17. data/vendor/assets/javascripts/uikit/components/form-select.js +24 -18
  18. data/vendor/assets/javascripts/uikit/components/grid.js +524 -0
  19. data/vendor/assets/javascripts/uikit/components/htmleditor.js +46 -39
  20. data/vendor/assets/javascripts/uikit/components/lightbox.js +543 -0
  21. data/vendor/assets/javascripts/uikit/components/nestable.js +125 -98
  22. data/vendor/assets/javascripts/uikit/components/notify.js +34 -22
  23. data/vendor/assets/javascripts/uikit/components/pagination.js +24 -21
  24. data/vendor/assets/javascripts/uikit/components/parallax.js +400 -0
  25. data/vendor/assets/javascripts/uikit/components/search.js +19 -16
  26. data/vendor/assets/javascripts/uikit/components/slider.js +482 -0
  27. data/vendor/assets/javascripts/uikit/components/slideset.js +498 -0
  28. data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +377 -0
  29. data/vendor/assets/javascripts/uikit/components/slideshow.js +540 -0
  30. data/vendor/assets/javascripts/uikit/components/sortable.js +392 -263
  31. data/vendor/assets/javascripts/uikit/components/sticky.js +127 -68
  32. data/vendor/assets/javascripts/uikit/components/timepicker.js +65 -42
  33. data/vendor/assets/javascripts/uikit/components/tooltip.js +220 -0
  34. data/vendor/assets/javascripts/uikit/components/upload.js +11 -10
  35. data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
  36. data/vendor/assets/javascripts/uikit/core/button.js +154 -0
  37. data/vendor/assets/javascripts/uikit/core/core.js +717 -0
  38. data/vendor/assets/javascripts/uikit/{components → core}/cover.js +41 -35
  39. data/vendor/assets/javascripts/uikit/core/dropdown.js +296 -0
  40. data/vendor/assets/javascripts/uikit/core/grid.js +172 -0
  41. data/vendor/assets/javascripts/uikit/core/modal.js +323 -0
  42. data/vendor/assets/javascripts/uikit/core/nav.js +117 -0
  43. data/vendor/assets/javascripts/uikit/core/offcanvas.js +178 -0
  44. data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
  45. data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
  46. data/vendor/assets/javascripts/uikit/core/switcher.js +298 -0
  47. data/vendor/assets/javascripts/uikit/core/tab.js +159 -0
  48. data/vendor/assets/javascripts/uikit/core/toggle.js +117 -0
  49. data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
  50. data/vendor/assets/javascripts/uikit/core/utility.js +157 -0
  51. data/vendor/assets/javascripts/uikit/uikit.js +1538 -871
  52. data/vendor/assets/stylesheets/extra/font-awesome.scss +4 -7
  53. data/vendor/assets/stylesheets/uikit.scss +22 -1
  54. data/vendor/assets/stylesheets/uikit/almost-flat.scss +22 -2
  55. data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.scss +45 -0
  56. data/vendor/assets/stylesheets/uikit/components/accordion.gradient.scss +45 -0
  57. data/vendor/assets/stylesheets/uikit/components/accordion.scss +43 -0
  58. data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.scss +62 -0
  59. data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.scss +62 -0
  60. data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +60 -0
  61. data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.scss +148 -0
  62. data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.scss +158 -0
  63. data/vendor/assets/stylesheets/uikit/components/datepicker.scss +142 -0
  64. data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.scss +152 -0
  65. data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.scss +152 -0
  66. data/vendor/assets/stylesheets/uikit/components/dotnav.scss +148 -0
  67. data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.scss +92 -0
  68. data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.scss +92 -0
  69. data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +92 -0
  70. data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.scss +36 -0
  71. data/vendor/assets/stylesheets/uikit/components/form-file.gradient.scss +36 -0
  72. data/vendor/assets/stylesheets/uikit/components/form-file.scss +36 -0
  73. data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.scss +37 -0
  74. data/vendor/assets/stylesheets/uikit/components/form-password.gradient.scss +37 -0
  75. data/vendor/assets/stylesheets/uikit/components/form-password.scss +37 -0
  76. data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.scss +37 -0
  77. data/vendor/assets/stylesheets/uikit/components/form-select.gradient.scss +37 -0
  78. data/vendor/assets/stylesheets/uikit/components/form-select.scss +37 -0
  79. data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.scss +282 -0
  80. data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.scss +290 -0
  81. data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +208 -0
  82. data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.scss +137 -0
  83. data/vendor/assets/stylesheets/uikit/components/nestable.gradient.scss +141 -0
  84. data/vendor/assets/stylesheets/uikit/components/nestable.scss +134 -0
  85. data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.scss +112 -0
  86. data/vendor/assets/stylesheets/uikit/components/notify.gradient.scss +112 -0
  87. data/vendor/assets/stylesheets/uikit/components/notify.scss +106 -0
  88. data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.scss +36 -0
  89. data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.scss +36 -0
  90. data/vendor/assets/stylesheets/uikit/components/placeholder.scss +36 -0
  91. data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.scss +130 -0
  92. data/vendor/assets/stylesheets/uikit/components/progress.gradient.scss +138 -0
  93. data/vendor/assets/stylesheets/uikit/components/progress.scss +118 -0
  94. data/vendor/assets/stylesheets/uikit/components/search.almost-flat.scss +216 -0
  95. data/vendor/assets/stylesheets/uikit/components/search.gradient.scss +216 -0
  96. data/vendor/assets/stylesheets/uikit/components/search.scss +214 -0
  97. data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.scss +110 -0
  98. data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.scss +110 -0
  99. data/vendor/assets/stylesheets/uikit/components/slidenav.scss +110 -0
  100. data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.scss +105 -0
  101. data/vendor/assets/stylesheets/uikit/components/slider.gradient.scss +105 -0
  102. data/vendor/assets/stylesheets/uikit/components/slider.scss +105 -0
  103. data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.scss +166 -0
  104. data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.scss +166 -0
  105. data/vendor/assets/stylesheets/uikit/components/slideshow.scss +166 -0
  106. data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.scss +90 -0
  107. data/vendor/assets/stylesheets/uikit/components/sortable.gradient.scss +90 -0
  108. data/vendor/assets/stylesheets/uikit/components/sortable.scss +90 -0
  109. data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.scss +39 -0
  110. data/vendor/assets/stylesheets/uikit/components/sticky.gradient.scss +39 -0
  111. data/vendor/assets/stylesheets/uikit/components/sticky.scss +39 -0
  112. data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.scss +129 -0
  113. data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.scss +129 -0
  114. data/vendor/assets/stylesheets/uikit/components/tooltip.scss +127 -0
  115. data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.scss +11 -0
  116. data/vendor/assets/stylesheets/uikit/components/upload.gradient.scss +11 -0
  117. data/vendor/assets/stylesheets/uikit/components/upload.scss +11 -0
  118. data/vendor/assets/stylesheets/uikit/gradient.scss +22 -2
  119. data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +1768 -498
  120. data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +1776 -512
  121. data/vendor/assets/stylesheets/uikit/uikit.scss +1722 -462
  122. metadata +92 -7
  123. data/vendor/assets/stylesheets/uikit/components/uikit.components.almost-flat.scss +0 -1586
  124. data/vendor/assets/stylesheets/uikit/components/uikit.components.gradient.scss +0 -1608
  125. data/vendor/assets/stylesheets/uikit/components/uikit.components.scss +0 -1489
@@ -0,0 +1,159 @@
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ (function(UI) {
3
+
4
+ "use strict";
5
+
6
+ UI.component('tab', {
7
+
8
+ defaults: {
9
+ 'target' : '>li:not(.uk-tab-responsive, .uk-disabled)',
10
+ 'connect' : false,
11
+ 'active' : 0,
12
+ 'animation' : false,
13
+ 'duration' : 200
14
+ },
15
+
16
+ boot: function() {
17
+
18
+ // init code
19
+ UI.ready(function(context) {
20
+
21
+ UI.$("[data-uk-tab]", context).each(function() {
22
+
23
+ var tab = UI.$(this);
24
+
25
+ if (!tab.data("tab")) {
26
+ var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
27
+ }
28
+ });
29
+ });
30
+ },
31
+
32
+ init: function() {
33
+
34
+ var $this = this;
35
+
36
+ this.current = false;
37
+
38
+ this.on("click.uikit.tab", this.options.target, function(e) {
39
+
40
+ e.preventDefault();
41
+
42
+ if ($this.switcher && $this.switcher.animating) {
43
+ return;
44
+ }
45
+
46
+ var current = $this.find($this.options.target).not(this);
47
+
48
+ current.removeClass("uk-active").blur();
49
+
50
+ $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
51
+
52
+ $this.current = UI.$(this);
53
+
54
+ // Update ARIA
55
+ if (!$this.options.connect) {
56
+ current.attr('aria-expanded', 'false');
57
+ UI.$(this).attr('aria-expanded', 'true');
58
+ }
59
+ });
60
+
61
+ if (this.options.connect) {
62
+ this.connect = UI.$(this.options.connect);
63
+ }
64
+
65
+ // init responsive tab
66
+ this.responsivetab = UI.$('<li class="uk-tab-responsive uk-active"><a></a></li>').append('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>');
67
+
68
+ this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
69
+ this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
70
+ this.responsivetab.caption = this.responsivetab.find('a:first');
71
+
72
+ if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
73
+
74
+ // handle click
75
+ this.responsivetab.lst.on('click.uikit.tab', 'a', function(e) {
76
+
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+
80
+ var link = UI.$(this);
81
+
82
+ $this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
83
+ });
84
+
85
+ this.on('show.uk.switcher change.uk.tab', function(e, tab) {
86
+ $this.responsivetab.caption.html(tab.text());
87
+ });
88
+
89
+ this.element.append(this.responsivetab);
90
+
91
+ // init UIkit components
92
+ if (this.options.connect) {
93
+ this.switcher = UI.switcher(this.element, {
94
+ "toggle" : ">li:not(.uk-tab-responsive)",
95
+ "connect" : this.options.connect,
96
+ "active" : this.options.active,
97
+ "animation" : this.options.animation,
98
+ "duration" : this.options.duration
99
+ });
100
+ }
101
+
102
+ UI.dropdown(this.responsivetab, {"mode": "click"});
103
+
104
+ // init
105
+ $this.trigger("change.uk.tab", [this.element.find(this.options.target).filter('.uk-active')]);
106
+
107
+ this.check();
108
+
109
+ UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
110
+ if ($this.element.is(":visible")) $this.check();
111
+ }, 100));
112
+
113
+ this.on('display.uk.check', function(){
114
+ if ($this.element.is(":visible")) $this.check();
115
+ });
116
+ },
117
+
118
+ check: function() {
119
+
120
+ var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
121
+
122
+ if (!children.length) return;
123
+
124
+ var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
125
+ doresponsive = false,
126
+ item, link;
127
+
128
+ this.responsivetab.lst.empty();
129
+
130
+ children.each(function(){
131
+
132
+ if (UI.$(this).offset().top > top) {
133
+ doresponsive = true;
134
+ }
135
+ });
136
+
137
+ if (doresponsive) {
138
+
139
+ for (var i = 0; i < children.length; i++) {
140
+
141
+ item = UI.$(children.eq(i));
142
+ link = item.find('a');
143
+
144
+ if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
145
+
146
+ item.addClass('uk-hidden');
147
+
148
+ if (!item.hasClass('uk-disabled')) {
149
+ this.responsivetab.lst.append('<li><a href="'+link.attr('href')+'" data-index="'+i+'">'+link.html()+'</a></li>');
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
156
+ }
157
+ });
158
+
159
+ })(UIkit);
@@ -0,0 +1,117 @@
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ (function(UI){
3
+
4
+ "use strict";
5
+
6
+ var toggles = [];
7
+
8
+ UI.component('toggle', {
9
+
10
+ defaults: {
11
+ target : false,
12
+ cls : 'uk-hidden',
13
+ animation : false,
14
+ duration : 200
15
+ },
16
+
17
+ boot: function(){
18
+
19
+ // init code
20
+ UI.ready(function(context) {
21
+
22
+ UI.$("[data-uk-toggle]", context).each(function() {
23
+ var ele = UI.$(this);
24
+
25
+ if (!ele.data("toggle")) {
26
+ var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
27
+ }
28
+ });
29
+
30
+ setTimeout(function(){
31
+
32
+ toggles.forEach(function(toggle){
33
+ toggle.getToggles();
34
+ });
35
+
36
+ }, 0);
37
+ });
38
+ },
39
+
40
+ init: function() {
41
+
42
+ var $this = this;
43
+
44
+ this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
45
+
46
+ this.getToggles();
47
+
48
+ this.on("click", function(e) {
49
+ if ($this.element.is('a[href="#"]')) e.preventDefault();
50
+ $this.toggle();
51
+ });
52
+
53
+ toggles.push(this);
54
+ },
55
+
56
+ toggle: function() {
57
+
58
+ if(!this.totoggle.length) return;
59
+
60
+ if (this.options.animation && UI.support.animation) {
61
+
62
+ var $this = this, animations = this.options.animation.split(',');
63
+
64
+ if (animations.length == 1) {
65
+ animations[1] = animations[0];
66
+ }
67
+
68
+ animations[0] = animations[0].trim();
69
+ animations[1] = animations[1].trim();
70
+
71
+ this.totoggle.css('animation-duration', this.options.duration+'ms');
72
+
73
+ if (this.totoggle.hasClass(this.options.cls)) {
74
+
75
+ this.totoggle.toggleClass(this.options.cls);
76
+
77
+ this.totoggle.each(function(){
78
+ UI.Utils.animate(this, animations[0]).then(function(){
79
+ UI.$(this).css('animation-duration', '');
80
+ UI.Utils.checkDisplay(this);
81
+ });
82
+ });
83
+
84
+ } else {
85
+
86
+ this.totoggle.each(function(){
87
+ UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
88
+ UI.$(this).toggleClass($this.options.cls).css('animation-duration', '');
89
+ UI.Utils.checkDisplay(this);
90
+ }.bind(this));
91
+ });
92
+ }
93
+
94
+ } else {
95
+ this.totoggle.toggleClass(this.options.cls);
96
+ UI.Utils.checkDisplay(this.totoggle);
97
+ }
98
+
99
+ this.updateAria();
100
+
101
+ },
102
+
103
+ getToggles: function() {
104
+ this.totoggle = this.options.target ? UI.$(this.options.target):[];
105
+ this.updateAria();
106
+ },
107
+
108
+ updateAria: function() {
109
+ if (this.aria && this.totoggle.length) {
110
+ this.totoggle.each(function(){
111
+ UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
112
+ });
113
+ }
114
+ }
115
+ });
116
+
117
+ })(UIkit);
@@ -0,0 +1,173 @@
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ // Based on Zeptos touch.js
3
+ // https://raw.github.com/madrobby/zepto/master/src/touch.js
4
+ // Zepto.js may be freely distributed under the MIT license.
5
+
6
+ ;(function($){
7
+
8
+ if ($.fn.swipeLeft) {
9
+ return;
10
+ }
11
+
12
+
13
+ var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
14
+
15
+ function swipeDirection(x1, x2, y1, y2) {
16
+ return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
17
+ }
18
+
19
+ function longTap() {
20
+ longTapTimeout = null;
21
+ if (touch.last) {
22
+ touch.el.trigger('longTap');
23
+ touch = {};
24
+ }
25
+ }
26
+
27
+ function cancelLongTap() {
28
+ if (longTapTimeout) clearTimeout(longTapTimeout);
29
+ longTapTimeout = null;
30
+ }
31
+
32
+ function cancelAll() {
33
+ if (touchTimeout) clearTimeout(touchTimeout);
34
+ if (tapTimeout) clearTimeout(tapTimeout);
35
+ if (swipeTimeout) clearTimeout(swipeTimeout);
36
+ if (longTapTimeout) clearTimeout(longTapTimeout);
37
+ touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
38
+ touch = {};
39
+ }
40
+
41
+ function isPrimaryTouch(event){
42
+ return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
43
+ }
44
+
45
+ $(function(){
46
+ var now, delta, deltaX = 0, deltaY = 0, firstTouch;
47
+
48
+ if ('MSGesture' in window) {
49
+ gesture = new MSGesture();
50
+ gesture.target = document.body;
51
+ }
52
+
53
+ $(document)
54
+ .on('MSGestureEnd gestureend', function(e){
55
+
56
+ var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
57
+
58
+ if (swipeDirectionFromVelocity) {
59
+ touch.el.trigger('swipe');
60
+ touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
61
+ }
62
+ })
63
+ // MSPointerDown: for IE10
64
+ // pointerdown: for IE11
65
+ .on('touchstart MSPointerDown pointerdown', function(e){
66
+
67
+ if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
68
+
69
+ firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
70
+
71
+ now = Date.now();
72
+ delta = now - (touch.last || now);
73
+ touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
74
+
75
+ if(touchTimeout) clearTimeout(touchTimeout);
76
+
77
+ touch.x1 = firstTouch.pageX;
78
+ touch.y1 = firstTouch.pageY;
79
+
80
+ if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
81
+
82
+ touch.last = now;
83
+ longTapTimeout = setTimeout(longTap, longTapDelay);
84
+
85
+ // adds the current touch contact for IE gesture recognition
86
+ if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
87
+ gesture.addPointer(e.originalEvent.pointerId);
88
+ }
89
+
90
+ })
91
+ // MSPointerMove: for IE10
92
+ // pointermove: for IE11
93
+ .on('touchmove MSPointerMove pointermove', function(e){
94
+
95
+ if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
96
+
97
+ firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
98
+
99
+ cancelLongTap();
100
+ touch.x2 = firstTouch.pageX;
101
+ touch.y2 = firstTouch.pageY;
102
+
103
+ deltaX += Math.abs(touch.x1 - touch.x2);
104
+ deltaY += Math.abs(touch.y1 - touch.y2);
105
+ })
106
+ // MSPointerUp: for IE10
107
+ // pointerup: for IE11
108
+ .on('touchend MSPointerUp pointerup', function(e){
109
+
110
+ if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
111
+
112
+ cancelLongTap();
113
+
114
+ // swipe
115
+ if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
116
+
117
+ swipeTimeout = setTimeout(function() {
118
+ touch.el.trigger('swipe');
119
+ touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
120
+ touch = {};
121
+ }, 0);
122
+
123
+ // normal tap
124
+ } else if ('last' in touch) {
125
+
126
+ // don't fire tap when delta position changed by more than 30 pixels,
127
+ // for instance when moving to a point and back to origin
128
+ if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
129
+ // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
130
+ // ('tap' fires before 'scroll')
131
+ tapTimeout = setTimeout(function() {
132
+
133
+ // trigger universal 'tap' with the option to cancelTouch()
134
+ // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
135
+ var event = $.Event('tap');
136
+ event.cancelTouch = cancelAll;
137
+ touch.el.trigger(event);
138
+
139
+ // trigger double tap immediately
140
+ if (touch.isDoubleTap) {
141
+ touch.el.trigger('doubleTap');
142
+ touch = {};
143
+ }
144
+
145
+ // trigger single tap after 250ms of inactivity
146
+ else {
147
+ touchTimeout = setTimeout(function(){
148
+ touchTimeout = null;
149
+ touch.el.trigger('singleTap');
150
+ touch = {};
151
+ }, 250);
152
+ }
153
+ }, 0);
154
+ } else {
155
+ touch = {};
156
+ }
157
+ deltaX = deltaY = 0;
158
+ }
159
+ })
160
+ // when the browser window loses focus,
161
+ // for example when a modal dialog is shown,
162
+ // cancel all ongoing events
163
+ .on('touchcancel MSPointerCancel', cancelAll);
164
+
165
+ // scrolling the window indicates intention of the user
166
+ // to scroll, not tap or swipe, so cancel all ongoing events
167
+ $(window).on('scroll', cancelAll);
168
+ });
169
+
170
+ ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
171
+ $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
172
+ });
173
+ })(jQuery);