materialize-sass 0.95.1

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 (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +50 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/fonts/material-design-icons/LICENSE.txt +428 -0
  8. data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
  9. data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +751 -0
  10. data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
  11. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
  12. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  13. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  14. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  15. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  16. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  17. data/app/assets/javascripts/materialize-sprokets.js +21 -0
  18. data/app/assets/javascripts/materialize.js +5327 -0
  19. data/app/assets/javascripts/materialize/cards.js +19 -0
  20. data/app/assets/javascripts/materialize/collapsible.js +87 -0
  21. data/app/assets/javascripts/materialize/date_picker/picker.date.js +1427 -0
  22. data/app/assets/javascripts/materialize/date_picker/picker.js +1123 -0
  23. data/app/assets/javascripts/materialize/dropdown.js +168 -0
  24. data/app/assets/javascripts/materialize/forms.js +245 -0
  25. data/app/assets/javascripts/materialize/hammer.min.js +1 -0
  26. data/app/assets/javascripts/materialize/init.js +152 -0
  27. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +205 -0
  28. data/app/assets/javascripts/materialize/jquery.hammer.js +33 -0
  29. data/app/assets/javascripts/materialize/jquery.timeago.min.js +1 -0
  30. data/app/assets/javascripts/materialize/leanModal.js +96 -0
  31. data/app/assets/javascripts/materialize/materialbox.js +237 -0
  32. data/app/assets/javascripts/materialize/parallax.js +50 -0
  33. data/app/assets/javascripts/materialize/prism.js +8 -0
  34. data/app/assets/javascripts/materialize/pushpin.js +87 -0
  35. data/app/assets/javascripts/materialize/scrollspy.js +287 -0
  36. data/app/assets/javascripts/materialize/sideNav.js +278 -0
  37. data/app/assets/javascripts/materialize/slider.js +257 -0
  38. data/app/assets/javascripts/materialize/tabs.js +130 -0
  39. data/app/assets/javascripts/materialize/toasts.js +100 -0
  40. data/app/assets/javascripts/materialize/tooltip.js +167 -0
  41. data/app/assets/javascripts/materialize/velocity.min.js +4 -0
  42. data/app/assets/javascripts/materialize/waves.js +335 -0
  43. data/app/assets/stylesheets/components/_buttons.scss +111 -0
  44. data/app/assets/stylesheets/components/_cards.scss +121 -0
  45. data/app/assets/stylesheets/components/_collapsible.scss +78 -0
  46. data/app/assets/stylesheets/components/_color.scss +411 -0
  47. data/app/assets/stylesheets/components/_dropdown.scss +31 -0
  48. data/app/assets/stylesheets/components/_form.scss +641 -0
  49. data/app/assets/stylesheets/components/_global.scss +582 -0
  50. data/app/assets/stylesheets/components/_grid.scss +119 -0
  51. data/app/assets/stylesheets/components/_icons-material-design.scss +2247 -0
  52. data/app/assets/stylesheets/components/_materialbox.scss +42 -0
  53. data/app/assets/stylesheets/components/_mixins.scss +5 -0
  54. data/app/assets/stylesheets/components/_modal.scss +50 -0
  55. data/app/assets/stylesheets/components/_navbar.scss +129 -0
  56. data/app/assets/stylesheets/components/_normalize.scss +427 -0
  57. data/app/assets/stylesheets/components/_prefixer.scss +417 -0
  58. data/app/assets/stylesheets/components/_preloader.scss +320 -0
  59. data/app/assets/stylesheets/components/_roboto.scss +28 -0
  60. data/app/assets/stylesheets/components/_sideNav.scss +143 -0
  61. data/app/assets/stylesheets/components/_slider.scss +87 -0
  62. data/app/assets/stylesheets/components/_table_of_contents.scss +33 -0
  63. data/app/assets/stylesheets/components/_tabs.scss +43 -0
  64. data/app/assets/stylesheets/components/_toast.scss +64 -0
  65. data/app/assets/stylesheets/components/_tooltip.scss +34 -0
  66. data/app/assets/stylesheets/components/_typography.scss +55 -0
  67. data/app/assets/stylesheets/components/_variables.scss +128 -0
  68. data/app/assets/stylesheets/components/_waves.scss +167 -0
  69. data/app/assets/stylesheets/components/date_picker/_default.date.scss +431 -0
  70. data/app/assets/stylesheets/components/date_picker/_default.scss +201 -0
  71. data/app/assets/stylesheets/components/date_picker/_default.time.scss +125 -0
  72. data/app/assets/stylesheets/materialize.scss +38 -0
  73. data/lib/materialize-sass.rb +8 -0
  74. data/lib/materialize-sass/version.rb +6 -0
  75. data/materialize-sass.gemspec +23 -0
  76. metadata +146 -0
@@ -0,0 +1,257 @@
1
+ (function ($) {
2
+
3
+ $.fn.slider = function (options) {
4
+ var defaults = {
5
+ indicators: true,
6
+ height: 400,
7
+ transition: 500,
8
+ interval: 6000
9
+ }
10
+ options = $.extend(defaults, options);
11
+
12
+ return this.each(function() {
13
+
14
+ // For each slider, we want to keep track of
15
+ // which slide is active and its associated content
16
+ var $this = $(this);
17
+ var $slider = $this.find('ul.slides').first();
18
+ var $slides = $slider.find('li');
19
+ var $active_index = $slider.find('.active').index();
20
+ var $active;
21
+ if ($active_index != -1) { $active = $slides.eq($active_index); }
22
+
23
+ // Transitions the caption depending on alignment
24
+ function captionTransition(caption, duration) {
25
+ if (caption.hasClass("center-align")) {
26
+ caption.velocity({opacity: 0, translateY: -100}, {duration: duration, queue: false});
27
+ }
28
+ else if (caption.hasClass("right-align")) {
29
+ caption.velocity({opacity: 0, translateX: 100}, {duration: duration, queue: false});
30
+ }
31
+ else if (caption.hasClass("left-align")) {
32
+ caption.velocity({opacity: 0, translateX: -100}, {duration: duration, queue: false});
33
+ }
34
+ }
35
+
36
+ // This function will transition the slide to any index of the next slide
37
+ function moveToSlide(index) {
38
+ if (index >= $slides.length) index = 0;
39
+ else if (index < 0) index = $slides.length -1;
40
+
41
+ $active_index = $slider.find('.active').index();
42
+
43
+ // Only do if index changes
44
+ if ($active_index != index) {
45
+ $active = $slides.eq($active_index);
46
+ $caption = $active.find('.caption');
47
+
48
+ $active.removeClass('active');
49
+ $active.velocity({opacity: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad',
50
+ complete: function() {
51
+ $slides.not('.active').velocity({opacity: 0, translateX: 0, translateY: 0}, {duration: 0, queue: false});
52
+ } });
53
+ captionTransition($caption, options.transition);
54
+
55
+
56
+ // Update indicators
57
+ if (options.indicators) {
58
+ $indicators.eq($active_index).removeClass('active');
59
+ }
60
+
61
+ $slides.eq(index).velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
62
+ $slides.eq(index).find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad'});
63
+ $slides.eq(index).addClass('active');
64
+
65
+
66
+ // Update indicators
67
+ if (options.indicators) {
68
+ $indicators.eq(index).addClass('active');
69
+ }
70
+ }
71
+ }
72
+
73
+ // Set height of slider
74
+ if (options.height != 400) {
75
+ $this.height(options.height + 40);
76
+ $slider.height(options.height);
77
+ }
78
+
79
+ // Set initial positions of captions
80
+ $slides.find('.caption').each(function () {
81
+ captionTransition($(this), 0);
82
+ });
83
+
84
+ // Set initial dimensions of images
85
+ $slides.find('img').each(function () {
86
+ $(this).load(function () {
87
+ if ($(this).width() < $(this).parent().width()) {
88
+ $(this).css({width: '100%', height: 'auto'});
89
+ }
90
+ });
91
+ });
92
+
93
+ // dynamically add indicators
94
+ if (options.indicators) {
95
+ var $indicators = $('<ul class="indicators"></ul>');
96
+ $slides.each(function( index ) {
97
+ var $indicator = $('<li class="indicator-item"></li>');
98
+
99
+ // Handle clicks on indicators
100
+ $indicator.click(function () {
101
+ var $parent = $slider.parent();
102
+ var curr_index = $parent.find($(this)).index();
103
+ moveToSlide(curr_index);
104
+
105
+ // reset interval
106
+ clearInterval($interval);
107
+ $interval = setInterval(
108
+ function(){
109
+ $active_index = $slider.find('.active').index();
110
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
111
+ else $active_index += 1;
112
+
113
+ moveToSlide($active_index);
114
+
115
+ }, options.transition + options.interval
116
+ );
117
+ });
118
+ $indicators.append($indicator);
119
+ });
120
+ $this.append($indicators);
121
+ $indicators = $this.find('ul.indicators').find('li.indicator-item');
122
+ }
123
+
124
+ if ($active) {
125
+ $active.show();
126
+ }
127
+ else {
128
+ $slides.first().addClass('active').velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
129
+
130
+ $active_index = 0;
131
+ $active = $slides.eq($active_index);
132
+
133
+ // Update indicators
134
+ if (options.indicators) {
135
+ $indicators.eq($active_index).addClass('active');
136
+ }
137
+ }
138
+
139
+ // Adjust height to current slide
140
+ $active.find('img').load(function() {
141
+ // Handler for .load() called.
142
+ $active.find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
143
+ });
144
+
145
+ // auto scroll
146
+ $interval = setInterval(
147
+ function(){
148
+ $active_index = $slider.find('.active').index();
149
+ moveToSlide($active_index + 1);
150
+
151
+ }, options.transition + options.interval
152
+ );
153
+
154
+
155
+ // HammerJS, Swipe navigation
156
+
157
+ // Touch Event
158
+ var panning = false;
159
+ var swipeLeft = false;
160
+ var swipeRight = false;
161
+
162
+ $this.hammer({
163
+ prevent_default: false
164
+ }).bind('pan', function(e) {
165
+ if (e.gesture.pointerType === "touch") {
166
+
167
+ // reset interval
168
+ clearInterval($interval);
169
+
170
+ var direction = e.gesture.direction;
171
+ var x = e.gesture.deltaX;
172
+ var velocityX = e.gesture.velocityX;
173
+
174
+ $curr_slide = $slider.find('.active');
175
+ $curr_slide.velocity({ translateX: x
176
+ }, {duration: 50, queue: false, easing: 'easeOutQuad'});
177
+
178
+ // Swipe Left
179
+ if (direction === 4 && (x > ($this.innerWidth() / 2) || velocityX < -0.65)) {
180
+ swipeRight = true;
181
+ }
182
+ // Swipe Right
183
+ else if (direction === 2 && (x < (-1 * $this.innerWidth() / 2) || velocityX > 0.65)) {
184
+ swipeLeft = true;
185
+ }
186
+
187
+ // Make Slide Behind active slide visible
188
+ var next_slide;
189
+ if (swipeLeft) {
190
+ next_slide = $curr_slide.next();
191
+ if (next_slide.length === 0) {
192
+ next_slide = $slides.first();
193
+ }
194
+ next_slide.velocity({ opacity: 1
195
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
196
+ }
197
+ if (swipeRight) {
198
+ next_slide = $curr_slide.prev();
199
+ if (next_slide.length === 0) {
200
+ next_slide = $slides.last();
201
+ }
202
+ next_slide.velocity({ opacity: 1
203
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
204
+ }
205
+
206
+
207
+ }
208
+
209
+ }).bind('panend', function(e) {
210
+ if (e.gesture.pointerType === "touch") {
211
+
212
+ $curr_slide = $slider.find('.active');
213
+ panning = false;
214
+ curr_index = $slider.find('.active').index();
215
+
216
+ if (!swipeRight && !swipeLeft) {
217
+ // Return to original spot
218
+ $curr_slide.velocity({ translateX: 0
219
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
220
+ }
221
+ else if (swipeLeft) {
222
+ moveToSlide(curr_index + 1);
223
+ $curr_slide.velocity({translateX: -1 * $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
224
+ complete: function() {
225
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
226
+ } });
227
+ }
228
+ else if (swipeRight) {
229
+ moveToSlide(curr_index - 1);
230
+ $curr_slide.velocity({translateX: $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
231
+ complete: function() {
232
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
233
+ } });
234
+ }
235
+ swipeLeft = false;
236
+ swipeRight = false;
237
+
238
+ // Restart interval
239
+ clearInterval($interval);
240
+ $interval = setInterval(
241
+ function(){
242
+ $active_index = $slider.find('.active').index();
243
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
244
+ else $active_index += 1;
245
+
246
+ moveToSlide($active_index);
247
+
248
+ }, options.transition + options.interval
249
+ );
250
+ }
251
+ });
252
+
253
+
254
+ });
255
+
256
+ };
257
+ }( jQuery ));
@@ -0,0 +1,130 @@
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
+ // console.log($(".tabs .tab a[href='#tab3']"));
25
+ $active = $($links.filter('[href="'+location.hash+'"]'));
26
+
27
+ // If no match is found, use the first link or any with class 'active' as the initial active tab.
28
+ if ($active.length === 0) {
29
+ $active = $(this).find('li.tab a.active').first();
30
+ }
31
+ if ($active.length === 0) {
32
+ $active = $(this).find('li.tab a').first();
33
+ }
34
+
35
+ $active.addClass('active');
36
+ $index = $links.index($active);
37
+ if ($index < 0) {
38
+ $index = 0;
39
+ }
40
+
41
+ $content = $($active[0].hash);
42
+
43
+ // append indicator then set indicator width to tab width
44
+ $this.append('<div class="indicator"></div>');
45
+ var $indicator = $this.find('.indicator');
46
+ if ($this.is(":visible")) {
47
+ $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
48
+ $indicator.css({"left": $index * $tab_width});
49
+ }
50
+ $(window).resize(function () {
51
+ $tabs_width = $this.width();
52
+ $tab_width = $this.find('li').first().outerWidth();
53
+ if ($index < 0) {
54
+ $index = 0;
55
+ }
56
+ if ($tab_width !== 0 && $tabs_width !== 0) {
57
+ $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
58
+ $indicator.css({"left": $index * $tab_width});
59
+ }
60
+ });
61
+
62
+ // Hide the remaining content
63
+ $links.not($active).each(function () {
64
+ $(this.hash).hide();
65
+ });
66
+
67
+
68
+ // Bind the click event handler
69
+ $this.on('click', 'a', function(e){
70
+ $tabs_width = $this.width();
71
+ $tab_width = $this.find('li').first().outerWidth();
72
+
73
+ // Make the old tab inactive.
74
+ $active.removeClass('active');
75
+ $content.hide();
76
+
77
+ // Update the variables with the new link and content
78
+ $active = $(this);
79
+ $content = $(this.hash);
80
+ $links = $this.find('li.tab a');
81
+
82
+ // Make the tab active.
83
+ $active.addClass('active');
84
+ var $prev_index = $index;
85
+ $index = $links.index($(this));
86
+ if ($index < 0) {
87
+ $index = 0;
88
+ }
89
+ // Change url to current tab
90
+ // window.location.hash = $active.attr('href');
91
+
92
+ $content.show();
93
+
94
+ // Update indicator
95
+ if (($index - $prev_index) >= 0) {
96
+ $indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, { duration: 300, queue: false, easing: 'easeOutQuad'});
97
+ $indicator.velocity({"left": $index * $tab_width}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
98
+
99
+ }
100
+ else {
101
+ $indicator.velocity({"left": $index * $tab_width}, { duration: 300, queue: false, easing: 'easeOutQuad'});
102
+ $indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
103
+ }
104
+
105
+ // Prevent the anchor's default click action
106
+ e.preventDefault();
107
+ });
108
+ });
109
+
110
+ },
111
+ select_tab : function( id ) {
112
+ this.find('a[href="#' + id + '"]').trigger('click');
113
+ }
114
+ };
115
+
116
+ $.fn.tabs = function(methodOrOptions) {
117
+ if ( methods[methodOrOptions] ) {
118
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
119
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
120
+ // Default to "init"
121
+ return methods.init.apply( this, arguments );
122
+ } else {
123
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tooltip' );
124
+ }
125
+ };
126
+
127
+ $(document).ready(function(){
128
+ $('ul.tabs').tabs();
129
+ });
130
+ }( jQuery ));
@@ -0,0 +1,100 @@
1
+ function toast(message, displayLength, className, completeCallback) {
2
+ className = className || "";
3
+ if ($('#toast-container').length == 0) {
4
+ // create notification container
5
+ var container = $('<div></div>')
6
+ .attr('id', 'toast-container');
7
+ $('body').append(container);
8
+ }
9
+
10
+ // Select and append toast
11
+ var container = $('#toast-container')
12
+ var newToast = createToast(message);
13
+ container.append(newToast);
14
+
15
+ newToast.css({"top" : parseFloat(newToast.css("top"))+35+"px",
16
+ "opacity": 0});
17
+ newToast.velocity({"top" : "0px",
18
+ opacity: 1},
19
+ {duration: 300,
20
+ easing: 'easeOutCubic',
21
+ queue: false});
22
+
23
+ // Allows timer to be pause while being panned
24
+ var timeLeft = displayLength;
25
+ var counterInterval = setInterval (function(){
26
+ if (newToast.parent().length === 0)
27
+ window.clearInterval(counterInterval);
28
+
29
+ if (!newToast.hasClass("panning")) {
30
+ timeLeft -= 100;
31
+ }
32
+
33
+ if (timeLeft <= 0) {
34
+ newToast.velocity({"opacity": 0, marginTop: '-40px'},
35
+ { duration: 375,
36
+ easing: 'easeOutExpo',
37
+ queue: false,
38
+ complete: function(){
39
+ if(typeof(completeCallback) === "function")
40
+ completeCallback();
41
+ $(this).remove();
42
+ }
43
+ }
44
+ );
45
+ window.clearInterval(counterInterval);
46
+ }
47
+ }, 100);
48
+
49
+
50
+
51
+ function createToast(html) {
52
+ var toast = $("<div class='toast'></div>")
53
+ .addClass(className)
54
+ .html(html);
55
+ // Bind hammer
56
+ toast.hammer({prevent_default:false
57
+ }).bind('pan', function(e) {
58
+
59
+ var deltaX = e.gesture.deltaX;
60
+ var activationDistance = 80;
61
+
62
+ // change toast state
63
+ if (!toast.hasClass("panning"))
64
+ toast.addClass("panning");
65
+
66
+ var opacityPercent = 1-Math.abs(deltaX / activationDistance);
67
+ if (opacityPercent < 0)
68
+ opacityPercent = 0;
69
+
70
+ toast.velocity({left: deltaX, opacity: opacityPercent }, {duration: 50, queue: false, easing: 'easeOutQuad'});
71
+
72
+ }).bind('panend', function(e) {
73
+ var deltaX = e.gesture.deltaX;
74
+ var activationDistance = 80;
75
+
76
+ // If toast dragged past activation point
77
+ if (Math.abs(deltaX) > activationDistance) {
78
+ toast.velocity({marginTop: '-40px'},
79
+ { duration: 375,
80
+ easing: 'easeOutExpo',
81
+ queue: false,
82
+ complete: function(){
83
+ if(typeof(completeCallback) === "function")
84
+ completeCallback();
85
+ toast.remove()
86
+ }
87
+ })
88
+ } else {
89
+ toast.removeClass("panning");
90
+ // Put toast back into original position
91
+ toast.velocity({left: 0, opacity: 1},
92
+ { duration: 300,
93
+ easing: 'easeOutExpo',
94
+ queue: false
95
+ })
96
+ }
97
+ });
98
+ return toast;
99
+ }
100
+ }