foundation-rails 6.3.1.0 → 6.4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/bower.json +3 -3
  3. data/lib/foundation/rails/version.rb +1 -1
  4. data/lib/generators/foundation/install_generator.rb +1 -1
  5. data/lib/generators/foundation/templates/_settings.scss +291 -48
  6. data/vendor/assets/js/entries/foundation-plugins.js +25 -0
  7. data/vendor/assets/js/entries/foundation.js +101 -0
  8. data/vendor/assets/js/entries/plugins/foundation.abide.js +4 -0
  9. data/vendor/assets/js/entries/plugins/foundation.accordion.js +4 -0
  10. data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +5 -0
  11. data/vendor/assets/js/entries/plugins/foundation.core.js +21 -0
  12. data/vendor/assets/js/entries/plugins/foundation.drilldown.js +4 -0
  13. data/vendor/assets/js/entries/plugins/foundation.dropdown.js +5 -0
  14. data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +4 -0
  15. data/vendor/assets/js/entries/plugins/foundation.equalizer.js +4 -0
  16. data/vendor/assets/js/entries/plugins/foundation.interchange.js +4 -0
  17. data/vendor/assets/js/entries/plugins/foundation.magellan.js +4 -0
  18. data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +4 -0
  19. data/vendor/assets/js/entries/plugins/foundation.orbit.js +5 -0
  20. data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +5 -0
  21. data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +5 -0
  22. data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +5 -0
  23. data/vendor/assets/js/entries/plugins/foundation.reveal.js +4 -0
  24. data/vendor/assets/js/entries/plugins/foundation.slider.js +5 -0
  25. data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +5 -0
  26. data/vendor/assets/js/entries/plugins/foundation.sticky.js +5 -0
  27. data/vendor/assets/js/entries/plugins/foundation.tabs.js +5 -0
  28. data/vendor/assets/js/entries/plugins/foundation.toggler.js +5 -0
  29. data/vendor/assets/js/entries/plugins/foundation.tooltip.js +4 -0
  30. data/vendor/assets/js/entries/plugins/foundation.util.box.js +4 -0
  31. data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +5 -0
  32. data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +4 -0
  33. data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +4 -0
  34. data/vendor/assets/js/entries/plugins/foundation.util.motion.js +5 -0
  35. data/vendor/assets/js/entries/plugins/foundation.util.nest.js +5 -0
  36. data/vendor/assets/js/entries/plugins/foundation.util.timer.js +5 -0
  37. data/vendor/assets/js/entries/plugins/foundation.util.touch.js +7 -0
  38. data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +5 -0
  39. data/vendor/assets/js/foundation.abide.js.es6 +18 -15
  40. data/vendor/assets/js/foundation.accordion.js.es6 +37 -23
  41. data/vendor/assets/js/foundation.accordionMenu.js.es6 +96 -51
  42. data/vendor/assets/js/foundation.core.js.es6 +46 -87
  43. data/vendor/assets/js/foundation.drilldown.js.es6 +47 -29
  44. data/vendor/assets/js/foundation.dropdown.js.es6 +84 -122
  45. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +44 -28
  46. data/vendor/assets/js/foundation.equalizer.js.es6 +18 -17
  47. data/vendor/assets/js/foundation.interchange.js.es6 +26 -19
  48. data/vendor/assets/js/foundation.js.es6 +8 -3
  49. data/vendor/assets/js/foundation.magellan.js.es6 +36 -30
  50. data/vendor/assets/js/foundation.offcanvas.js.es6 +148 -36
  51. data/vendor/assets/js/foundation.orbit.js.es6 +26 -18
  52. data/vendor/assets/js/foundation.plugin.js.es6 +54 -0
  53. data/vendor/assets/js/foundation.positionable.js.es6 +206 -0
  54. data/vendor/assets/js/{foundation.zf.responsiveAccordionTabs.js.es6 → foundation.responsiveAccordionTabs.js.es6} +33 -30
  55. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +37 -29
  56. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +17 -16
  57. data/vendor/assets/js/foundation.reveal.js.es6 +61 -79
  58. data/vendor/assets/js/foundation.slider.js.es6 +33 -18
  59. data/vendor/assets/js/foundation.smoothScroll.js.es6 +135 -0
  60. data/vendor/assets/js/foundation.sticky.js.es6 +25 -17
  61. data/vendor/assets/js/foundation.tabs.js.es6 +35 -27
  62. data/vendor/assets/js/foundation.toggler.js.es6 +15 -13
  63. data/vendor/assets/js/foundation.tooltip.js.es6 +100 -108
  64. data/vendor/assets/js/foundation.util.box.js.es6 +114 -78
  65. data/vendor/assets/js/foundation.util.core.js.es6 +52 -0
  66. data/vendor/assets/js/foundation.util.imageLoader.js.es6 +45 -0
  67. data/vendor/assets/js/foundation.util.keyboard.js.es6 +41 -31
  68. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +59 -55
  69. data/vendor/assets/js/foundation.util.motion.js.es6 +4 -5
  70. data/vendor/assets/js/foundation.util.nest.js.es6 +9 -23
  71. data/vendor/assets/js/{foundation.util.timerAndImageLoader.js.es6 → foundation.util.timer.js.es6} +2 -42
  72. data/vendor/assets/js/foundation.util.touch.js.es6 +91 -294
  73. data/vendor/assets/js/foundation.util.triggers.js.es6 +199 -141
  74. data/vendor/assets/scss/_global.scss +29 -1
  75. data/vendor/assets/scss/components/_accordion-menu.scss +148 -13
  76. data/vendor/assets/scss/components/_accordion.scss +5 -0
  77. data/vendor/assets/scss/components/_breadcrumbs.scss +26 -9
  78. data/vendor/assets/scss/components/_button-group.scss +4 -4
  79. data/vendor/assets/scss/components/_button.scss +59 -12
  80. data/vendor/assets/scss/components/_card.scss +10 -2
  81. data/vendor/assets/scss/components/_drilldown.scss +90 -41
  82. data/vendor/assets/scss/components/_dropdown-menu.scss +52 -6
  83. data/vendor/assets/scss/components/_dropdown.scss +8 -1
  84. data/vendor/assets/scss/components/_flex.scss +85 -2
  85. data/vendor/assets/scss/components/_menu.scss +267 -162
  86. data/vendor/assets/scss/components/_off-canvas.scss +159 -45
  87. data/vendor/assets/scss/components/_pagination.scss +1 -1
  88. data/vendor/assets/scss/components/_reveal.scss +13 -11
  89. data/vendor/assets/scss/components/_slider.scss +0 -1
  90. data/vendor/assets/scss/components/_sticky.scss +1 -0
  91. data/vendor/assets/scss/components/_table.scss +7 -6
  92. data/vendor/assets/scss/components/_tabs.scss +1 -1
  93. data/vendor/assets/scss/components/_title-bar.scss +1 -1
  94. data/vendor/assets/scss/components/_tooltip.scss +74 -21
  95. data/vendor/assets/scss/components/_top-bar.scss +2 -0
  96. data/vendor/assets/scss/forms/_fieldset.scss +0 -1
  97. data/vendor/assets/scss/forms/_meter.scss +7 -1
  98. data/vendor/assets/scss/forms/_select.scss +4 -3
  99. data/vendor/assets/scss/forms/_text.scss +11 -2
  100. data/vendor/assets/scss/foundation.scss +17 -3
  101. data/vendor/assets/scss/grid/_flex-grid.scss +3 -52
  102. data/vendor/assets/scss/prototype/_arrow.scss +36 -0
  103. data/vendor/assets/scss/prototype/_border-box.scss +35 -0
  104. data/vendor/assets/scss/prototype/_border-none.scss +35 -0
  105. data/vendor/assets/scss/prototype/_bordered.scss +54 -0
  106. data/vendor/assets/scss/prototype/_box.scss +23 -0
  107. data/vendor/assets/scss/prototype/_display.scss +50 -0
  108. data/vendor/assets/scss/prototype/_font-styling.scss +95 -0
  109. data/vendor/assets/scss/prototype/_list-style-type.scss +95 -0
  110. data/vendor/assets/scss/prototype/_overflow.scss +72 -0
  111. data/vendor/assets/scss/prototype/_position.scss +114 -0
  112. data/vendor/assets/scss/prototype/_prototype.scss +91 -0
  113. data/vendor/assets/scss/prototype/_relation.scss +157 -0
  114. data/vendor/assets/scss/prototype/_rotate.scss +31 -0
  115. data/vendor/assets/scss/prototype/_rounded.scss +54 -0
  116. data/vendor/assets/scss/prototype/_separator.scss +96 -0
  117. data/vendor/assets/scss/prototype/_shadow.scss +43 -0
  118. data/vendor/assets/scss/prototype/_sizing.scss +73 -0
  119. data/vendor/assets/scss/prototype/_spacing.scss +204 -0
  120. data/vendor/assets/scss/prototype/_text-decoration.scss +48 -0
  121. data/vendor/assets/scss/prototype/_text-transformation.scss +48 -0
  122. data/vendor/assets/scss/prototype/_text-utilities.scss +88 -0
  123. data/vendor/assets/scss/prototype/_typescale.scss +20 -0
  124. data/vendor/assets/scss/settings/_settings.scss +291 -48
  125. data/vendor/assets/scss/typography/_base.scss +2 -2
  126. data/vendor/assets/scss/typography/_helpers.scss +6 -4
  127. data/vendor/assets/scss/util/_breakpoint.scss +60 -1
  128. data/vendor/assets/scss/util/_color.scss +8 -5
  129. data/vendor/assets/scss/util/_mixins.scss +45 -5
  130. data/vendor/assets/scss/xy-grid/_cell.scss +179 -0
  131. data/vendor/assets/scss/xy-grid/_classes.scss +455 -0
  132. data/vendor/assets/scss/xy-grid/_collapse.scss +54 -0
  133. data/vendor/assets/scss/xy-grid/_frame.scss +54 -0
  134. data/vendor/assets/scss/xy-grid/_grid.scss +56 -0
  135. data/vendor/assets/scss/xy-grid/_gutters.scss +45 -0
  136. data/vendor/assets/scss/xy-grid/_layout.scss +33 -0
  137. data/vendor/assets/scss/xy-grid/_position.scss +28 -0
  138. data/vendor/assets/scss/xy-grid/_xy-grid.scss +52 -0
  139. metadata +73 -4
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- !function($) {
3
+ import $ from 'jquery';
4
4
 
5
5
  function Timer(elem, options, cb) {
6
6
  var _this = this,
@@ -45,44 +45,4 @@ function Timer(elem, options, cb) {
45
45
  }
46
46
  }
47
47
 
48
- /**
49
- * Runs a callback function when images are fully loaded.
50
- * @param {Object} images - Image(s) to check if loaded.
51
- * @param {Func} callback - Function to execute when image is fully loaded.
52
- */
53
- function onImagesLoaded(images, callback){
54
- var self = this,
55
- unloaded = images.length;
56
-
57
- if (unloaded === 0) {
58
- callback();
59
- }
60
-
61
- images.each(function() {
62
- // Check if image is loaded
63
- if (this.complete || (this.readyState === 4) || (this.readyState === 'complete')) {
64
- singleImageLoaded();
65
- }
66
- // Force load the image
67
- else {
68
- // fix for IE. See https://css-tricks.com/snippets/jquery/fixing-load-in-ie-for-cached-images/
69
- var src = $(this).attr('src');
70
- $(this).attr('src', src + (src.indexOf('?') >= 0 ? '&' : '?') + (new Date().getTime()));
71
- $(this).one('load', function() {
72
- singleImageLoaded();
73
- });
74
- }
75
- });
76
-
77
- function singleImageLoaded() {
78
- unloaded--;
79
- if (unloaded === 0) {
80
- callback();
81
- }
82
- }
83
- }
84
-
85
- Foundation.Timer = Timer;
86
- Foundation.onImagesLoaded = onImagesLoaded;
87
-
88
- }(jQuery);
48
+ export {Timer};
@@ -2,83 +2,104 @@
2
2
  //**Work inspired by multiple jquery swipe plugins**
3
3
  //**Done by Yohai Ararat ***************************
4
4
  //**************************************************
5
- (function($) {
6
5
 
7
- $.spotSwipe = {
8
- version: '1.0.0',
9
- enabled: 'ontouchstart' in document.documentElement,
10
- preventDefault: false,
11
- moveThreshold: 75,
12
- timeThreshold: 200
13
- };
6
+ import $ from 'jquery';
14
7
 
15
- var startPosX,
16
- startPosY,
17
- startTime,
18
- elapsedTime,
19
- isMoving = false;
8
+ var Touch = {};
20
9
 
21
- function onTouchEnd() {
22
- // alert(this);
23
- this.removeEventListener('touchmove', onTouchMove);
24
- this.removeEventListener('touchend', onTouchEnd);
10
+ var startPosX,
11
+ startPosY,
12
+ startTime,
13
+ elapsedTime,
25
14
  isMoving = false;
26
- }
27
15
 
28
- function onTouchMove(e) {
29
- if ($.spotSwipe.preventDefault) { e.preventDefault(); }
30
- if(isMoving) {
31
- var x = e.touches[0].pageX;
32
- var y = e.touches[0].pageY;
33
- var dx = startPosX - x;
34
- var dy = startPosY - y;
35
- var dir;
36
- elapsedTime = new Date().getTime() - startTime;
37
- if(Math.abs(dx) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) {
38
- dir = dx > 0 ? 'left' : 'right';
39
- }
40
- // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) {
41
- // dir = dy > 0 ? 'down' : 'up';
42
- // }
43
- if(dir) {
44
- e.preventDefault();
45
- onTouchEnd.call(this);
46
- $(this).trigger('swipe', dir).trigger(`swipe${dir}`);
47
- }
16
+ function onTouchEnd() {
17
+ // alert(this);
18
+ this.removeEventListener('touchmove', onTouchMove);
19
+ this.removeEventListener('touchend', onTouchEnd);
20
+ isMoving = false;
21
+ }
22
+
23
+ function onTouchMove(e) {
24
+ if ($.spotSwipe.preventDefault) { e.preventDefault(); }
25
+ if(isMoving) {
26
+ var x = e.touches[0].pageX;
27
+ var y = e.touches[0].pageY;
28
+ var dx = startPosX - x;
29
+ var dy = startPosY - y;
30
+ var dir;
31
+ elapsedTime = new Date().getTime() - startTime;
32
+ if(Math.abs(dx) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) {
33
+ dir = dx > 0 ? 'left' : 'right';
48
34
  }
49
- }
50
-
51
- function onTouchStart(e) {
52
- if (e.touches.length == 1) {
53
- startPosX = e.touches[0].pageX;
54
- startPosY = e.touches[0].pageY;
55
- isMoving = true;
56
- startTime = new Date().getTime();
57
- this.addEventListener('touchmove', onTouchMove, false);
58
- this.addEventListener('touchend', onTouchEnd, false);
35
+ // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) {
36
+ // dir = dy > 0 ? 'down' : 'up';
37
+ // }
38
+ if(dir) {
39
+ e.preventDefault();
40
+ onTouchEnd.call(this);
41
+ $(this).trigger('swipe', dir).trigger(`swipe${dir}`);
59
42
  }
60
43
  }
61
-
62
- function init() {
63
- this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);
44
+ }
45
+
46
+ function onTouchStart(e) {
47
+ if (e.touches.length == 1) {
48
+ startPosX = e.touches[0].pageX;
49
+ startPosY = e.touches[0].pageY;
50
+ isMoving = true;
51
+ startTime = new Date().getTime();
52
+ this.addEventListener('touchmove', onTouchMove, false);
53
+ this.addEventListener('touchend', onTouchEnd, false);
64
54
  }
55
+ }
56
+
57
+ function init() {
58
+ this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);
59
+ }
60
+
61
+ function teardown() {
62
+ this.removeEventListener('touchstart', onTouchStart);
63
+ }
64
+
65
+ class SpotSwipe {
66
+ constructor($) {
67
+ this.version = '1.0.0';
68
+ this.enabled = 'ontouchstart' in document.documentElement;
69
+ this.preventDefault = false;
70
+ this.moveThreshold = 75;
71
+ this.timeThreshold = 200;
72
+ this.$ = $;
73
+ this._init();
74
+ }
75
+
76
+ _init() {
77
+ var $ = this.$;
78
+ $.event.special.swipe = { setup: init };
65
79
 
66
- function teardown() {
67
- this.removeEventListener('touchstart', onTouchStart);
80
+ $.each(['left', 'up', 'down', 'right'], function () {
81
+ $.event.special[`swipe${this}`] = { setup: function(){
82
+ $(this).on('swipe', $.noop);
83
+ } };
84
+ });
68
85
  }
86
+ }
69
87
 
70
- $.event.special.swipe = { setup: init };
88
+ /****************************************************
89
+ * As far as I can tell, both setupSpotSwipe and *
90
+ * setupTouchHandler should be idempotent, *
91
+ * because they directly replace functions & *
92
+ * values, and do not add event handlers directly. *
93
+ ****************************************************/
94
+
95
+ Touch.setupSpotSwipe = function($) {
96
+ $.spotSwipe = new SpotSwipe($);
97
+ };
71
98
 
72
- $.each(['left', 'up', 'down', 'right'], function () {
73
- $.event.special[`swipe${this}`] = { setup: function(){
74
- $(this).on('swipe', $.noop);
75
- } };
76
- });
77
- })(jQuery);
78
99
  /****************************************************
79
- * Method for adding psuedo drag events to elements *
100
+ * Method for adding pseudo drag events to elements *
80
101
  ***************************************************/
81
- !function($){
102
+ Touch.setupTouchHandler = function($) {
82
103
  $.fn.addTouch = function(){
83
104
  this.each(function(i,el){
84
105
  $(el).bind('touchstart touchmove touchend touchcancel',function(){
@@ -116,237 +137,13 @@
116
137
  first.target.dispatchEvent(simulatedEvent);
117
138
  };
118
139
  };
119
- }(jQuery);
120
-
121
-
122
- //**********************************
123
- //**From the jQuery Mobile Library**
124
- //**need to recreate functionality**
125
- //**and try to improve if possible**
126
- //**********************************
127
-
128
- /* Removing the jQuery function ****
129
- ************************************
130
-
131
- (function( $, window, undefined ) {
132
-
133
- var $document = $( document ),
134
- // supportTouch = $.mobile.support.touch,
135
- touchStartEvent = 'touchstart'//supportTouch ? "touchstart" : "mousedown",
136
- touchStopEvent = 'touchend'//supportTouch ? "touchend" : "mouseup",
137
- touchMoveEvent = 'touchmove'//supportTouch ? "touchmove" : "mousemove";
138
-
139
- // setup new event shortcuts
140
- $.each( ( "touchstart touchmove touchend " +
141
- "swipe swipeleft swiperight" ).split( " " ), function( i, name ) {
142
-
143
- $.fn[ name ] = function( fn ) {
144
- return fn ? this.bind( name, fn ) : this.trigger( name );
145
- };
146
-
147
- // jQuery < 1.8
148
- if ( $.attrFn ) {
149
- $.attrFn[ name ] = true;
150
- }
151
- });
152
-
153
- function triggerCustomEvent( obj, eventType, event, bubble ) {
154
- var originalType = event.type;
155
- event.type = eventType;
156
- if ( bubble ) {
157
- $.event.trigger( event, undefined, obj );
158
- } else {
159
- $.event.dispatch.call( obj, event );
160
- }
161
- event.type = originalType;
162
- }
163
-
164
- // also handles taphold
165
-
166
- // Also handles swipeleft, swiperight
167
- $.event.special.swipe = {
168
-
169
- // More than this horizontal displacement, and we will suppress scrolling.
170
- scrollSupressionThreshold: 30,
171
-
172
- // More time than this, and it isn't a swipe.
173
- durationThreshold: 1000,
174
-
175
- // Swipe horizontal displacement must be more than this.
176
- horizontalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30,
140
+ };
177
141
 
178
- // Swipe vertical displacement must be less than this.
179
- verticalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30,
180
-
181
- getLocation: function ( event ) {
182
- var winPageX = window.pageXOffset,
183
- winPageY = window.pageYOffset,
184
- x = event.clientX,
185
- y = event.clientY;
186
-
187
- if ( event.pageY === 0 && Math.floor( y ) > Math.floor( event.pageY ) ||
188
- event.pageX === 0 && Math.floor( x ) > Math.floor( event.pageX ) ) {
189
-
190
- // iOS4 clientX/clientY have the value that should have been
191
- // in pageX/pageY. While pageX/page/ have the value 0
192
- x = x - winPageX;
193
- y = y - winPageY;
194
- } else if ( y < ( event.pageY - winPageY) || x < ( event.pageX - winPageX ) ) {
195
-
196
- // Some Android browsers have totally bogus values for clientX/Y
197
- // when scrolling/zooming a page. Detectable since clientX/clientY
198
- // should never be smaller than pageX/pageY minus page scroll
199
- x = event.pageX - winPageX;
200
- y = event.pageY - winPageY;
201
- }
202
-
203
- return {
204
- x: x,
205
- y: y
206
- };
207
- },
208
-
209
- start: function( event ) {
210
- var data = event.originalEvent.touches ?
211
- event.originalEvent.touches[ 0 ] : event,
212
- location = $.event.special.swipe.getLocation( data );
213
- return {
214
- time: ( new Date() ).getTime(),
215
- coords: [ location.x, location.y ],
216
- origin: $( event.target )
217
- };
218
- },
219
-
220
- stop: function( event ) {
221
- var data = event.originalEvent.touches ?
222
- event.originalEvent.touches[ 0 ] : event,
223
- location = $.event.special.swipe.getLocation( data );
224
- return {
225
- time: ( new Date() ).getTime(),
226
- coords: [ location.x, location.y ]
227
- };
228
- },
229
-
230
- handleSwipe: function( start, stop, thisObject, origTarget ) {
231
- if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
232
- Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
233
- Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
234
- var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight";
235
-
236
- triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }), true );
237
- triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ), true );
238
- return true;
239
- }
240
- return false;
241
-
242
- },
243
-
244
- // This serves as a flag to ensure that at most one swipe event event is
245
- // in work at any given time
246
- eventInProgress: false,
247
-
248
- setup: function() {
249
- var events,
250
- thisObject = this,
251
- $this = $( thisObject ),
252
- context = {};
253
-
254
- // Retrieve the events data for this element and add the swipe context
255
- events = $.data( this, "mobile-events" );
256
- if ( !events ) {
257
- events = { length: 0 };
258
- $.data( this, "mobile-events", events );
259
- }
260
- events.length++;
261
- events.swipe = context;
262
-
263
- context.start = function( event ) {
264
-
265
- // Bail if we're already working on a swipe event
266
- if ( $.event.special.swipe.eventInProgress ) {
267
- return;
268
- }
269
- $.event.special.swipe.eventInProgress = true;
270
-
271
- var stop,
272
- start = $.event.special.swipe.start( event ),
273
- origTarget = event.target,
274
- emitted = false;
275
-
276
- context.move = function( event ) {
277
- if ( !start || event.isDefaultPrevented() ) {
278
- return;
279
- }
280
-
281
- stop = $.event.special.swipe.stop( event );
282
- if ( !emitted ) {
283
- emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget );
284
- if ( emitted ) {
285
-
286
- // Reset the context to make way for the next swipe event
287
- $.event.special.swipe.eventInProgress = false;
288
- }
289
- }
290
- // prevent scrolling
291
- if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) {
292
- event.preventDefault();
293
- }
294
- };
295
-
296
- context.stop = function() {
297
- emitted = true;
298
-
299
- // Reset the context to make way for the next swipe event
300
- $.event.special.swipe.eventInProgress = false;
301
- $document.off( touchMoveEvent, context.move );
302
- context.move = null;
303
- };
304
-
305
- $document.on( touchMoveEvent, context.move )
306
- .one( touchStopEvent, context.stop );
307
- };
308
- $this.on( touchStartEvent, context.start );
309
- },
310
-
311
- teardown: function() {
312
- var events, context;
313
-
314
- events = $.data( this, "mobile-events" );
315
- if ( events ) {
316
- context = events.swipe;
317
- delete events.swipe;
318
- events.length--;
319
- if ( events.length === 0 ) {
320
- $.removeData( this, "mobile-events" );
321
- }
322
- }
323
-
324
- if ( context ) {
325
- if ( context.start ) {
326
- $( this ).off( touchStartEvent, context.start );
327
- }
328
- if ( context.move ) {
329
- $document.off( touchMoveEvent, context.move );
330
- }
331
- if ( context.stop ) {
332
- $document.off( touchStopEvent, context.stop );
333
- }
334
- }
335
- }
336
- };
337
- $.each({
338
- swipeleft: "swipe.left",
339
- swiperight: "swipe.right"
340
- }, function( event, sourceEvent ) {
142
+ Touch.init = function($) {
143
+ if(typeof($.spotSwipe) === 'undefined') {
144
+ Touch.setupSpotSwipe($);
145
+ Touch.setupTouchHandler($);
146
+ }
147
+ };
341
148
 
342
- $.event.special[ event ] = {
343
- setup: function() {
344
- $( this ).bind( sourceEvent, $.noop );
345
- },
346
- teardown: function() {
347
- $( this ).unbind( sourceEvent );
348
- }
349
- };
350
- });
351
- })( jQuery, this );
352
- */
149
+ export {Touch};