materialize-sass 0.97.0 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +1 -0
  3. data/.gitignore +3 -0
  4. data/README.md +48 -10
  5. data/Rakefile +129 -1
  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/assets/javascripts/materialize-sprockets.js +29 -0
  38. data/assets/javascripts/materialize.js +12374 -0
  39. data/assets/stylesheets/materialize/components/_badges.scss +55 -0
  40. data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
  41. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
  42. data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
  43. data/assets/stylesheets/materialize/components/_chips.scss +90 -0
  44. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
  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} +22 -64
  47. data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
  48. data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
  50. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
  51. data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
  52. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
  53. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
  54. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
  55. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  56. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
  57. data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
  58. data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
  59. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
  61. data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
  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 +17 -22
  65. data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
  66. data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
  67. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
  68. data/assets/stylesheets/materialize/components/_variables.scss +349 -0
  69. data/assets/stylesheets/materialize/components/_waves.scss +114 -0
  70. data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
  71. data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
  72. data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
  73. data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
  74. data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
  75. data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
  76. data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
  77. data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
  78. data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
  79. data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
  80. data/lib/materialize-sass/engine.rb +11 -6
  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 -105
  86. data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
  87. data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
  88. data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
  89. data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
  90. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
  91. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
  92. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  93. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  94. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  95. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  96. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  97. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  98. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  99. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  100. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  101. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  102. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  103. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  104. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  105. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  106. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  107. data/app/assets/javascripts/materialize/animation.js +0 -9
  108. data/app/assets/javascripts/materialize/buttons.js +0 -61
  109. data/app/assets/javascripts/materialize/cards.js +0 -27
  110. data/app/assets/javascripts/materialize/character_counter.js +0 -59
  111. data/app/assets/javascripts/materialize/collapsible.js +0 -139
  112. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
  113. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
  114. data/app/assets/javascripts/materialize/dropdown.js +0 -178
  115. data/app/assets/javascripts/materialize/forms.js +0 -456
  116. data/app/assets/javascripts/materialize/global.js +0 -36
  117. data/app/assets/javascripts/materialize/hammer.min.js +0 -1
  118. data/app/assets/javascripts/materialize/init.js +0 -136
  119. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
  120. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  121. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  122. data/app/assets/javascripts/materialize/leanModal.js +0 -178
  123. data/app/assets/javascripts/materialize/materialbox.js +0 -249
  124. data/app/assets/javascripts/materialize/parallax.js +0 -58
  125. data/app/assets/javascripts/materialize/prism.js +0 -8
  126. data/app/assets/javascripts/materialize/pushpin.js +0 -62
  127. data/app/assets/javascripts/materialize/scrollFire.js +0 -44
  128. data/app/assets/javascripts/materialize/scrollspy.js +0 -284
  129. data/app/assets/javascripts/materialize/sideNav.js +0 -312
  130. data/app/assets/javascripts/materialize/slider.js +0 -301
  131. data/app/assets/javascripts/materialize/tabs.js +0 -136
  132. data/app/assets/javascripts/materialize/toasts.js +0 -125
  133. data/app/assets/javascripts/materialize/tooltip.js +0 -166
  134. data/app/assets/javascripts/materialize/transitions.js +0 -154
  135. data/app/assets/javascripts/materialize/velocity.min.js +0 -4
  136. data/app/assets/javascripts/materialize-sprockets.js +0 -27
  137. data/app/assets/javascripts/materialize.js +0 -6159
  138. data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
  139. data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
  140. data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
  141. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
  142. data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
  143. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
  144. data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
  145. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
  146. data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
  147. data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
  148. data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
  149. data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
  150. data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
  151. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
  152. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
  153. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -1,301 +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;
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
- if (index >= $slides.length) index = 0;
41
- else if (index < 0) index = $slides.length -1;
42
-
43
- $active_index = $slider.find('.active').index();
44
-
45
- // Only do if index changes
46
- if ($active_index != index) {
47
- $active = $slides.eq($active_index);
48
- $caption = $active.find('.caption');
49
-
50
- $active.removeClass('active');
51
- $active.velocity({opacity: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad',
52
- complete: function() {
53
- $slides.not('.active').velocity({opacity: 0, translateX: 0, translateY: 0}, {duration: 0, queue: false});
54
- } });
55
- captionTransition($caption, options.transition);
56
-
57
-
58
- // Update indicators
59
- if (options.indicators) {
60
- $indicators.eq($active_index).removeClass('active');
61
- }
62
-
63
- $slides.eq(index).velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
64
- $slides.eq(index).find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad'});
65
- $slides.eq(index).addClass('active');
66
-
67
-
68
- // Update indicators
69
- if (options.indicators) {
70
- $indicators.eq(index).addClass('active');
71
- }
72
- }
73
- }
74
-
75
- // Set height of slider
76
- // If fullscreen, do nothing
77
- if (!$this.hasClass('fullscreen')) {
78
- if (options.indicators) {
79
- // Add height if indicators are present
80
- $this.height(options.height + 40);
81
- }
82
- else {
83
- $this.height(options.height);
84
- }
85
- $slider.height(options.height);
86
- }
87
-
88
-
89
- // Set initial positions of captions
90
- $slides.find('.caption').each(function () {
91
- captionTransition($(this), 0);
92
- });
93
-
94
- // Move img src into background-image
95
- $slides.find('img').each(function () {
96
- $(this).css('background-image', 'url(' + $(this).attr('src') + ')' );
97
- $(this).attr('src', 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
98
- });
99
-
100
- // dynamically add indicators
101
- if (options.indicators) {
102
- var $indicators = $('<ul class="indicators"></ul>');
103
- $slides.each(function( index ) {
104
- var $indicator = $('<li class="indicator-item"></li>');
105
-
106
- // Handle clicks on indicators
107
- $indicator.click(function () {
108
- var $parent = $slider.parent();
109
- var curr_index = $parent.find($(this)).index();
110
- moveToSlide(curr_index);
111
-
112
- // reset interval
113
- clearInterval($interval);
114
- $interval = setInterval(
115
- function(){
116
- $active_index = $slider.find('.active').index();
117
- if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
118
- else $active_index += 1;
119
-
120
- moveToSlide($active_index);
121
-
122
- }, options.transition + options.interval
123
- );
124
- });
125
- $indicators.append($indicator);
126
- });
127
- $this.append($indicators);
128
- $indicators = $this.find('ul.indicators').find('li.indicator-item');
129
- }
130
-
131
- if ($active) {
132
- $active.show();
133
- }
134
- else {
135
- $slides.first().addClass('active').velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
136
-
137
- $active_index = 0;
138
- $active = $slides.eq($active_index);
139
-
140
- // Update indicators
141
- if (options.indicators) {
142
- $indicators.eq($active_index).addClass('active');
143
- }
144
- }
145
-
146
- // Adjust height to current slide
147
- $active.find('img').each(function() {
148
- $active.find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
149
- });
150
-
151
- // auto scroll
152
- $interval = setInterval(
153
- function(){
154
- $active_index = $slider.find('.active').index();
155
- moveToSlide($active_index + 1);
156
-
157
- }, options.transition + options.interval
158
- );
159
-
160
-
161
- // HammerJS, Swipe navigation
162
-
163
- // Touch Event
164
- var panning = false;
165
- var swipeLeft = false;
166
- var swipeRight = false;
167
-
168
- $this.hammer({
169
- prevent_default: false
170
- }).bind('pan', function(e) {
171
- if (e.gesture.pointerType === "touch") {
172
-
173
- // reset interval
174
- clearInterval($interval);
175
-
176
- var direction = e.gesture.direction;
177
- var x = e.gesture.deltaX;
178
- var velocityX = e.gesture.velocityX;
179
-
180
- $curr_slide = $slider.find('.active');
181
- $curr_slide.velocity({ translateX: x
182
- }, {duration: 50, queue: false, easing: 'easeOutQuad'});
183
-
184
- // Swipe Left
185
- if (direction === 4 && (x > ($this.innerWidth() / 2) || velocityX < -0.65)) {
186
- swipeRight = true;
187
- }
188
- // Swipe Right
189
- else if (direction === 2 && (x < (-1 * $this.innerWidth() / 2) || velocityX > 0.65)) {
190
- swipeLeft = true;
191
- }
192
-
193
- // Make Slide Behind active slide visible
194
- var next_slide;
195
- if (swipeLeft) {
196
- next_slide = $curr_slide.next();
197
- if (next_slide.length === 0) {
198
- next_slide = $slides.first();
199
- }
200
- next_slide.velocity({ opacity: 1
201
- }, {duration: 300, queue: false, easing: 'easeOutQuad'});
202
- }
203
- if (swipeRight) {
204
- next_slide = $curr_slide.prev();
205
- if (next_slide.length === 0) {
206
- next_slide = $slides.last();
207
- }
208
- next_slide.velocity({ opacity: 1
209
- }, {duration: 300, queue: false, easing: 'easeOutQuad'});
210
- }
211
-
212
-
213
- }
214
-
215
- }).bind('panend', function(e) {
216
- if (e.gesture.pointerType === "touch") {
217
-
218
- $curr_slide = $slider.find('.active');
219
- panning = false;
220
- curr_index = $slider.find('.active').index();
221
-
222
- if (!swipeRight && !swipeLeft) {
223
- // Return to original spot
224
- $curr_slide.velocity({ translateX: 0
225
- }, {duration: 300, queue: false, easing: 'easeOutQuad'});
226
- }
227
- else if (swipeLeft) {
228
- moveToSlide(curr_index + 1);
229
- $curr_slide.velocity({translateX: -1 * $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
230
- complete: function() {
231
- $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
232
- } });
233
- }
234
- else if (swipeRight) {
235
- moveToSlide(curr_index - 1);
236
- $curr_slide.velocity({translateX: $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
237
- complete: function() {
238
- $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
239
- } });
240
- }
241
- swipeLeft = false;
242
- swipeRight = false;
243
-
244
- // Restart interval
245
- clearInterval($interval);
246
- $interval = setInterval(
247
- function(){
248
- $active_index = $slider.find('.active').index();
249
- if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
250
- else $active_index += 1;
251
-
252
- moveToSlide($active_index);
253
-
254
- }, options.transition + options.interval
255
- );
256
- }
257
- });
258
-
259
- $this.on('sliderPause', function() {
260
- clearInterval($interval);
261
- });
262
-
263
- $this.on('sliderStart', function() {
264
- clearInterval($interval);
265
- $interval = setInterval(
266
- function(){
267
- $active_index = $slider.find('.active').index();
268
- if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
269
- else $active_index += 1;
270
-
271
- moveToSlide($active_index);
272
-
273
- }, options.transition + options.interval
274
- );
275
- });
276
-
277
- });
278
-
279
-
280
-
281
- },
282
- pause : function() {
283
- $(this).trigger('sliderPause');
284
- },
285
- start : function() {
286
- $(this).trigger('sliderStart');
287
- }
288
- };
289
-
290
-
291
- $.fn.slider = function(methodOrOptions) {
292
- if ( methods[methodOrOptions] ) {
293
- return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
294
- } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
295
- // Default to "init"
296
- return methods.init.apply( this, arguments );
297
- } else {
298
- $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tooltip' );
299
- }
300
- }; // Plugin end
301
- }( jQuery ));
@@ -1,136 +0,0 @@
1
- (function ($) {
2
-
3
- var methods = {
4
- init : function() {
5
- return this.each(function() {
6
-
7
- // For each set of tabs, we want to keep track of
8
- // which tab is active and its associated content
9
- var $this = $(this),
10
- window_width = $(window).width();
11
-
12
- $this.width('100%');
13
- // Set Tab Width for each tab
14
- var $num_tabs = $(this).children('li').length;
15
- $this.children('li').each(function() {
16
- $(this).width((100/$num_tabs)+'%');
17
- });
18
- var $active, $content, $links = $this.find('li.tab a'),
19
- $tabs_width = $this.width(),
20
- $tab_width = $this.find('li').first().outerWidth(),
21
- $index = 0;
22
-
23
- // If the location.hash matches one of the links, use that as the active tab.
24
- $active = $($links.filter('[href="'+location.hash+'"]'));
25
-
26
- // If no match is found, use the first link or any with class 'active' as the initial active tab.
27
- if ($active.length === 0) {
28
- $active = $(this).find('li.tab a.active').first();
29
- }
30
- if ($active.length === 0) {
31
- $active = $(this).find('li.tab a').first();
32
- }
33
-
34
- $active.addClass('active');
35
- $index = $links.index($active);
36
- if ($index < 0) {
37
- $index = 0;
38
- }
39
-
40
- if ($active.length) {
41
- $content = $($active[0].hash);
42
- }
43
-
44
- // append indicator then set indicator width to tab width
45
- $this.append('<div class="indicator"></div>');
46
- var $indicator = $this.find('.indicator');
47
- if ($this.is(":visible")) {
48
- $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
49
- $indicator.css({"left": $index * $tab_width});
50
- }
51
- $(window).resize(function () {
52
- $tabs_width = $this.width();
53
- $tab_width = $this.find('li').first().outerWidth();
54
- if ($index < 0) {
55
- $index = 0;
56
- }
57
- if ($tab_width !== 0 && $tabs_width !== 0) {
58
- $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
59
- $indicator.css({"left": $index * $tab_width});
60
- }
61
- });
62
-
63
- // Hide the remaining content
64
- $links.not($active).each(function () {
65
- $(this.hash).hide();
66
- });
67
-
68
-
69
- // Bind the click event handler
70
- $this.on('click', 'a', function(e){
71
- if ($(this).parent().hasClass('disabled')) {
72
- e.preventDefault();
73
- return;
74
- }
75
-
76
- $tabs_width = $this.width();
77
- $tab_width = $this.find('li').first().outerWidth();
78
-
79
- // Make the old tab inactive.
80
- $active.removeClass('active');
81
- $content.hide();
82
-
83
- // Update the variables with the new link and content
84
- $active = $(this);
85
- $content = $(this.hash);
86
- $links = $this.find('li.tab a');
87
-
88
- // Make the tab active.
89
- $active.addClass('active');
90
- var $prev_index = $index;
91
- $index = $links.index($(this));
92
- if ($index < 0) {
93
- $index = 0;
94
- }
95
- // Change url to current tab
96
- // window.location.hash = $active.attr('href');
97
-
98
- $content.show();
99
-
100
- // Update indicator
101
- if (($index - $prev_index) >= 0) {
102
- $indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, { duration: 300, queue: false, easing: 'easeOutQuad'});
103
- $indicator.velocity({"left": $index * $tab_width}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
104
-
105
- }
106
- else {
107
- $indicator.velocity({"left": $index * $tab_width}, { duration: 300, queue: false, easing: 'easeOutQuad'});
108
- $indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
109
- }
110
-
111
- // Prevent the anchor's default click action
112
- e.preventDefault();
113
- });
114
- });
115
-
116
- },
117
- select_tab : function( id ) {
118
- this.find('a[href="#' + id + '"]').trigger('click');
119
- }
120
- };
121
-
122
- $.fn.tabs = function(methodOrOptions) {
123
- if ( methods[methodOrOptions] ) {
124
- return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
125
- } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
126
- // Default to "init"
127
- return methods.init.apply( this, arguments );
128
- } else {
129
- $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tooltip' );
130
- }
131
- };
132
-
133
- $(document).ready(function(){
134
- $('ul.tabs').tabs();
135
- });
136
- }( jQuery ));
@@ -1,125 +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 = setInterval (function(){
33
-
34
-
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
- function createToast(html) {
63
-
64
- // Create toast
65
- var toast = document.createElement('div');
66
- toast.classList.add('toast');
67
- if (className) {
68
- var classes = className.split(' ');
69
-
70
- for (var i = 0, count = classes.length; i < count; i++) {
71
- toast.classList.add(classes[i]);
72
- }
73
- }
74
- toast.innerHTML = html;
75
-
76
- // Bind hammer
77
- var hammerHandler = new Hammer(toast, {prevent_default: false});
78
- hammerHandler.on('pan', function(e) {
79
- var deltaX = e.deltaX;
80
- var activationDistance = 80;
81
-
82
- // Change toast state
83
- if (!toast.classList.contains('panning')){
84
- toast.classList.add('panning');
85
- }
86
-
87
- var opacityPercent = 1-Math.abs(deltaX / activationDistance);
88
- if (opacityPercent < 0)
89
- opacityPercent = 0;
90
-
91
- Vel(toast, {left: deltaX, opacity: opacityPercent }, {duration: 50, queue: false, easing: 'easeOutQuad'});
92
-
93
- });
94
-
95
- hammerHandler.on('panend', function(e) {
96
- var deltaX = e.deltaX;
97
- var activationDistance = 80;
98
-
99
- // If toast dragged past activation point
100
- if (Math.abs(deltaX) > activationDistance) {
101
- Vel(toast, {marginTop: '-40px'}, { duration: 375,
102
- easing: 'easeOutExpo',
103
- queue: false,
104
- complete: function(){
105
- if(typeof(completeCallback) === "function") {
106
- completeCallback();
107
- }
108
- toast.parentNode.removeChild(toast);
109
- }
110
- });
111
-
112
- } else {
113
- toast.classList.remove('panning');
114
- // Put toast back into original position
115
- Vel(toast, { left: 0, opacity: 1 }, { duration: 300,
116
- easing: 'easeOutExpo',
117
- queue: false
118
- });
119
-
120
- }
121
- });
122
-
123
- return toast;
124
- }
125
- };