materialize-sass 0.95.3.3 → 0.95.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -1
  3. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  4. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  5. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  6. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  7. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  8. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  9. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  10. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  11. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  12. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  13. data/app/assets/javascripts/materialize-sprockets.js +2 -1
  14. data/app/assets/javascripts/materialize/buttons.js +4 -4
  15. data/app/assets/javascripts/materialize/collapsible.js +11 -14
  16. data/app/assets/javascripts/materialize/dropdown.js +5 -1
  17. data/app/assets/javascripts/materialize/forms.js +157 -151
  18. data/app/assets/javascripts/materialize/global.js +18 -0
  19. data/app/assets/javascripts/materialize/init.js +5 -1
  20. data/app/assets/javascripts/materialize/leanModal.js +0 -1
  21. data/app/assets/javascripts/materialize/pushpin.js +1 -14
  22. data/app/assets/javascripts/materialize/scrollFire.js +60 -21
  23. data/app/assets/javascripts/materialize/scrollspy.js +4 -7
  24. data/app/assets/javascripts/materialize/sideNav.js +58 -21
  25. data/app/assets/javascripts/materialize/slider.js +1 -1
  26. data/app/assets/javascripts/materialize/toasts.js +90 -73
  27. data/app/assets/javascripts/materialize/transitions.js +57 -61
  28. data/app/assets/javascripts/materialize/waves.js +6 -3
  29. data/app/assets/stylesheets/materialize/components/_buttons.scss +3 -3
  30. data/app/assets/stylesheets/materialize/components/_cards.scss +5 -7
  31. data/app/assets/stylesheets/materialize/components/_collapsible.scss +3 -11
  32. data/app/assets/stylesheets/materialize/components/_dropdown.scss +1 -1
  33. data/app/assets/stylesheets/materialize/components/_form.scss +178 -162
  34. data/app/assets/stylesheets/materialize/components/_global.scss +11 -10
  35. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +766 -2230
  36. data/app/assets/stylesheets/materialize/components/_materialbox.scss +2 -3
  37. data/app/assets/stylesheets/materialize/components/_modal.scss +3 -3
  38. data/app/assets/stylesheets/materialize/components/_navbar.scss +4 -7
  39. data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -40
  40. data/app/assets/stylesheets/materialize/components/_preloader.scss +2 -4
  41. data/app/assets/stylesheets/materialize/components/_sideNav.scss +9 -9
  42. data/app/assets/stylesheets/materialize/components/_slider.scss +6 -6
  43. data/app/assets/stylesheets/materialize/components/_table_of_contents.scss +1 -1
  44. data/app/assets/stylesheets/materialize/components/_tabs.scss +2 -2
  45. data/app/assets/stylesheets/materialize/components/_toast.scss +4 -5
  46. data/app/assets/stylesheets/materialize/components/_tooltip.scss +2 -2
  47. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +20 -47
  48. data/lib/materialize-sass.rb +75 -6
  49. data/lib/materialize-sass/engine.rb +13 -0
  50. data/lib/materialize-sass/version.rb +1 -1
  51. metadata +9 -15
@@ -0,0 +1,18 @@
1
+ var Materialize = {};
2
+
3
+ // Unique ID
4
+ Materialize.guid = (function() {
5
+ function s4() {
6
+ return Math.floor((1 + Math.random()) * 0x10000)
7
+ .toString(16)
8
+ .substring(1);
9
+ }
10
+ return function() {
11
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
12
+ s4() + '-' + s4() + s4() + s4();
13
+ };
14
+ })();
15
+
16
+ // Velocity has conflicts when loaded with jQuery, this will check for it
17
+ var Vel;
18
+ if ($) { Vel = $.Velocity } else { Vel = Velocity};
@@ -112,10 +112,14 @@
112
112
  $('#nav-mobile').css({ overflow: 'auto'})
113
113
  }
114
114
 
115
+ // Set checkbox on forms.html to indeterminate
116
+ var indeterminateCheckbox = document.getElementById('indeterminate-checkbox');
117
+ if (indeterminateCheckbox !== null)
118
+ indeterminateCheckbox.indeterminate = true;
119
+
115
120
 
116
121
  // Plugin initialization
117
122
  $('.slider').slider({full_width: true});
118
- $('.dropdown-button').dropdown({hover: false});
119
123
  $('.tab-demo').show().tabs();
120
124
  $('.parallax').parallax();
121
125
  $('.modal-trigger').leanModal();
@@ -30,7 +30,6 @@
30
30
  }
31
31
 
32
32
  $(modal).find(".modal-close").click(function(e) {
33
- e.preventDefault();
34
33
  $(modal).closeModal(options);
35
34
  });
36
35
 
@@ -1,19 +1,6 @@
1
1
  (function ($) {
2
2
  $(document).ready(function() {
3
3
 
4
- // Unique ID
5
- var guid = (function() {
6
- function s4() {
7
- return Math.floor((1 + Math.random()) * 0x10000)
8
- .toString(16)
9
- .substring(1);
10
- }
11
- return function() {
12
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
13
- s4() + '-' + s4() + s4() + s4();
14
- };
15
- })();
16
-
17
4
  $.fn.pushpin = function (options) {
18
5
 
19
6
  var defaults = {
@@ -25,7 +12,7 @@
25
12
 
26
13
  $index = 0;
27
14
  return this.each(function() {
28
- var $uniqueId = guid(),
15
+ var $uniqueId = Materialize.guid(),
29
16
  $this = $(this),
30
17
  $original_offset = $(this).offset().top;
31
18
 
@@ -2,29 +2,68 @@
2
2
 
3
3
  // Input: Array of JSON objects {selector, offset, callback}
4
4
 
5
- scrollFire = function(options) {
6
- $(window).scroll(function () {
7
- var windowScroll = $(window).scrollTop() + $(window).height();
8
-
9
- $.each( options, function( i, value ){
10
- var selector = value.selector,
11
- offset = value.offset,
12
- callback = value.callback;
13
-
14
- if ($(selector).length != 0) {
15
- var elementOffset = $(selector).offset().top;
16
-
17
- if (windowScroll > (elementOffset + offset)) {
18
- if (value.done != true) {
19
- var callbackFunc = new Function(callback);
20
- callbackFunc();
21
- value.done = true;
22
- }
23
- }
24
- }
5
+ Materialize.scrollFire = function(options) {
6
+
7
+ var didScroll = false;
25
8
 
26
- });
9
+ window.addEventListener("scroll", function() {
10
+ didScroll = true;
27
11
  });
12
+
13
+ // Rate limit to 100ms
14
+ setInterval(function() {
15
+ if(didScroll) {
16
+ didScroll = false;
17
+
18
+ var windowScroll = window.pageYOffset + window.innerHeight;
19
+
20
+ for (var i = 0 ; i < options.length; i++) {
21
+ // Get options from each line
22
+ var value = options[i];
23
+ var selector = value.selector,
24
+ offset = value.offset,
25
+ callback = value.callback;
26
+
27
+ var currentElement = document.querySelector(selector);
28
+ if ( currentElement !== null) {
29
+ var elementOffset = currentElement.getBoundingClientRect().top + document.body.scrollTop;
30
+
31
+ if (windowScroll > (elementOffset + offset)) {
32
+ if (value.done != true) {
33
+ var callbackFunc = new Function(callback);
34
+ callbackFunc();
35
+ value.done = true;
36
+ }
37
+ }
38
+ }
39
+ };
40
+ }
41
+ }, 100);
42
+
43
+
44
+ // $(window).scroll(function () {
45
+ // var windowScroll = $(window).scrollTop() + $(window).height();
46
+
47
+ // $.each( options, function( i, value ){
48
+ // var selector = value.selector,
49
+ // offset = value.offset,
50
+ // callback = value.callback;
51
+
52
+ // if ($(selector).length != 0) {
53
+ // var elementOffset = $(selector).offset().top;
54
+
55
+ // if (windowScroll > (elementOffset + offset)) {
56
+ // if (value.done != true) {
57
+ // var callbackFunc = new Function(callback);
58
+ // callbackFunc();
59
+ // value.done = true;
60
+ // }
61
+ // }
62
+ // }
63
+
64
+ // });
65
+ // });
66
+
28
67
  }
29
68
 
30
69
  })(jQuery);
@@ -180,13 +180,10 @@
180
180
  e.preventDefault();
181
181
  var offset = $(this.hash).offset().top + 1;
182
182
 
183
- // offset-60 to handle floating fixed tab bar
184
- if ($('.tabs-wrapper').length) {
185
- $('html, body').animate({ scrollTop: offset-60 }, {duration: 400, easing: 'easeOutCubic'});
186
- }
187
- else {
188
- $('html, body').animate({ scrollTop: offset }, {duration: 400, easing: 'easeOutCubic'});
189
- }
183
+ // offset - 200 allows elements near bottom of page to scroll
184
+
185
+ $('html, body').animate({ scrollTop: offset - 200 }, {duration: 400, easing: 'easeOutCubic'});
186
+
190
187
  });
191
188
  });
192
189
  options = options || {
@@ -75,23 +75,31 @@
75
75
 
76
76
  // If fixed sidenav, bring menu out
77
77
  if (menu_id.hasClass('fixed')) {
78
- menu_id.css('left', 0);
78
+ if ($(window).width() > 992) {
79
+ menu_id.css('left', 0);
80
+ }
79
81
  }
80
82
 
81
-
82
-
83
83
  // Window resize to reset on large screens fixed
84
84
  if (menu_id.hasClass('fixed')) {
85
85
  $(window).resize( function() {
86
- if ($(window).width() > 1200) {
87
- if (menu_id.attr('style')) {
86
+ if (window.innerWidth > 992) {
87
+ // Close menu if window is resized bigger than 992 and user has fixed sidenav
88
+ if ($('#sidenav-overlay').css('opacity') != 0 && menuOut) {
89
+ removeMenu(true);
90
+ }
91
+ else {
88
92
  menu_id.removeAttr('style');
89
93
  menu_id.css('width', options.menuWidth);
90
94
  }
91
95
  }
92
- if ($('#sidenav-overlay').css('opacity') != 0 && menuOut) {
93
- $('#sidenav-overlay').trigger('click');
96
+ else if (menuOut === false){
97
+ if (options.edge === 'left')
98
+ menu_id.css('left', -1 * (options.menuWidth + 10));
99
+ else
100
+ menu_id.css('right', -1 * (options.menuWidth + 10));
94
101
  }
102
+
95
103
  });
96
104
  }
97
105
 
@@ -102,7 +110,7 @@
102
110
  });
103
111
  }
104
112
 
105
- function removeMenu() {
113
+ function removeMenu(restoreNav) {
106
114
  panning = false;
107
115
  menuOut = false;
108
116
  $('#sidenav-overlay').velocity({opacity: 0}, {duration: 200, queue: false, easing: 'easeOutQuad',
@@ -112,12 +120,37 @@
112
120
  if (options.edge === 'left') {
113
121
  // Reset phantom div
114
122
  $('.drag-target').css({width: '', right: '', left: '0'});
115
- menu_id.velocity({left: -1 * (options.menuWidth + 10)}, {duration: 200, queue: false, easing: 'easeOutCubic'});
123
+ menu_id.velocity(
124
+ {left: -1 * (options.menuWidth + 10)},
125
+ { duration: 200,
126
+ queue: false,
127
+ easing: 'easeOutCubic',
128
+ complete: function() {
129
+ if (restoreNav == true) {
130
+ // Restore Fixed sidenav
131
+ menu_id.removeAttr('style');
132
+ menu_id.css('width', options.menuWidth);
133
+ }
134
+ }
135
+
136
+ });
116
137
  }
117
138
  else {
118
139
  // Reset phantom div
119
140
  $('.drag-target').css({width: '', right: '0', left: ''});
120
- menu_id.velocity({right: -1 * (options.menuWidth + 10)}, {duration: 200, queue: false, easing: 'easeOutCubic'});
141
+ menu_id.velocity(
142
+ {right: -1 * (options.menuWidth + 10)},
143
+ { duration: 200,
144
+ queue: false,
145
+ easing: 'easeOutCubic',
146
+ complete: function() {
147
+ if (restoreNav == true) {
148
+ // Restore Fixed sidenav
149
+ menu_id.removeAttr('style');
150
+ menu_id.css('width', options.menuWidth);
151
+ }
152
+ }
153
+ });
121
154
  }
122
155
  }
123
156
 
@@ -127,11 +160,12 @@
127
160
  var panning = false;
128
161
  var menuOut = false;
129
162
 
163
+ $('.drag-target').on('click', function(){
164
+ removeMenu();
165
+ })
166
+
130
167
  $('.drag-target').hammer({
131
168
  prevent_default: false
132
- }).bind('tap', function(e) {
133
- // capture overlay click on drag target
134
- $('#sidenav-overlay').trigger('click');
135
169
  }).bind('pan', function(e) {
136
170
 
137
171
  if (e.gesture.pointerType == "touch") {
@@ -141,9 +175,12 @@
141
175
  var y = e.gesture.center.y;
142
176
  var velocityX = e.gesture.velocityX;
143
177
 
144
- if (!$('#sidenav-overlay').length) {
178
+ // If overlay does not exist, create one and if it is clicked, close menu
179
+ if ($('#sidenav-overlay').length === 0) {
145
180
  var overlay = $('<div id="sidenav-overlay"></div>');
146
- overlay.css('opacity', 0).click(function(){ removeMenu(); });
181
+ overlay.css('opacity', 0).click( function(){
182
+ removeMenu();
183
+ });
147
184
  $('body').append(overlay);
148
185
  }
149
186
 
@@ -204,8 +241,8 @@
204
241
  $('.drag-target').css({width: '50%', right: 0, left: ''});
205
242
  }
206
243
  else if (!menuOut || velocityX > 0.3) {
207
- menu_id.velocity({left: -1 * (options.menuWidth + 10)}, {duration: 300, queue: false, easing: 'easeOutQuad'});
208
- $('#sidenav-overlay').velocity({opacity: 0 }, {duration: 50, queue: false, easing: 'easeOutQuad',
244
+ menu_id.velocity({left: -1 * (options.menuWidth + 10)}, {duration: 200, queue: false, easing: 'easeOutQuad'});
245
+ $('#sidenav-overlay').velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
209
246
  complete: function () {
210
247
  $(this).remove();
211
248
  }});
@@ -219,8 +256,8 @@
219
256
  $('.drag-target').css({width: '50%', right: '', left: 0});
220
257
  }
221
258
  else if (!menuOut || velocityX < -0.3) {
222
- menu_id.velocity({right: -1 * (options.menuWidth + 10)}, {duration: 300, queue: false, easing: 'easeOutQuad'});
223
- $('#sidenav-overlay').velocity({opacity: 0 }, {duration: 50, queue: false, easing: 'easeOutQuad',
259
+ menu_id.velocity({right: -1 * (options.menuWidth + 10)}, {duration: 200, queue: false, easing: 'easeOutQuad'});
260
+ $('#sidenav-overlay').velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
224
261
  complete: function () {
225
262
  $(this).remove();
226
263
  }});
@@ -255,14 +292,14 @@
255
292
  menuOut = false;
256
293
  panning = false;
257
294
  removeMenu();
258
- overlay.animate({opacity: 0}, {duration: 300, queue: false, easing: 'easeOutQuad',
295
+ overlay.velocity({opacity: 0}, {duration: 300, queue: false, easing: 'easeOutQuad',
259
296
  complete: function() {
260
297
  $(this).remove();
261
298
  } });
262
299
 
263
300
  });
264
301
  $('body').append(overlay);
265
- overlay.animate({opacity: 1}, {duration: 300, queue: false, easing: 'easeOutQuad',
302
+ overlay.velocity({opacity: 1}, {duration: 300, queue: false, easing: 'easeOutQuad',
266
303
  complete: function () {
267
304
  menuOut = true;
268
305
  panning = false;
@@ -5,7 +5,7 @@
5
5
  indicators: true,
6
6
  height: 400,
7
7
  transition: 500,
8
- interval: 60000
8
+ interval: 6000
9
9
  }
10
10
  options = $.extend(defaults, options);
11
11
 
@@ -1,100 +1,117 @@
1
- function toast(message, displayLength, className, completeCallback) {
1
+ Materialize.toast = function (message, displayLength, className, completeCallback) {
2
2
  className = className || "";
3
- if ($('#toast-container').length == 0) {
3
+
4
+ var container = document.getElementById('toast-container');
5
+
6
+ // Create toast container if it does not exist
7
+ if (container === null) {
4
8
  // create notification container
5
- var container = $('<div></div>')
6
- .attr('id', 'toast-container');
7
- $('body').append(container);
9
+ var container = document.createElement('div');
10
+ container.id = 'toast-container';
11
+ document.body.appendChild(container);
8
12
  }
9
13
 
10
14
  // Select and append toast
11
- var container = $('#toast-container')
12
15
  var newToast = createToast(message);
13
- container.append(newToast);
16
+ container.appendChild(newToast);
14
17
 
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});
18
+ newToast.style.top = '35px';
19
+ newToast.style.opacity = 0;
20
+
21
+ // Animate toast in
22
+ Vel(newToast, { "top" : "0px", opacity: 1 }, {duration: 300,
23
+ easing: 'easeOutCubic',
24
+ queue: false});
22
25
 
23
26
  // Allows timer to be pause while being panned
24
27
  var timeLeft = displayLength;
25
28
  var counterInterval = setInterval (function(){
26
- if (newToast.parent().length === 0)
29
+
30
+
31
+ if (newToast.parentNode === null)
27
32
  window.clearInterval(counterInterval);
28
33
 
29
- if (!newToast.hasClass("panning")) {
30
- timeLeft -= 100;
34
+ // If toast is not being dragged, decrease its time remaining
35
+ if (!newToast.classList.contains('panning')) {
36
+ timeLeft -= 20;
31
37
  }
32
38
 
33
39
  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
- );
40
+ // Animate toast out
41
+ Vel(newToast, {"opacity": 0, marginTop: '-40px'}, { duration: 375,
42
+ easing: 'easeOutExpo',
43
+ queue: false,
44
+ complete: function(){
45
+ // Call the optional callback
46
+ if(typeof(completeCallback) === "function")
47
+ completeCallback();
48
+ // Remove toast after it times out
49
+ this[0].parentNode.removeChild(this[0]);
50
+ }
51
+ });
45
52
  window.clearInterval(counterInterval);
46
53
  }
47
- }, 100);
54
+ }, 20);
48
55
 
49
56
 
50
57
 
51
58
  function createToast(html) {
52
- var toast = $("<div class='toast'></div>")
53
- .addClass(className)
54
- .html(html);
59
+
60
+ // Create toast
61
+ var toast = document.createElement('div');
62
+ toast.classList.add('toast');
63
+ if (className) {
64
+ toast.classList.add(className);
65
+ }
66
+ toast.innerHTML = html;
67
+
55
68
  // 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
- })
69
+ var hammerHandler = new Hammer(toast, {prevent_default: false});
70
+ hammerHandler.on('pan', function(e) {
71
+ var deltaX = e.deltaX;
72
+ var activationDistance = 80;
73
+
74
+ // Change toast state
75
+ if (!toast.classList.contains('panning')){
76
+ toast.classList.add('panning');
77
+ }
78
+
79
+ var opacityPercent = 1-Math.abs(deltaX / activationDistance);
80
+ if (opacityPercent < 0)
81
+ opacityPercent = 0;
82
+
83
+ Vel(toast, {left: deltaX, opacity: opacityPercent }, {duration: 50, queue: false, easing: 'easeOutQuad'});
84
+
85
+ });
86
+
87
+ hammerHandler.on('panend', function(e) {
88
+ var deltaX = e.deltaX;
89
+ var activationDistance = 80;
90
+
91
+ // If toast dragged past activation point
92
+ if (Math.abs(deltaX) > activationDistance) {
93
+ Vel(toast, {marginTop: '-40px'}, { duration: 375,
94
+ easing: 'easeOutExpo',
95
+ queue: false,
96
+ complete: function(){
97
+ if(typeof(completeCallback) === "function") {
98
+ completeCallback();
96
99
  }
97
- });
100
+ toast.parentNode.removeChild(toast);
101
+ }
102
+ });
103
+
104
+ } else {
105
+ toast.classList.remove('panning');
106
+ // Put toast back into original position
107
+ Vel(toast, { left: 0, opacity: 1 }, { duration: 300,
108
+ easing: 'easeOutExpo',
109
+ queue: false
110
+ });
111
+
112
+ }
113
+ });
114
+
98
115
  return toast;
99
116
  }
100
117
  }