materialize-sass 0.97.8 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +1 -0
  3. data/.gitignore +1 -0
  4. data/README.md +34 -32
  5. data/Rakefile +38 -21
  6. data/assets/javascripts/materialize/anime.min.js +417 -0
  7. data/assets/javascripts/materialize/autocomplete.js +504 -0
  8. data/assets/javascripts/materialize/buttons.js +409 -0
  9. data/assets/javascripts/materialize/cards.js +34 -0
  10. data/assets/javascripts/materialize/carousel.js +797 -0
  11. data/assets/javascripts/materialize/cash.js +990 -0
  12. data/assets/javascripts/materialize/characterCounter.js +180 -0
  13. data/assets/javascripts/materialize/chips.js +564 -0
  14. data/assets/javascripts/materialize/collapsible.js +337 -0
  15. data/assets/javascripts/materialize/component.js +57 -0
  16. data/assets/javascripts/materialize/datepicker.js +935 -0
  17. data/assets/javascripts/materialize/dropdown.js +659 -0
  18. data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
  19. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
  20. data/assets/javascripts/materialize/forms.js +244 -0
  21. data/assets/javascripts/materialize/global.js +408 -0
  22. data/assets/javascripts/materialize/materialbox.js +513 -0
  23. data/assets/javascripts/materialize/modal.js +449 -0
  24. data/assets/javascripts/materialize/parallax.js +173 -0
  25. data/assets/javascripts/materialize/pushpin.js +179 -0
  26. data/assets/javascripts/materialize/range.js +310 -0
  27. data/assets/javascripts/materialize/scrollspy.js +328 -0
  28. data/assets/javascripts/materialize/select.js +497 -0
  29. data/assets/javascripts/materialize/sidenav.js +655 -0
  30. data/assets/javascripts/materialize/slider.js +424 -0
  31. data/assets/javascripts/materialize/tabs.js +476 -0
  32. data/assets/javascripts/materialize/tapTarget.js +364 -0
  33. data/assets/javascripts/materialize/timepicker.js +647 -0
  34. data/assets/javascripts/materialize/toasts.js +355 -0
  35. data/assets/javascripts/materialize/tooltip.js +351 -0
  36. data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
  37. data/{app/assets → assets}/javascripts/materialize-sprockets.js +12 -13
  38. data/assets/javascripts/materialize.js +12374 -0
  39. data/assets/stylesheets/materialize/components/_badges.scss +55 -0
  40. data/{app/assets → assets}/stylesheets/materialize/components/_buttons.scss +99 -58
  41. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +14 -6
  42. data/{app/assets → assets}/stylesheets/materialize/components/_carousel.scss +12 -7
  43. data/{app/assets → assets}/stylesheets/materialize/components/_chips.scss +13 -6
  44. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +16 -15
  45. data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
  46. data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +2 -44
  47. data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
  48. data/{app/assets → assets}/stylesheets/materialize/components/_dropdown.scss +35 -15
  49. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +96 -125
  50. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +45 -36
  51. data/{app/assets → assets}/stylesheets/materialize/components/_icons-material-design.scss +0 -0
  52. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +13 -12
  53. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +7 -3
  54. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +29 -11
  55. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  56. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +2 -2
  57. data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
  58. data/{app/assets/stylesheets/materialize/components/_sideNav.scss → assets/stylesheets/materialize/components/_sidenav.scss} +47 -47
  59. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +0 -0
  60. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
  61. data/{app/assets → assets}/stylesheets/materialize/components/_tabs.scss +10 -10
  62. data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
  63. data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +7 -14
  65. data/{app/assets → assets}/stylesheets/materialize/components/_tooltip.scss +3 -3
  66. data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
  67. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +8 -9
  68. data/{app/assets → assets}/stylesheets/materialize/components/_variables.scss +65 -29
  69. data/assets/stylesheets/materialize/components/_waves.scss +114 -0
  70. data/{app/assets → assets}/stylesheets/materialize/components/forms/_checkboxes.scss +26 -46
  71. data/{app/assets → assets}/stylesheets/materialize/components/forms/_file-input.scss +6 -0
  72. data/{app/assets → assets}/stylesheets/materialize/components/forms/_forms.scss +0 -0
  73. data/{app/assets → assets}/stylesheets/materialize/components/forms/_input-fields.scss +131 -63
  74. data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
  75. data/{app/assets → assets}/stylesheets/materialize/components/forms/_range.scss +35 -33
  76. data/{app/assets → assets}/stylesheets/materialize/components/forms/_select.scss +88 -19
  77. data/{app/assets → assets}/stylesheets/materialize/components/forms/_switches.scss +32 -21
  78. data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
  79. data/{app/assets → assets}/stylesheets/materialize.scss +10 -9
  80. data/lib/materialize-sass/engine.rb +9 -7
  81. data/lib/materialize-sass/helpers.rb +38 -0
  82. data/lib/materialize-sass/version.rb +1 -1
  83. data/lib/materialize-sass.rb +13 -28
  84. data/materialize-sass.gemspec +5 -5
  85. metadata +97 -119
  86. data/app/assets/fonts/roboto/Roboto-Bold.eot +0 -0
  87. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  88. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  89. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  90. data/app/assets/fonts/roboto/Roboto-Light.eot +0 -0
  91. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  92. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  93. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  94. data/app/assets/fonts/roboto/Roboto-Medium.eot +0 -0
  95. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  96. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  97. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  98. data/app/assets/fonts/roboto/Roboto-Regular.eot +0 -0
  99. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  100. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  101. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  102. data/app/assets/fonts/roboto/Roboto-Thin.eot +0 -0
  103. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  104. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  105. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  106. data/app/assets/javascripts/materialize/animation.js +0 -9
  107. data/app/assets/javascripts/materialize/buttons.js +0 -267
  108. data/app/assets/javascripts/materialize/cards.js +0 -26
  109. data/app/assets/javascripts/materialize/carousel.js +0 -454
  110. data/app/assets/javascripts/materialize/character_counter.js +0 -72
  111. data/app/assets/javascripts/materialize/chips.js +0 -289
  112. data/app/assets/javascripts/materialize/collapsible.js +0 -160
  113. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
  114. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
  115. data/app/assets/javascripts/materialize/dropdown.js +0 -265
  116. data/app/assets/javascripts/materialize/extras/nouislider.js +0 -1666
  117. data/app/assets/javascripts/materialize/extras/nouislider.min.js +0 -1
  118. data/app/assets/javascripts/materialize/forms.js +0 -682
  119. data/app/assets/javascripts/materialize/global.js +0 -98
  120. data/app/assets/javascripts/materialize/hammer.min.js +0 -1
  121. data/app/assets/javascripts/materialize/init.js +0 -174
  122. data/app/assets/javascripts/materialize/initial.js +0 -11
  123. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
  124. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  125. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  126. data/app/assets/javascripts/materialize/materialbox.js +0 -269
  127. data/app/assets/javascripts/materialize/modal.js +0 -184
  128. data/app/assets/javascripts/materialize/parallax.js +0 -58
  129. data/app/assets/javascripts/materialize/prism.js +0 -8
  130. data/app/assets/javascripts/materialize/pushpin.js +0 -71
  131. data/app/assets/javascripts/materialize/scrollFire.js +0 -48
  132. data/app/assets/javascripts/materialize/scrollspy.js +0 -284
  133. data/app/assets/javascripts/materialize/sideNav.js +0 -370
  134. data/app/assets/javascripts/materialize/slider.js +0 -321
  135. data/app/assets/javascripts/materialize/tabs.js +0 -164
  136. data/app/assets/javascripts/materialize/toasts.js +0 -137
  137. data/app/assets/javascripts/materialize/tooltip.js +0 -236
  138. data/app/assets/javascripts/materialize/transitions.js +0 -169
  139. data/app/assets/javascripts/materialize/velocity.min.js +0 -5
  140. data/app/assets/javascripts/materialize.js +0 -5
  141. data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
  142. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -424
  143. data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -384
  144. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -49
  145. data/app/assets/stylesheets/materialize/components/_waves.scss +0 -177
  146. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
  147. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
  148. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
  149. data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +0 -117
  150. data/app/assets/stylesheets/materialize/extras/nouislider.css +0 -259
@@ -1,321 +0,0 @@
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 || $slides.length <=1) {
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 ));
@@ -1,164 +0,0 @@
1
- (function ($) {
2
-
3
- var methods = {
4
- init : function(options) {
5
- var defaults = {
6
- onShow: null
7
- };
8
- options = $.extend(defaults, options);
9
-
10
- return this.each(function() {
11
-
12
- // For each set of tabs, we want to keep track of
13
- // which tab is active and its associated content
14
- var $this = $(this),
15
- window_width = $(window).width();
16
-
17
- var $active, $content, $links = $this.find('li.tab a'),
18
- $tabs_width = $this.width(),
19
- $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length,
20
- $index = 0;
21
-
22
- // Finds right attribute for indicator based on active tab.
23
- // el: jQuery Object
24
- var calcRightPos = function(el) {
25
- return $tabs_width - el.position().left - el.outerWidth() - $this.scrollLeft();
26
- };
27
-
28
- // Finds left attribute for indicator based on active tab.
29
- // el: jQuery Object
30
- var calcLeftPos = function(el) {
31
- return el.position().left + $this.scrollLeft();
32
- };
33
-
34
- // If the location.hash matches one of the links, use that as the active tab.
35
- $active = $($links.filter('[href="'+location.hash+'"]'));
36
-
37
- // If no match is found, use the first link or any with class 'active' as the initial active tab.
38
- if ($active.length === 0) {
39
- $active = $(this).find('li.tab a.active').first();
40
- }
41
- if ($active.length === 0) {
42
- $active = $(this).find('li.tab a').first();
43
- }
44
-
45
- $active.addClass('active');
46
- $index = $links.index($active);
47
- if ($index < 0) {
48
- $index = 0;
49
- }
50
-
51
- if ($active[0] !== undefined) {
52
- $content = $($active[0].hash);
53
- }
54
-
55
- // append indicator then set indicator width to tab width
56
- $this.append('<div class="indicator"></div>');
57
- var $indicator = $this.find('.indicator');
58
- if ($this.is(":visible")) {
59
- // $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
60
- // $indicator.css({"left": $index * $tab_width});
61
- setTimeout(function() {
62
- $indicator.css({"right": calcRightPos($active) });
63
- $indicator.css({"left": calcLeftPos($active) });
64
- }, 0);
65
- }
66
- $(window).resize(function () {
67
- $tabs_width = $this.width();
68
- $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
69
- if ($index < 0) {
70
- $index = 0;
71
- }
72
- if ($tab_width !== 0 && $tabs_width !== 0) {
73
- $indicator.css({"right": calcRightPos($active) });
74
- $indicator.css({"left": calcLeftPos($active) });
75
- }
76
- });
77
-
78
- // Hide the remaining content
79
- $links.not($active).each(function () {
80
- $(Materialize.escapeHash(this.hash)).hide();
81
- });
82
-
83
-
84
- // Bind the click event handler
85
- $this.on('click', 'a', function(e) {
86
- if ($(this).parent().hasClass('disabled')) {
87
- e.preventDefault();
88
- return;
89
- }
90
-
91
- // Act as regular link if target attribute is specified.
92
- if (!!$(this).attr("target")) {
93
- return;
94
- }
95
-
96
- $tabs_width = $this.width();
97
- $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
98
-
99
- // Make the old tab inactive.
100
- $active.removeClass('active');
101
- if ($content !== undefined) {
102
- $content.hide();
103
- }
104
-
105
- // Update the variables with the new link and content
106
- $active = $(this);
107
- $content = $(Materialize.escapeHash(this.hash));
108
- $links = $this.find('li.tab a');
109
- var activeRect = $active.position();
110
-
111
- // Make the tab active.
112
- $active.addClass('active');
113
- var $prev_index = $index;
114
- $index = $links.index($(this));
115
- if ($index < 0) {
116
- $index = 0;
117
- }
118
- // Change url to current tab
119
- // window.location.hash = $active.attr('href');
120
-
121
- if ($content !== undefined) {
122
- $content.show();
123
- if (typeof(options.onShow) === "function") {
124
- options.onShow.call(this, $content);
125
- }
126
- }
127
-
128
- // Update indicator
129
-
130
- if (($index - $prev_index) >= 0) {
131
- $indicator.velocity({"right": calcRightPos($active) }, { duration: 300, queue: false, easing: 'easeOutQuad'});
132
- $indicator.velocity({"left": calcLeftPos($active) }, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
133
-
134
- } else {
135
- $indicator.velocity({"left": calcLeftPos($active) }, { duration: 300, queue: false, easing: 'easeOutQuad'});
136
- $indicator.velocity({"right": calcRightPos($active) }, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
137
- }
138
-
139
- // Prevent the anchor's default click action
140
- e.preventDefault();
141
- });
142
- });
143
-
144
- },
145
- select_tab : function( id ) {
146
- this.find('a[href="#' + id + '"]').trigger('click');
147
- }
148
- };
149
-
150
- $.fn.tabs = function(methodOrOptions) {
151
- if ( methods[methodOrOptions] ) {
152
- return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
153
- } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
154
- // Default to "init"
155
- return methods.init.apply( this, arguments );
156
- } else {
157
- $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tabs' );
158
- }
159
- };
160
-
161
- $(document).on('turbolinks:load', function(){
162
- $('ul.tabs').tabs();
163
- });
164
- }( jQuery ));
@@ -1,137 +0,0 @@
1
- Materialize.toast = function (message, displayLength, className, completeCallback) {
2
- className = className || "";
3
-
4
- var container = document.getElementById('toast-container');
5
-
6
- // Create toast container if it does not exist
7
- if (container === null) {
8
- // create notification container
9
- container = document.createElement('div');
10
- container.id = 'toast-container';
11
- document.body.appendChild(container);
12
- }
13
-
14
- // Select and append toast
15
- var newToast = createToast(message);
16
-
17
- // only append toast if message is not undefined
18
- if(message){
19
- container.appendChild(newToast);
20
- }
21
-
22
- newToast.style.top = '35px';
23
- newToast.style.opacity = 0;
24
-
25
- // Animate toast in
26
- Vel(newToast, { "top" : "0px", opacity: 1 }, {duration: 300,
27
- easing: 'easeOutCubic',
28
- queue: false});
29
-
30
- // Allows timer to be pause while being panned
31
- var timeLeft = displayLength;
32
- var counterInterval;
33
- if (timeLeft != null) {
34
- counterInterval = setInterval (function(){
35
- if (newToast.parentNode === null)
36
- window.clearInterval(counterInterval);
37
-
38
- // If toast is not being dragged, decrease its time remaining
39
- if (!newToast.classList.contains('panning')) {
40
- timeLeft -= 20;
41
- }
42
-
43
- if (timeLeft <= 0) {
44
- // Animate toast out
45
- Vel(newToast, {"opacity": 0, marginTop: '-40px'}, { duration: 375,
46
- easing: 'easeOutExpo',
47
- queue: false,
48
- complete: function(){
49
- // Call the optional callback
50
- if(typeof(completeCallback) === "function")
51
- completeCallback();
52
- // Remove toast after it times out
53
- this[0].parentNode.removeChild(this[0]);
54
- }
55
- });
56
- window.clearInterval(counterInterval);
57
- }
58
- }, 20);
59
- }
60
-
61
-
62
-
63
- function createToast(html) {
64
-
65
- // Create toast
66
- var toast = document.createElement('div');
67
- toast.classList.add('toast');
68
- if (className) {
69
- var classes = className.split(' ');
70
-
71
- for (var i = 0, count = classes.length; i < count; i++) {
72
- toast.classList.add(classes[i]);
73
- }
74
- }
75
- // If type of parameter is HTML Element
76
- if ( typeof HTMLElement === "object" ? html instanceof HTMLElement : html && typeof html === "object" && html !== null && html.nodeType === 1 && typeof html.nodeName==="string"
77
- ) {
78
- toast.appendChild(html);
79
- }
80
- else if (html instanceof jQuery) {
81
- // Check if it is jQuery object
82
- toast.appendChild(html[0]);
83
- }
84
- else {
85
- // Insert as text;
86
- toast.innerHTML = html;
87
- }
88
- // Bind hammer
89
- var hammerHandler = new Hammer(toast, {prevent_default: false});
90
- hammerHandler.on('pan', function(e) {
91
- var deltaX = e.deltaX;
92
- var activationDistance = 80;
93
-
94
- // Change toast state
95
- if (!toast.classList.contains('panning')){
96
- toast.classList.add('panning');
97
- }
98
-
99
- var opacityPercent = 1-Math.abs(deltaX / activationDistance);
100
- if (opacityPercent < 0)
101
- opacityPercent = 0;
102
-
103
- Vel(toast, {left: deltaX, opacity: opacityPercent }, {duration: 50, queue: false, easing: 'easeOutQuad'});
104
-
105
- });
106
-
107
- hammerHandler.on('panend', function(e) {
108
- var deltaX = e.deltaX;
109
- var activationDistance = 80;
110
-
111
- // If toast dragged past activation point
112
- if (Math.abs(deltaX) > activationDistance) {
113
- Vel(toast, {marginTop: '-40px'}, { duration: 375,
114
- easing: 'easeOutExpo',
115
- queue: false,
116
- complete: function(){
117
- if(typeof(completeCallback) === "function") {
118
- completeCallback();
119
- }
120
- toast.parentNode.removeChild(toast);
121
- }
122
- });
123
-
124
- } else {
125
- toast.classList.remove('panning');
126
- // Put toast back into original position
127
- Vel(toast, { left: 0, opacity: 1 }, { duration: 300,
128
- easing: 'easeOutExpo',
129
- queue: false
130
- });
131
-
132
- }
133
- });
134
-
135
- return toast;
136
- }
137
- };