foundation-rails 5.5.3.2 → 6.1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -8
  4. data/Rakefile +23 -0
  5. data/app/views/foundation/rails/styleguide/show.html.erb +2 -5
  6. data/bower.json +2 -2
  7. data/lib/foundation/rails/version.rb +1 -1
  8. data/lib/generators/foundation/install_generator.rb +6 -3
  9. data/lib/generators/foundation/templates/_settings.scss +546 -0
  10. data/lib/generators/foundation/templates/application.html.erb +0 -1
  11. data/lib/generators/foundation/templates/application.html.haml +0 -2
  12. data/lib/generators/foundation/templates/application.html.slim +0 -2
  13. data/lib/generators/foundation/templates/foundation_and_overrides.scss +51 -0
  14. data/vendor/assets/js/foundation.abide.js +418 -0
  15. data/vendor/assets/js/foundation.accordion.js +229 -0
  16. data/vendor/assets/js/foundation.accordionMenu.js +262 -0
  17. data/vendor/assets/js/foundation.core.js +378 -0
  18. data/vendor/assets/js/foundation.drilldown.js +321 -0
  19. data/vendor/assets/js/foundation.dropdown.js +390 -0
  20. data/vendor/assets/js/foundation.dropdownMenu.js +391 -0
  21. data/vendor/assets/js/foundation.equalizer.js +274 -0
  22. data/vendor/assets/js/foundation.interchange.js +184 -0
  23. data/vendor/assets/js/foundation.js +28 -0
  24. data/vendor/assets/js/foundation.magellan.js +212 -0
  25. data/vendor/assets/js/foundation.offcanvas.js +371 -0
  26. data/vendor/assets/js/foundation.orbit.js +419 -0
  27. data/vendor/assets/js/foundation.responsiveMenu.js +145 -0
  28. data/vendor/assets/js/foundation.responsiveToggle.js +106 -0
  29. data/vendor/assets/js/foundation.reveal.js +478 -0
  30. data/vendor/assets/js/foundation.slider.js +484 -0
  31. data/vendor/assets/js/foundation.sticky.js +436 -0
  32. data/vendor/assets/js/foundation.tabs.js +306 -0
  33. data/vendor/assets/js/foundation.toggler.js +147 -0
  34. data/vendor/assets/js/foundation.tooltip.js +429 -0
  35. data/vendor/assets/js/foundation.util.box.js +169 -0
  36. data/vendor/assets/js/foundation.util.keyboard.js +115 -0
  37. data/vendor/assets/js/foundation.util.mediaQuery.js +210 -0
  38. data/vendor/assets/js/foundation.util.motion.js +89 -0
  39. data/vendor/assets/js/foundation.util.nest.js +64 -0
  40. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +78 -0
  41. data/vendor/assets/js/foundation.util.touch.js +339 -0
  42. data/vendor/assets/js/foundation.util.triggers.js +222 -0
  43. data/vendor/assets/scss/_global.scss +626 -0
  44. data/vendor/assets/scss/components/_accordion-menu.scss +32 -0
  45. data/vendor/assets/scss/components/_accordion.scss +113 -0
  46. data/vendor/assets/scss/components/_badge.scss +55 -0
  47. data/vendor/assets/scss/components/_breadcrumbs.scss +94 -0
  48. data/vendor/assets/scss/components/_button-group.scss +130 -0
  49. data/vendor/assets/scss/components/_button.scss +265 -0
  50. data/vendor/assets/scss/components/_callout.scss +105 -0
  51. data/vendor/assets/scss/components/_close-button.scss +61 -0
  52. data/vendor/assets/scss/components/_drilldown.scss +75 -0
  53. data/vendor/assets/scss/components/_dropdown-menu.scss +148 -0
  54. data/vendor/assets/scss/components/_dropdown.scss +64 -0
  55. data/vendor/assets/scss/components/_flex-video.scss +63 -0
  56. data/vendor/assets/scss/components/_float.scss +27 -0
  57. data/vendor/assets/scss/components/_label.scss +56 -0
  58. data/vendor/assets/scss/components/_media-object.scss +74 -0
  59. data/vendor/assets/scss/components/_menu.scss +209 -0
  60. data/vendor/assets/scss/components/_off-canvas.scss +180 -0
  61. data/vendor/assets/scss/components/_orbit.scss +193 -0
  62. data/vendor/assets/scss/components/_pagination.scss +158 -0
  63. data/vendor/assets/scss/components/_progress-bar.scss +83 -0
  64. data/vendor/assets/scss/components/_reveal.scss +156 -0
  65. data/vendor/assets/scss/components/_slider.scss +158 -0
  66. data/vendor/assets/scss/components/_sticky.scss +38 -0
  67. data/vendor/assets/scss/components/_switch.scss +232 -0
  68. data/vendor/assets/scss/components/_table.scss +213 -0
  69. data/vendor/assets/scss/components/_tabs.scss +170 -0
  70. data/vendor/assets/scss/components/_thumbnail.scss +54 -0
  71. data/vendor/assets/scss/components/_title-bar.scss +68 -0
  72. data/vendor/assets/scss/components/_tooltip.scss +100 -0
  73. data/vendor/assets/scss/components/_top-bar.scss +89 -0
  74. data/vendor/assets/scss/components/_visibility.scss +131 -0
  75. data/vendor/assets/scss/forms/_checkbox.scss +36 -0
  76. data/vendor/assets/scss/forms/_error.scss +82 -0
  77. data/vendor/assets/scss/forms/_fieldset.scss +53 -0
  78. data/vendor/assets/scss/forms/_forms.scss +32 -0
  79. data/vendor/assets/scss/forms/_help-text.scss +30 -0
  80. data/vendor/assets/scss/forms/_input-group.scss +91 -0
  81. data/vendor/assets/scss/forms/_label.scss +48 -0
  82. data/vendor/assets/scss/forms/_select.scss +63 -0
  83. data/vendor/assets/scss/forms/_text.scss +154 -0
  84. data/vendor/assets/scss/foundation.scss +91 -0
  85. data/vendor/assets/scss/grid/_classes.scss +153 -0
  86. data/vendor/assets/scss/grid/_column.scss +124 -0
  87. data/vendor/assets/scss/grid/_flex-grid.scss +281 -0
  88. data/vendor/assets/scss/grid/_grid.scss +48 -0
  89. data/vendor/assets/scss/grid/_gutter.scss +34 -0
  90. data/vendor/assets/scss/grid/_layout.scss +33 -0
  91. data/vendor/assets/scss/grid/_position.scss +72 -0
  92. data/vendor/assets/scss/grid/_row.scss +97 -0
  93. data/vendor/assets/scss/grid/_size.scss +24 -0
  94. data/vendor/assets/scss/settings/_settings.scss +547 -0
  95. data/vendor/assets/scss/typography/_alignment.scss +22 -0
  96. data/vendor/assets/scss/typography/_base.scss +439 -0
  97. data/vendor/assets/scss/typography/_helpers.scss +77 -0
  98. data/vendor/assets/scss/typography/_print.scss +73 -0
  99. data/vendor/assets/scss/typography/_typography.scss +28 -0
  100. data/vendor/assets/scss/util/_breakpoint.scss +266 -0
  101. data/vendor/assets/scss/util/_color.scss +41 -0
  102. data/vendor/assets/scss/util/_mixins.scss +223 -0
  103. data/vendor/assets/scss/util/_selector.scss +40 -0
  104. data/vendor/assets/scss/util/_unit.scss +90 -0
  105. data/vendor/assets/scss/util/_util.scss +15 -0
  106. data/vendor/assets/scss/util/_value.scss +126 -0
  107. metadata +97 -64
  108. data/update-gem.sh +0 -20
  109. data/vendor/assets/javascripts/foundation.js +0 -17
  110. data/vendor/assets/javascripts/foundation/foundation.abide.js +0 -426
  111. data/vendor/assets/javascripts/foundation/foundation.accordion.js +0 -125
  112. data/vendor/assets/javascripts/foundation/foundation.alert.js +0 -43
  113. data/vendor/assets/javascripts/foundation/foundation.clearing.js +0 -586
  114. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +0 -468
  115. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +0 -104
  116. data/vendor/assets/javascripts/foundation/foundation.interchange.js +0 -360
  117. data/vendor/assets/javascripts/foundation/foundation.joyride.js +0 -935
  118. data/vendor/assets/javascripts/foundation/foundation.js +0 -732
  119. data/vendor/assets/javascripts/foundation/foundation.magellan.js +0 -214
  120. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +0 -225
  121. data/vendor/assets/javascripts/foundation/foundation.orbit.js +0 -476
  122. data/vendor/assets/javascripts/foundation/foundation.reveal.js +0 -522
  123. data/vendor/assets/javascripts/foundation/foundation.slider.js +0 -296
  124. data/vendor/assets/javascripts/foundation/foundation.tab.js +0 -247
  125. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +0 -348
  126. data/vendor/assets/javascripts/foundation/foundation.topbar.js +0 -458
  127. data/vendor/assets/javascripts/vendor/modernizr.js +0 -1406
  128. data/vendor/assets/stylesheets/foundation.scss +0 -42
  129. data/vendor/assets/stylesheets/foundation/_functions.scss +0 -156
  130. data/vendor/assets/stylesheets/foundation/_settings.scss +0 -1489
  131. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +0 -161
  132. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +0 -128
  133. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +0 -133
  134. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
  135. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +0 -208
  136. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +0 -261
  137. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +0 -260
  138. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +0 -130
  139. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +0 -269
  140. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +0 -51
  141. data/vendor/assets/stylesheets/foundation/components/_forms.scss +0 -607
  142. data/vendor/assets/stylesheets/foundation/components/_global.scss +0 -566
  143. data/vendor/assets/stylesheets/foundation/components/_grid.scss +0 -292
  144. data/vendor/assets/stylesheets/foundation/components/_icon-bar.scss +0 -460
  145. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +0 -58
  146. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +0 -220
  147. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +0 -60
  148. data/vendor/assets/stylesheets/foundation/components/_labels.scss +0 -106
  149. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +0 -34
  150. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +0 -606
  151. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +0 -388
  152. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +0 -163
  153. data/vendor/assets/stylesheets/foundation/components/_panels.scss +0 -107
  154. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +0 -150
  155. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +0 -85
  156. data/vendor/assets/stylesheets/foundation/components/_range-slider.scss +0 -177
  157. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +0 -212
  158. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +0 -120
  159. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +0 -203
  160. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +0 -125
  161. data/vendor/assets/stylesheets/foundation/components/_switches.scss +0 -241
  162. data/vendor/assets/stylesheets/foundation/components/_tables.scss +0 -135
  163. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +0 -142
  164. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +0 -66
  165. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +0 -142
  166. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +0 -745
  167. data/vendor/assets/stylesheets/foundation/components/_type.scss +0 -525
  168. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +0 -425
  169. data/vendor/assets/stylesheets/normalize.scss +0 -424
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Motion module.
3
+ * @module foundation.motion
4
+ */
5
+ !function($, Foundation) {
6
+
7
+ var initClasses = ['mui-enter', 'mui-leave'];
8
+ var activeClasses = ['mui-enter-active', 'mui-leave-active'];
9
+
10
+ function animate(isIn, element, animation, cb) {
11
+ element = $(element).eq(0);
12
+
13
+ if (!element.length) return;
14
+
15
+ var initClass = isIn ? initClasses[0] : initClasses[1];
16
+ var activeClass = isIn ? activeClasses[0] : activeClasses[1];
17
+
18
+ // Set up the animation
19
+ reset();
20
+ element.addClass(animation)
21
+ .css('transition', 'none');
22
+ // .addClass(initClass);
23
+ // if(isIn) element.show();
24
+ requestAnimationFrame(function() {
25
+ element.addClass(initClass);
26
+ if (isIn) element.show();
27
+ });
28
+ // Start the animation
29
+ requestAnimationFrame(function() {
30
+ element[0].offsetWidth;
31
+ element.css('transition', '');
32
+ element.addClass(activeClass);
33
+ });
34
+ // Move(500, element, function(){
35
+ // // element[0].offsetWidth;
36
+ // element.css('transition', '');
37
+ // element.addClass(activeClass);
38
+ // });
39
+
40
+ // Clean up the animation when it finishes
41
+ element.one(Foundation.transitionend(element), finish);//.one('finished.zf.animate', finish);
42
+
43
+ // Hides the element (for out animations), resets the element, and runs a callback
44
+ function finish() {
45
+ if (!isIn) element.hide();
46
+ reset();
47
+ if (cb) cb.apply(element);
48
+ }
49
+
50
+ // Resets transitions and removes motion-specific classes
51
+ function reset() {
52
+ element[0].style.transitionDuration = 0;
53
+ element.removeClass(initClass + ' ' + activeClass + ' ' + animation);
54
+ }
55
+ }
56
+
57
+ var Motion = {
58
+ animateIn: function(element, animation, /*duration,*/ cb) {
59
+ animate(true, element, animation, cb);
60
+ },
61
+
62
+ animateOut: function(element, animation, /*duration,*/ cb) {
63
+ animate(false, element, animation, cb);
64
+ }
65
+ };
66
+
67
+ var Move = function(duration, elem, fn){
68
+ var anim, prog, start = null;
69
+ // console.log('called');
70
+
71
+ function move(ts){
72
+ if(!start) start = window.performance.now();
73
+ // console.log(start, ts);
74
+ prog = ts - start;
75
+ fn.apply(elem);
76
+
77
+ if(prog < duration){ anim = window.requestAnimationFrame(move, elem); }
78
+ else{
79
+ window.cancelAnimationFrame(anim);
80
+ elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]);
81
+ }
82
+ }
83
+ anim = window.requestAnimationFrame(move);
84
+ };
85
+
86
+ Foundation.Move = Move;
87
+ Foundation.Motion = Motion;
88
+
89
+ }(jQuery, Foundation);
@@ -0,0 +1,64 @@
1
+ !function($, Foundation){
2
+ 'use strict';
3
+ Foundation.Nest = {
4
+ Feather: function(menu, type){
5
+ menu.attr('role', 'menubar');
6
+ type = type || 'zf';
7
+ var items = menu.find('li').attr({'role': 'menuitem'}),
8
+ subMenuClass = 'is-' + type + '-submenu',
9
+ subItemClass = subMenuClass + '-item',
10
+ hasSubClass = 'is-' + type + '-submenu-parent';
11
+ menu.find('a:first').attr('tabindex', 0);
12
+ items.each(function(){
13
+ var $item = $(this),
14
+ $sub = $item.children('ul');
15
+ if($sub.length){
16
+ $item.addClass('has-submenu ' + hasSubClass)
17
+ .attr({
18
+ 'aria-haspopup': true,
19
+ 'aria-selected': false,
20
+ 'aria-expanded': false,
21
+ 'aria-label': $item.children('a:first').text()
22
+ });
23
+ $sub.addClass('submenu ' + subMenuClass)
24
+ .attr({
25
+ 'data-submenu': '',
26
+ 'aria-hidden': true,
27
+ 'role': 'menu'
28
+ });
29
+ }
30
+ if($item.parent('[data-submenu]').length){
31
+ $item.addClass('is-submenu-item ' + subItemClass);
32
+ }
33
+ });
34
+ return;
35
+ },
36
+ Burn: function(menu, type){
37
+ var items = menu.find('li').removeAttr('tabindex'),
38
+ subMenuClass = 'is-' + type + '-submenu',
39
+ subItemClass = subMenuClass + '-item',
40
+ hasSubClass = 'is-' + type + '-submenu-parent';
41
+
42
+ // menu.find('.is-active').removeClass('is-active');
43
+ menu.find('*')
44
+ // menu.find('.' + subMenuClass + ', .' + subItemClass + ', .is-active, .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
45
+ .removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' has-submenu is-submenu-item submenu is-active')
46
+ .removeAttr('data-submenu').css('display', '');
47
+
48
+ // console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
49
+ // .removeClass(subMenuClass + ' ' + subItemClass + ' has-submenu is-submenu-item submenu')
50
+ // .removeAttr('data-submenu'));
51
+ // items.each(function(){
52
+ // var $item = $(this),
53
+ // $sub = $item.children('ul');
54
+ // if($item.parent('[data-submenu]').length){
55
+ // $item.removeClass('is-submenu-item ' + subItemClass);
56
+ // }
57
+ // if($sub.length){
58
+ // $item.removeClass('has-submenu');
59
+ // $sub.removeClass('submenu ' + subMenuClass).removeAttr('data-submenu');
60
+ // }
61
+ // });
62
+ }
63
+ };
64
+ }(jQuery, window.Foundation);
@@ -0,0 +1,78 @@
1
+ !function($, Foundation){
2
+ 'use strict';
3
+ var Timer = function(elem, options, cb){
4
+ var _this = this,
5
+ duration = options.duration,//options is an object for easily adding features later.
6
+ nameSpace = Object.keys(elem.data())[0] || 'timer',
7
+ remain = -1,
8
+ start,
9
+ timer;
10
+
11
+ this.restart = function(){
12
+ remain = -1;
13
+ clearTimeout(timer);
14
+ this.start();
15
+ };
16
+
17
+ this.start = function(){
18
+ // if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
19
+ clearTimeout(timer);
20
+ remain = remain <= 0 ? duration : remain;
21
+ elem.data('paused', false);
22
+ start = Date.now();
23
+ timer = setTimeout(function(){
24
+ if(options.infinite){
25
+ _this.restart();//rerun the timer.
26
+ }
27
+ cb();
28
+ }, remain);
29
+ elem.trigger('timerstart.zf.' + nameSpace);
30
+ };
31
+
32
+ this.pause = function(){
33
+ //if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
34
+ clearTimeout(timer);
35
+ elem.data('paused', true);
36
+ var end = Date.now();
37
+ remain = remain - (end - start);
38
+ elem.trigger('timerpaused.zf.' + nameSpace);
39
+ };
40
+ };
41
+ /**
42
+ * Runs a callback function when images are fully loaded.
43
+ * @param {Object} images - Image(s) to check if loaded.
44
+ * @param {Func} callback - Function to execute when image is fully loaded.
45
+ */
46
+ var onImagesLoaded = function(images, callback){
47
+ var self = this,
48
+ unloaded = images.length;
49
+
50
+ if (unloaded === 0) {
51
+ callback();
52
+ }
53
+
54
+ var singleImageLoaded = function() {
55
+ unloaded--;
56
+ if (unloaded === 0) {
57
+ callback();
58
+ }
59
+ };
60
+
61
+ images.each(function() {
62
+ if (this.complete) {
63
+ singleImageLoaded();
64
+ }
65
+ else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) {
66
+ singleImageLoaded();
67
+ }
68
+ else {
69
+ $(this).one('load', function() {
70
+ singleImageLoaded();
71
+ });
72
+ }
73
+ });
74
+ };
75
+
76
+ Foundation.Timer = Timer;
77
+ Foundation.onImagesLoaded = onImagesLoaded;
78
+ }(jQuery, window.Foundation);
@@ -0,0 +1,339 @@
1
+ //**************************************************
2
+ //**Work inspired by multiple jquery swipe plugins**
3
+ //**Done by Yohai Ararat ***************************
4
+ //**************************************************
5
+ (function($) {
6
+
7
+ $.spotSwipe = {
8
+ version: '1.0.0',
9
+ enabled: 'ontouchstart' in document.documentElement,
10
+ preventDefault: false,
11
+ moveThreshold: 75,
12
+ timeThreshold: 200
13
+ };
14
+
15
+ var startPosX,
16
+ startPosY,
17
+ startTime,
18
+ elapsedTime,
19
+ isMoving = false;
20
+
21
+ function onTouchEnd() {
22
+ // alert(this);
23
+ this.removeEventListener('touchmove', onTouchMove);
24
+ this.removeEventListener('touchend', onTouchEnd);
25
+ isMoving = false;
26
+ }
27
+
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
+ }
48
+ }
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);
59
+ }
60
+ }
61
+
62
+ function init() {
63
+ this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);
64
+ }
65
+
66
+ function teardown() {
67
+ this.removeEventListener('touchstart', onTouchStart);
68
+ }
69
+
70
+ $.event.special.swipe = { setup: init };
71
+
72
+ $.each(['left', 'up', 'down', 'right'], function () {
73
+ $.event.special['swipe' + this] = { setup: function(){
74
+ $(this).on('swipe', $.noop);
75
+ } };
76
+ });
77
+ })(jQuery);
78
+ /****************************************************
79
+ * Method for adding psuedo drag events to elements *
80
+ ***************************************************/
81
+ !function($){
82
+ $.fn.addTouch = function(){
83
+ this.each(function(i,el){
84
+ $(el).bind('touchstart touchmove touchend touchcancel',function(){
85
+ //we pass the original event object because the jQuery event
86
+ //object is normalized to w3c specs and does not provide the TouchList
87
+ handleTouch(event);
88
+ });
89
+ });
90
+
91
+ var handleTouch = function(event){
92
+ var touches = event.changedTouches,
93
+ first = touches[0],
94
+ eventTypes = {
95
+ touchstart: 'mousedown',
96
+ touchmove: 'mousemove',
97
+ touchend: 'mouseup'
98
+ },
99
+ type = eventTypes[event.type];
100
+
101
+ var simulatedEvent = document.createEvent('MouseEvent');
102
+ simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null);
103
+ first.target.dispatchEvent(simulatedEvent);
104
+ };
105
+ };
106
+ }(jQuery);
107
+
108
+
109
+ //**********************************
110
+ //**From the jQuery Mobile Library**
111
+ //**need to recreate functionality**
112
+ //**and try to improve if possible**
113
+ //**********************************
114
+
115
+ /* Removing the jQuery function ****
116
+ ************************************
117
+
118
+ (function( $, window, undefined ) {
119
+
120
+ var $document = $( document ),
121
+ // supportTouch = $.mobile.support.touch,
122
+ touchStartEvent = 'touchstart'//supportTouch ? "touchstart" : "mousedown",
123
+ touchStopEvent = 'touchend'//supportTouch ? "touchend" : "mouseup",
124
+ touchMoveEvent = 'touchmove'//supportTouch ? "touchmove" : "mousemove";
125
+
126
+ // setup new event shortcuts
127
+ $.each( ( "touchstart touchmove touchend " +
128
+ "swipe swipeleft swiperight" ).split( " " ), function( i, name ) {
129
+
130
+ $.fn[ name ] = function( fn ) {
131
+ return fn ? this.bind( name, fn ) : this.trigger( name );
132
+ };
133
+
134
+ // jQuery < 1.8
135
+ if ( $.attrFn ) {
136
+ $.attrFn[ name ] = true;
137
+ }
138
+ });
139
+
140
+ function triggerCustomEvent( obj, eventType, event, bubble ) {
141
+ var originalType = event.type;
142
+ event.type = eventType;
143
+ if ( bubble ) {
144
+ $.event.trigger( event, undefined, obj );
145
+ } else {
146
+ $.event.dispatch.call( obj, event );
147
+ }
148
+ event.type = originalType;
149
+ }
150
+
151
+ // also handles taphold
152
+
153
+ // Also handles swipeleft, swiperight
154
+ $.event.special.swipe = {
155
+
156
+ // More than this horizontal displacement, and we will suppress scrolling.
157
+ scrollSupressionThreshold: 30,
158
+
159
+ // More time than this, and it isn't a swipe.
160
+ durationThreshold: 1000,
161
+
162
+ // Swipe horizontal displacement must be more than this.
163
+ horizontalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30,
164
+
165
+ // Swipe vertical displacement must be less than this.
166
+ verticalDistanceThreshold: window.devicePixelRatio >= 2 ? 15 : 30,
167
+
168
+ getLocation: function ( event ) {
169
+ var winPageX = window.pageXOffset,
170
+ winPageY = window.pageYOffset,
171
+ x = event.clientX,
172
+ y = event.clientY;
173
+
174
+ if ( event.pageY === 0 && Math.floor( y ) > Math.floor( event.pageY ) ||
175
+ event.pageX === 0 && Math.floor( x ) > Math.floor( event.pageX ) ) {
176
+
177
+ // iOS4 clientX/clientY have the value that should have been
178
+ // in pageX/pageY. While pageX/page/ have the value 0
179
+ x = x - winPageX;
180
+ y = y - winPageY;
181
+ } else if ( y < ( event.pageY - winPageY) || x < ( event.pageX - winPageX ) ) {
182
+
183
+ // Some Android browsers have totally bogus values for clientX/Y
184
+ // when scrolling/zooming a page. Detectable since clientX/clientY
185
+ // should never be smaller than pageX/pageY minus page scroll
186
+ x = event.pageX - winPageX;
187
+ y = event.pageY - winPageY;
188
+ }
189
+
190
+ return {
191
+ x: x,
192
+ y: y
193
+ };
194
+ },
195
+
196
+ start: function( event ) {
197
+ var data = event.originalEvent.touches ?
198
+ event.originalEvent.touches[ 0 ] : event,
199
+ location = $.event.special.swipe.getLocation( data );
200
+ return {
201
+ time: ( new Date() ).getTime(),
202
+ coords: [ location.x, location.y ],
203
+ origin: $( event.target )
204
+ };
205
+ },
206
+
207
+ stop: function( event ) {
208
+ var data = event.originalEvent.touches ?
209
+ event.originalEvent.touches[ 0 ] : event,
210
+ location = $.event.special.swipe.getLocation( data );
211
+ return {
212
+ time: ( new Date() ).getTime(),
213
+ coords: [ location.x, location.y ]
214
+ };
215
+ },
216
+
217
+ handleSwipe: function( start, stop, thisObject, origTarget ) {
218
+ if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
219
+ Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
220
+ Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
221
+ var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight";
222
+
223
+ triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }), true );
224
+ triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ), true );
225
+ return true;
226
+ }
227
+ return false;
228
+
229
+ },
230
+
231
+ // This serves as a flag to ensure that at most one swipe event event is
232
+ // in work at any given time
233
+ eventInProgress: false,
234
+
235
+ setup: function() {
236
+ var events,
237
+ thisObject = this,
238
+ $this = $( thisObject ),
239
+ context = {};
240
+
241
+ // Retrieve the events data for this element and add the swipe context
242
+ events = $.data( this, "mobile-events" );
243
+ if ( !events ) {
244
+ events = { length: 0 };
245
+ $.data( this, "mobile-events", events );
246
+ }
247
+ events.length++;
248
+ events.swipe = context;
249
+
250
+ context.start = function( event ) {
251
+
252
+ // Bail if we're already working on a swipe event
253
+ if ( $.event.special.swipe.eventInProgress ) {
254
+ return;
255
+ }
256
+ $.event.special.swipe.eventInProgress = true;
257
+
258
+ var stop,
259
+ start = $.event.special.swipe.start( event ),
260
+ origTarget = event.target,
261
+ emitted = false;
262
+
263
+ context.move = function( event ) {
264
+ if ( !start || event.isDefaultPrevented() ) {
265
+ return;
266
+ }
267
+
268
+ stop = $.event.special.swipe.stop( event );
269
+ if ( !emitted ) {
270
+ emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget );
271
+ if ( emitted ) {
272
+
273
+ // Reset the context to make way for the next swipe event
274
+ $.event.special.swipe.eventInProgress = false;
275
+ }
276
+ }
277
+ // prevent scrolling
278
+ if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) {
279
+ event.preventDefault();
280
+ }
281
+ };
282
+
283
+ context.stop = function() {
284
+ emitted = true;
285
+
286
+ // Reset the context to make way for the next swipe event
287
+ $.event.special.swipe.eventInProgress = false;
288
+ $document.off( touchMoveEvent, context.move );
289
+ context.move = null;
290
+ };
291
+
292
+ $document.on( touchMoveEvent, context.move )
293
+ .one( touchStopEvent, context.stop );
294
+ };
295
+ $this.on( touchStartEvent, context.start );
296
+ },
297
+
298
+ teardown: function() {
299
+ var events, context;
300
+
301
+ events = $.data( this, "mobile-events" );
302
+ if ( events ) {
303
+ context = events.swipe;
304
+ delete events.swipe;
305
+ events.length--;
306
+ if ( events.length === 0 ) {
307
+ $.removeData( this, "mobile-events" );
308
+ }
309
+ }
310
+
311
+ if ( context ) {
312
+ if ( context.start ) {
313
+ $( this ).off( touchStartEvent, context.start );
314
+ }
315
+ if ( context.move ) {
316
+ $document.off( touchMoveEvent, context.move );
317
+ }
318
+ if ( context.stop ) {
319
+ $document.off( touchStopEvent, context.stop );
320
+ }
321
+ }
322
+ }
323
+ };
324
+ $.each({
325
+ swipeleft: "swipe.left",
326
+ swiperight: "swipe.right"
327
+ }, function( event, sourceEvent ) {
328
+
329
+ $.event.special[ event ] = {
330
+ setup: function() {
331
+ $( this ).bind( sourceEvent, $.noop );
332
+ },
333
+ teardown: function() {
334
+ $( this ).unbind( sourceEvent );
335
+ }
336
+ };
337
+ });
338
+ })( jQuery, this );
339
+ */