materialize-rails 0.97.5.custom1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +63 -0
  6. data/Rakefile +1 -0
  7. data/lib/materialize-rails.rb +25 -0
  8. data/lib/materialize-rails/engine.rb +14 -0
  9. data/lib/materialize-rails/version.rb +3 -0
  10. data/materialize-rails.gemspec +25 -0
  11. data/vendor/assets/fonts/materialize/material-design-icons/LICENSE.txt +428 -0
  12. data/vendor/assets/fonts/materialize/material-design-icons/Material-Design-Icons.eot +0 -0
  13. data/vendor/assets/fonts/materialize/material-design-icons/Material-Design-Icons.svg +769 -0
  14. data/vendor/assets/fonts/materialize/material-design-icons/Material-Design-Icons.ttf +0 -0
  15. data/vendor/assets/fonts/materialize/material-design-icons/Material-Design-Icons.woff +0 -0
  16. data/vendor/assets/fonts/materialize/material-design-icons/Material-Design-Icons.woff2 +0 -0
  17. data/vendor/assets/fonts/materialize/roboto/Roboto-Bold.eot +0 -0
  18. data/vendor/assets/fonts/materialize/roboto/Roboto-Bold.ttf +0 -0
  19. data/vendor/assets/fonts/materialize/roboto/Roboto-Bold.woff +0 -0
  20. data/vendor/assets/fonts/materialize/roboto/Roboto-Bold.woff2 +0 -0
  21. data/vendor/assets/fonts/materialize/roboto/Roboto-Light.eot +0 -0
  22. data/vendor/assets/fonts/materialize/roboto/Roboto-Light.ttf +0 -0
  23. data/vendor/assets/fonts/materialize/roboto/Roboto-Light.woff +0 -0
  24. data/vendor/assets/fonts/materialize/roboto/Roboto-Light.woff2 +0 -0
  25. data/vendor/assets/fonts/materialize/roboto/Roboto-Medium.eot +0 -0
  26. data/vendor/assets/fonts/materialize/roboto/Roboto-Medium.ttf +0 -0
  27. data/vendor/assets/fonts/materialize/roboto/Roboto-Medium.woff +0 -0
  28. data/vendor/assets/fonts/materialize/roboto/Roboto-Medium.woff2 +0 -0
  29. data/vendor/assets/fonts/materialize/roboto/Roboto-Regular.eot +0 -0
  30. data/vendor/assets/fonts/materialize/roboto/Roboto-Regular.ttf +0 -0
  31. data/vendor/assets/fonts/materialize/roboto/Roboto-Regular.woff +0 -0
  32. data/vendor/assets/fonts/materialize/roboto/Roboto-Regular.woff2 +0 -0
  33. data/vendor/assets/fonts/materialize/roboto/Roboto-Thin.eot +0 -0
  34. data/vendor/assets/fonts/materialize/roboto/Roboto-Thin.ttf +0 -0
  35. data/vendor/assets/fonts/materialize/roboto/Roboto-Thin.woff +0 -0
  36. data/vendor/assets/fonts/materialize/roboto/Roboto-Thin.woff2 +0 -0
  37. data/vendor/assets/javascripts/materialize.js +30 -0
  38. data/vendor/assets/javascripts/materialize/animation.js +9 -0
  39. data/vendor/assets/javascripts/materialize/buttons.js +91 -0
  40. data/vendor/assets/javascripts/materialize/cards.js +29 -0
  41. data/vendor/assets/javascripts/materialize/carousel.js +350 -0
  42. data/vendor/assets/javascripts/materialize/character_counter.js +59 -0
  43. data/vendor/assets/javascripts/materialize/chips.js +9 -0
  44. data/vendor/assets/javascripts/materialize/collapsible.js +137 -0
  45. data/vendor/assets/javascripts/materialize/date_picker/picker.date.js +1430 -0
  46. data/vendor/assets/javascripts/materialize/date_picker/picker.js +1123 -0
  47. data/vendor/assets/javascripts/materialize/dropdown.js +228 -0
  48. data/vendor/assets/javascripts/materialize/forms.js +581 -0
  49. data/vendor/assets/javascripts/materialize/global.js +45 -0
  50. data/vendor/assets/javascripts/materialize/hammer.min.js +1 -0
  51. data/vendor/assets/javascripts/materialize/initial.js +11 -0
  52. data/vendor/assets/javascripts/materialize/jquery.easing.1.3.js +205 -0
  53. data/vendor/assets/javascripts/materialize/jquery.hammer.js +33 -0
  54. data/vendor/assets/javascripts/materialize/leanModal.js +178 -0
  55. data/vendor/assets/javascripts/materialize/materialbox.js +269 -0
  56. data/vendor/assets/javascripts/materialize/parallax.js +58 -0
  57. data/vendor/assets/javascripts/materialize/pushpin.js +62 -0
  58. data/vendor/assets/javascripts/materialize/scrollFire.js +44 -0
  59. data/vendor/assets/javascripts/materialize/scrollspy.js +285 -0
  60. data/vendor/assets/javascripts/materialize/sideNav.js +315 -0
  61. data/vendor/assets/javascripts/materialize/slider.js +321 -0
  62. data/vendor/assets/javascripts/materialize/tabs.js +129 -0
  63. data/vendor/assets/javascripts/materialize/toasts.js +136 -0
  64. data/vendor/assets/javascripts/materialize/tooltip.js +203 -0
  65. data/vendor/assets/javascripts/materialize/transitions.js +154 -0
  66. data/vendor/assets/javascripts/materialize/velocity.min.js +5 -0
  67. data/vendor/assets/javascripts/materialize/waves.js +338 -0
  68. data/vendor/assets/stylesheets/components/_buttons.scss +181 -0
  69. data/vendor/assets/stylesheets/components/_cards.scss +134 -0
  70. data/vendor/assets/stylesheets/components/_carousel.scss +34 -0
  71. data/vendor/assets/stylesheets/components/_chips.scss +27 -0
  72. data/vendor/assets/stylesheets/components/_collapsible.scss +85 -0
  73. data/vendor/assets/stylesheets/components/_color.scss +412 -0
  74. data/vendor/assets/stylesheets/components/_dropdown.scss +57 -0
  75. data/vendor/assets/stylesheets/components/_form.scss +918 -0
  76. data/vendor/assets/stylesheets/components/_global.scss +766 -0
  77. data/vendor/assets/stylesheets/components/_grid.scss +146 -0
  78. data/vendor/assets/stylesheets/components/_icons-material-design.scss +3263 -0
  79. data/vendor/assets/stylesheets/components/_materialbox.scss +42 -0
  80. data/vendor/assets/stylesheets/components/_mixins.scss +5 -0
  81. data/vendor/assets/stylesheets/components/_modal.scss +90 -0
  82. data/vendor/assets/stylesheets/components/_navbar.scss +171 -0
  83. data/vendor/assets/stylesheets/components/_normalize.scss +427 -0
  84. data/vendor/assets/stylesheets/components/_prefixer.scss +384 -0
  85. data/vendor/assets/stylesheets/components/_preloader.scss +334 -0
  86. data/vendor/assets/stylesheets/components/_roboto.scss +49 -0
  87. data/vendor/assets/stylesheets/components/_sideNav.scss +112 -0
  88. data/vendor/assets/stylesheets/components/_slider.scss +92 -0
  89. data/vendor/assets/stylesheets/components/_table_of_contents.scss +33 -0
  90. data/vendor/assets/stylesheets/components/_tabs.scss +56 -0
  91. data/vendor/assets/stylesheets/components/_toast.scss +65 -0
  92. data/vendor/assets/stylesheets/components/_tooltip.scss +33 -0
  93. data/vendor/assets/stylesheets/components/_typography.scss +61 -0
  94. data/vendor/assets/stylesheets/components/_variables.scss +161 -0
  95. data/vendor/assets/stylesheets/components/_waves.scss +173 -0
  96. data/vendor/assets/stylesheets/components/date_picker/_default.date.scss +435 -0
  97. data/vendor/assets/stylesheets/components/date_picker/_default.scss +201 -0
  98. data/vendor/assets/stylesheets/components/date_picker/_default.time.scss +125 -0
  99. data/vendor/assets/stylesheets/materialize.scss +40 -0
  100. metadata +199 -0
@@ -0,0 +1,315 @@
1
+ (function ($) {
2
+
3
+ var methods = {
4
+ init : function(options) {
5
+ var defaults = {
6
+ menuWidth: 240,
7
+ edge: 'left',
8
+ closeOnClick: false
9
+ };
10
+ options = $.extend(defaults, options);
11
+
12
+ $(this).each(function(){
13
+ var $this = $(this);
14
+ var menu_id = $("#"+ $this.attr('data-activates'));
15
+
16
+ // Set to width
17
+ if (options.menuWidth != 240) {
18
+ menu_id.css('width', options.menuWidth);
19
+ }
20
+
21
+ // Add Touch Area
22
+ var dragTarget = $('<div class="drag-target"></div>');
23
+ $('body').append(dragTarget);
24
+
25
+ if (options.edge == 'left') {
26
+ menu_id.css('left', -1 * (options.menuWidth + 10));
27
+ dragTarget.css({'left': 0}); // Add Touch Area
28
+ }
29
+ else {
30
+ menu_id.addClass('right-aligned') // Change text-alignment to right
31
+ .css('right', -1 * (options.menuWidth + 10))
32
+ .css('left', '');
33
+ dragTarget.css({'right': 0}); // Add Touch Area
34
+ }
35
+
36
+ // If fixed sidenav, bring menu out
37
+ if (menu_id.hasClass('fixed')) {
38
+ if (window.innerWidth > 992) {
39
+ menu_id.css('left', 0);
40
+ }
41
+ }
42
+
43
+ // Window resize to reset on large screens fixed
44
+ if (menu_id.hasClass('fixed')) {
45
+ $(window).resize( function() {
46
+ if (window.innerWidth > 992) {
47
+ // Close menu if window is resized bigger than 992 and user has fixed sidenav
48
+ if ($('#sidenav-overlay').css('opacity') !== 0 && menuOut) {
49
+ removeMenu(true);
50
+ }
51
+ else {
52
+ menu_id.removeAttr('style');
53
+ menu_id.css('width', options.menuWidth);
54
+ }
55
+ }
56
+ else if (menuOut === false){
57
+ if (options.edge === 'left')
58
+ menu_id.css('left', -1 * (options.menuWidth + 10));
59
+ else
60
+ menu_id.css('right', -1 * (options.menuWidth + 10));
61
+ }
62
+
63
+ });
64
+ }
65
+
66
+ // if closeOnClick, then add close event for all a tags in side sideNav
67
+ if (options.closeOnClick === true) {
68
+ menu_id.on("click.itemclick", "a:not(.collapsible-header)", function(){
69
+ removeMenu();
70
+ });
71
+ }
72
+
73
+ function removeMenu(restoreNav) {
74
+ panning = false;
75
+ menuOut = false;
76
+
77
+ // Reenable scrolling
78
+ $('body').css('overflow', '');
79
+
80
+ $('#sidenav-overlay').velocity({opacity: 0}, {duration: 200, queue: false, easing: 'easeOutQuad',
81
+ complete: function() {
82
+ $(this).remove();
83
+ } });
84
+ if (options.edge === 'left') {
85
+ // Reset phantom div
86
+ dragTarget.css({width: '', right: '', left: '0'});
87
+ menu_id.velocity(
88
+ {left: -1 * (options.menuWidth + 10)},
89
+ { duration: 200,
90
+ queue: false,
91
+ easing: 'easeOutCubic',
92
+ complete: function() {
93
+ if (restoreNav === true) {
94
+ // Restore Fixed sidenav
95
+ menu_id.removeAttr('style');
96
+ menu_id.css('width', options.menuWidth);
97
+ }
98
+ }
99
+
100
+ });
101
+ }
102
+ else {
103
+ // Reset phantom div
104
+ dragTarget.css({width: '', right: '0', left: ''});
105
+ menu_id.velocity(
106
+ {right: -1 * (options.menuWidth + 10)},
107
+ { duration: 200,
108
+ queue: false,
109
+ easing: 'easeOutCubic',
110
+ complete: function() {
111
+ if (restoreNav === true) {
112
+ // Restore Fixed sidenav
113
+ menu_id.removeAttr('style');
114
+ menu_id.css('width', options.menuWidth);
115
+ }
116
+ }
117
+ });
118
+ }
119
+ }
120
+
121
+
122
+
123
+ // Touch Event
124
+ var panning = false;
125
+ var menuOut = false;
126
+
127
+ dragTarget.on('click', function(){
128
+ removeMenu();
129
+ });
130
+
131
+ dragTarget.hammer({
132
+ prevent_default: false
133
+ }).bind('pan', function(e) {
134
+
135
+ if (e.gesture.pointerType == "touch") {
136
+
137
+ var direction = e.gesture.direction;
138
+ var x = e.gesture.center.x;
139
+ var y = e.gesture.center.y;
140
+ var velocityX = e.gesture.velocityX;
141
+
142
+ // Disable Scrolling
143
+ $('body').css('overflow', 'hidden');
144
+
145
+ // If overlay does not exist, create one and if it is clicked, close menu
146
+ if ($('#sidenav-overlay').length === 0) {
147
+ var overlay = $('<div id="sidenav-overlay"></div>');
148
+ overlay.css('opacity', 0).click( function(){
149
+ removeMenu();
150
+ });
151
+ $('body').append(overlay);
152
+ }
153
+
154
+ // Keep within boundaries
155
+ if (options.edge === 'left') {
156
+ if (x > options.menuWidth) { x = options.menuWidth; }
157
+ else if (x < 0) { x = 0; }
158
+ }
159
+
160
+ if (options.edge === 'left') {
161
+ // Left Direction
162
+ if (x < (options.menuWidth / 2)) { menuOut = false; }
163
+ // Right Direction
164
+ else if (x >= (options.menuWidth / 2)) { menuOut = true; }
165
+
166
+ menu_id.css('left', (x - options.menuWidth));
167
+ }
168
+ else {
169
+ // Left Direction
170
+ if (x < (window.innerWidth - options.menuWidth / 2)) {
171
+ menuOut = true;
172
+ }
173
+ // Right Direction
174
+ else if (x >= (window.innerWidth - options.menuWidth / 2)) {
175
+ menuOut = false;
176
+ }
177
+ var rightPos = -1 *(x - options.menuWidth / 2);
178
+ if (rightPos > 0) {
179
+ rightPos = 0;
180
+ }
181
+
182
+ menu_id.css('right', rightPos);
183
+ }
184
+
185
+
186
+
187
+
188
+ // Percentage overlay
189
+ var overlayPerc;
190
+ if (options.edge === 'left') {
191
+ overlayPerc = x / options.menuWidth;
192
+ $('#sidenav-overlay').velocity({opacity: overlayPerc }, {duration: 50, queue: false, easing: 'easeOutQuad'});
193
+ }
194
+ else {
195
+ overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
196
+ $('#sidenav-overlay').velocity({opacity: overlayPerc }, {duration: 50, queue: false, easing: 'easeOutQuad'});
197
+ }
198
+ }
199
+
200
+ }).bind('panend', function(e) {
201
+
202
+ if (e.gesture.pointerType == "touch") {
203
+ var velocityX = e.gesture.velocityX;
204
+ panning = false;
205
+ if (options.edge === 'left') {
206
+ // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
207
+ if ((menuOut && velocityX <= 0.3) || velocityX < -0.5) {
208
+ menu_id.velocity({left: 0}, {duration: 300, queue: false, easing: 'easeOutQuad'});
209
+ $('#sidenav-overlay').velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
210
+ dragTarget.css({width: '50%', right: 0, left: ''});
211
+ }
212
+ else if (!menuOut || velocityX > 0.3) {
213
+ // Enable Scrolling
214
+ $('body').css('overflow', '');
215
+ // Slide menu closed
216
+ menu_id.velocity({left: -1 * (options.menuWidth + 10)}, {duration: 200, queue: false, easing: 'easeOutQuad'});
217
+ $('#sidenav-overlay').velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
218
+ complete: function () {
219
+ $(this).remove();
220
+ }});
221
+ dragTarget.css({width: '10px', right: '', left: 0});
222
+ }
223
+ }
224
+ else {
225
+ if ((menuOut && velocityX >= -0.3) || velocityX > 0.5) {
226
+ menu_id.velocity({right: 0}, {duration: 300, queue: false, easing: 'easeOutQuad'});
227
+ $('#sidenav-overlay').velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
228
+ dragTarget.css({width: '50%', right: '', left: 0});
229
+ }
230
+ else if (!menuOut || velocityX < -0.3) {
231
+ // Enable Scrolling
232
+ $('body').css('overflow', '');
233
+ // Slide menu closed
234
+ menu_id.velocity({right: -1 * (options.menuWidth + 10)}, {duration: 200, queue: false, easing: 'easeOutQuad'});
235
+ $('#sidenav-overlay').velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
236
+ complete: function () {
237
+ $(this).remove();
238
+ }});
239
+ dragTarget.css({width: '10px', right: 0, left: ''});
240
+ }
241
+ }
242
+
243
+ }
244
+ });
245
+
246
+ $this.click(function() {
247
+ if (menuOut === true) {
248
+ menuOut = false;
249
+ panning = false;
250
+ removeMenu();
251
+ }
252
+ else {
253
+
254
+ // Disable Scrolling
255
+ $('body').css('overflow', 'hidden');
256
+ // Push current drag target on top of DOM tree
257
+ $('body').append(dragTarget);
258
+
259
+ if (options.edge === 'left') {
260
+ dragTarget.css({width: '50%', right: 0, left: ''});
261
+ menu_id.velocity({left: 0}, {duration: 300, queue: false, easing: 'easeOutQuad'});
262
+ }
263
+ else {
264
+ dragTarget.css({width: '50%', right: '', left: 0});
265
+ menu_id.velocity({right: 0}, {duration: 300, queue: false, easing: 'easeOutQuad'});
266
+ menu_id.css('left','');
267
+ }
268
+
269
+ var overlay = $('<div id="sidenav-overlay"></div>');
270
+ overlay.css('opacity', 0)
271
+ .click(function(){
272
+ menuOut = false;
273
+ panning = false;
274
+ removeMenu();
275
+ overlay.velocity({opacity: 0}, {duration: 300, queue: false, easing: 'easeOutQuad',
276
+ complete: function() {
277
+ $(this).remove();
278
+ } });
279
+
280
+ });
281
+ $('body').append(overlay);
282
+ overlay.velocity({opacity: 1}, {duration: 300, queue: false, easing: 'easeOutQuad',
283
+ complete: function () {
284
+ menuOut = true;
285
+ panning = false;
286
+ }
287
+ });
288
+ }
289
+
290
+ return false;
291
+ });
292
+ });
293
+
294
+
295
+ },
296
+ show : function() {
297
+ this.trigger('click');
298
+ },
299
+ hide : function() {
300
+ $('#sidenav-overlay').trigger('click');
301
+ }
302
+ };
303
+
304
+
305
+ $.fn.sideNav = function(methodOrOptions) {
306
+ if ( methods[methodOrOptions] ) {
307
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
308
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
309
+ // Default to "init"
310
+ return methods.init.apply( this, arguments );
311
+ } else {
312
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.sideNav' );
313
+ }
314
+ }; // Plugin end
315
+ }( jQuery ));
@@ -0,0 +1,321 @@
1
+ (function ($) {
2
+
3
+ var methods = {
4
+
5
+ init : function(options) {
6
+ var defaults = {
7
+ indicators: true,
8
+ height: 400,
9
+ transition: 500,
10
+ interval: 6000
11
+ };
12
+ options = $.extend(defaults, options);
13
+
14
+ return this.each(function() {
15
+
16
+ // For each slider, we want to keep track of
17
+ // which slide is active and its associated content
18
+ var $this = $(this);
19
+ var $slider = $this.find('ul.slides').first();
20
+ var $slides = $slider.find('li');
21
+ var $active_index = $slider.find('.active').index();
22
+ var $active, $indicators, $interval;
23
+ if ($active_index != -1) { $active = $slides.eq($active_index); }
24
+
25
+ // Transitions the caption depending on alignment
26
+ function captionTransition(caption, duration) {
27
+ if (caption.hasClass("center-align")) {
28
+ caption.velocity({opacity: 0, translateY: -100}, {duration: duration, queue: false});
29
+ }
30
+ else if (caption.hasClass("right-align")) {
31
+ caption.velocity({opacity: 0, translateX: 100}, {duration: duration, queue: false});
32
+ }
33
+ else if (caption.hasClass("left-align")) {
34
+ caption.velocity({opacity: 0, translateX: -100}, {duration: duration, queue: false});
35
+ }
36
+ }
37
+
38
+ // This function will transition the slide to any index of the next slide
39
+ function moveToSlide(index) {
40
+ // Wrap around indices.
41
+ if (index >= $slides.length) index = 0;
42
+ else if (index < 0) index = $slides.length -1;
43
+
44
+ $active_index = $slider.find('.active').index();
45
+
46
+ // Only do if index changes
47
+ if ($active_index != index) {
48
+ $active = $slides.eq($active_index);
49
+ $caption = $active.find('.caption');
50
+
51
+ $active.removeClass('active');
52
+ $active.velocity({opacity: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad',
53
+ complete: function() {
54
+ $slides.not('.active').velocity({opacity: 0, translateX: 0, translateY: 0}, {duration: 0, queue: false});
55
+ } });
56
+ captionTransition($caption, options.transition);
57
+
58
+
59
+ // Update indicators
60
+ if (options.indicators) {
61
+ $indicators.eq($active_index).removeClass('active');
62
+ }
63
+
64
+ $slides.eq(index).velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
65
+ $slides.eq(index).find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad'});
66
+ $slides.eq(index).addClass('active');
67
+
68
+
69
+ // Update indicators
70
+ if (options.indicators) {
71
+ $indicators.eq(index).addClass('active');
72
+ }
73
+ }
74
+ }
75
+
76
+ // Set height of slider
77
+ // If fullscreen, do nothing
78
+ if (!$this.hasClass('fullscreen')) {
79
+ if (options.indicators) {
80
+ // Add height if indicators are present
81
+ $this.height(options.height + 40);
82
+ }
83
+ else {
84
+ $this.height(options.height);
85
+ }
86
+ $slider.height(options.height);
87
+ }
88
+
89
+
90
+ // Set initial positions of captions
91
+ $slides.find('.caption').each(function () {
92
+ captionTransition($(this), 0);
93
+ });
94
+
95
+ // Move img src into background-image
96
+ $slides.find('img').each(function () {
97
+ var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
98
+ if ($(this).attr('src') !== placeholderBase64) {
99
+ $(this).css('background-image', 'url(' + $(this).attr('src') + ')' );
100
+ $(this).attr('src', placeholderBase64);
101
+ }
102
+ });
103
+
104
+ // dynamically add indicators
105
+ if (options.indicators) {
106
+ $indicators = $('<ul class="indicators"></ul>');
107
+ $slides.each(function( index ) {
108
+ var $indicator = $('<li class="indicator-item"></li>');
109
+
110
+ // Handle clicks on indicators
111
+ $indicator.click(function () {
112
+ var $parent = $slider.parent();
113
+ var curr_index = $parent.find($(this)).index();
114
+ moveToSlide(curr_index);
115
+
116
+ // reset interval
117
+ clearInterval($interval);
118
+ $interval = setInterval(
119
+ function(){
120
+ $active_index = $slider.find('.active').index();
121
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
122
+ else $active_index += 1;
123
+
124
+ moveToSlide($active_index);
125
+
126
+ }, options.transition + options.interval
127
+ );
128
+ });
129
+ $indicators.append($indicator);
130
+ });
131
+ $this.append($indicators);
132
+ $indicators = $this.find('ul.indicators').find('li.indicator-item');
133
+ }
134
+
135
+ if ($active) {
136
+ $active.show();
137
+ }
138
+ else {
139
+ $slides.first().addClass('active').velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
140
+
141
+ $active_index = 0;
142
+ $active = $slides.eq($active_index);
143
+
144
+ // Update indicators
145
+ if (options.indicators) {
146
+ $indicators.eq($active_index).addClass('active');
147
+ }
148
+ }
149
+
150
+ // Adjust height to current slide
151
+ $active.find('img').each(function() {
152
+ $active.find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
153
+ });
154
+
155
+ // auto scroll
156
+ $interval = setInterval(
157
+ function(){
158
+ $active_index = $slider.find('.active').index();
159
+ moveToSlide($active_index + 1);
160
+
161
+ }, options.transition + options.interval
162
+ );
163
+
164
+
165
+ // HammerJS, Swipe navigation
166
+
167
+ // Touch Event
168
+ var panning = false;
169
+ var swipeLeft = false;
170
+ var swipeRight = false;
171
+
172
+ $this.hammer({
173
+ prevent_default: false
174
+ }).bind('pan', function(e) {
175
+ if (e.gesture.pointerType === "touch") {
176
+
177
+ // reset interval
178
+ clearInterval($interval);
179
+
180
+ var direction = e.gesture.direction;
181
+ var x = e.gesture.deltaX;
182
+ var velocityX = e.gesture.velocityX;
183
+
184
+ $curr_slide = $slider.find('.active');
185
+ $curr_slide.velocity({ translateX: x
186
+ }, {duration: 50, queue: false, easing: 'easeOutQuad'});
187
+
188
+ // Swipe Left
189
+ if (direction === 4 && (x > ($this.innerWidth() / 2) || velocityX < -0.65)) {
190
+ swipeRight = true;
191
+ }
192
+ // Swipe Right
193
+ else if (direction === 2 && (x < (-1 * $this.innerWidth() / 2) || velocityX > 0.65)) {
194
+ swipeLeft = true;
195
+ }
196
+
197
+ // Make Slide Behind active slide visible
198
+ var next_slide;
199
+ if (swipeLeft) {
200
+ next_slide = $curr_slide.next();
201
+ if (next_slide.length === 0) {
202
+ next_slide = $slides.first();
203
+ }
204
+ next_slide.velocity({ opacity: 1
205
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
206
+ }
207
+ if (swipeRight) {
208
+ next_slide = $curr_slide.prev();
209
+ if (next_slide.length === 0) {
210
+ next_slide = $slides.last();
211
+ }
212
+ next_slide.velocity({ opacity: 1
213
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
214
+ }
215
+
216
+
217
+ }
218
+
219
+ }).bind('panend', function(e) {
220
+ if (e.gesture.pointerType === "touch") {
221
+
222
+ $curr_slide = $slider.find('.active');
223
+ panning = false;
224
+ curr_index = $slider.find('.active').index();
225
+
226
+ if (!swipeRight && !swipeLeft) {
227
+ // Return to original spot
228
+ $curr_slide.velocity({ translateX: 0
229
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
230
+ }
231
+ else if (swipeLeft) {
232
+ moveToSlide(curr_index + 1);
233
+ $curr_slide.velocity({translateX: -1 * $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
234
+ complete: function() {
235
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
236
+ } });
237
+ }
238
+ else if (swipeRight) {
239
+ moveToSlide(curr_index - 1);
240
+ $curr_slide.velocity({translateX: $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
241
+ complete: function() {
242
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
243
+ } });
244
+ }
245
+ swipeLeft = false;
246
+ swipeRight = false;
247
+
248
+ // Restart interval
249
+ clearInterval($interval);
250
+ $interval = setInterval(
251
+ function(){
252
+ $active_index = $slider.find('.active').index();
253
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
254
+ else $active_index += 1;
255
+
256
+ moveToSlide($active_index);
257
+
258
+ }, options.transition + options.interval
259
+ );
260
+ }
261
+ });
262
+
263
+ $this.on('sliderPause', function() {
264
+ clearInterval($interval);
265
+ });
266
+
267
+ $this.on('sliderStart', function() {
268
+ clearInterval($interval);
269
+ $interval = setInterval(
270
+ function(){
271
+ $active_index = $slider.find('.active').index();
272
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
273
+ else $active_index += 1;
274
+
275
+ moveToSlide($active_index);
276
+
277
+ }, options.transition + options.interval
278
+ );
279
+ });
280
+
281
+ $this.on('sliderNext', function() {
282
+ $active_index = $slider.find('.active').index();
283
+ moveToSlide($active_index + 1);
284
+ });
285
+
286
+ $this.on('sliderPrev', function() {
287
+ $active_index = $slider.find('.active').index();
288
+ moveToSlide($active_index - 1);
289
+ });
290
+
291
+ });
292
+
293
+
294
+
295
+ },
296
+ pause : function() {
297
+ $(this).trigger('sliderPause');
298
+ },
299
+ start : function() {
300
+ $(this).trigger('sliderStart');
301
+ },
302
+ next : function() {
303
+ $(this).trigger('sliderNext');
304
+ },
305
+ prev : function() {
306
+ $(this).trigger('sliderPrev');
307
+ }
308
+ };
309
+
310
+
311
+ $.fn.slider = function(methodOrOptions) {
312
+ if ( methods[methodOrOptions] ) {
313
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
314
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
315
+ // Default to "init"
316
+ return methods.init.apply( this, arguments );
317
+ } else {
318
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tooltip' );
319
+ }
320
+ }; // Plugin end
321
+ }( jQuery ));