materialize-sass 0.97.7 → 0.97.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +23 -1
  4. data/Rakefile +112 -1
  5. data/app/assets/javascripts/materialize-sprockets.js +2 -2
  6. data/app/assets/javascripts/materialize.js +5 -7468
  7. data/app/assets/javascripts/materialize/buttons.js +182 -6
  8. data/app/assets/javascripts/materialize/cards.js +2 -2
  9. data/app/assets/javascripts/materialize/carousel.js +1 -1
  10. data/app/assets/javascripts/materialize/character_counter.js +1 -1
  11. data/app/assets/javascripts/materialize/chips.js +76 -54
  12. data/app/assets/javascripts/materialize/collapsible.js +62 -39
  13. data/app/assets/javascripts/materialize/dropdown.js +21 -21
  14. data/app/assets/javascripts/materialize/extras/nouislider.js +1 -1
  15. data/app/assets/javascripts/materialize/forms.js +5 -4
  16. data/app/assets/javascripts/materialize/global.js +56 -3
  17. data/app/assets/javascripts/materialize/init.js +3 -2
  18. data/app/assets/javascripts/materialize/materialbox.js +1 -1
  19. data/app/assets/javascripts/materialize/modal.js +184 -0
  20. data/app/assets/javascripts/materialize/parallax.js +2 -2
  21. data/app/assets/javascripts/materialize/scrollspy.js +7 -6
  22. data/app/assets/javascripts/materialize/sideNav.js +193 -175
  23. data/app/assets/javascripts/materialize/tabs.js +31 -15
  24. data/app/assets/javascripts/materialize/toasts.js +29 -28
  25. data/app/assets/javascripts/materialize/tooltip.js +7 -1
  26. data/app/assets/javascripts/materialize/transitions.js +1 -1
  27. data/app/assets/stylesheets/materialize.scss +5 -5
  28. data/app/assets/stylesheets/materialize/components/_buttons.scss +78 -8
  29. data/app/assets/stylesheets/materialize/components/_cards.scss +2 -0
  30. data/app/assets/stylesheets/materialize/components/_chips.scss +15 -6
  31. data/app/assets/stylesheets/materialize/components/_dropdown.scss +9 -1
  32. data/app/assets/stylesheets/materialize/components/_global.scss +46 -27
  33. data/app/assets/stylesheets/materialize/components/_materialbox.scss +1 -1
  34. data/app/assets/stylesheets/materialize/components/_mixins.scss +1 -1
  35. data/app/assets/stylesheets/materialize/components/_modal.scss +12 -12
  36. data/app/assets/stylesheets/materialize/components/_navbar.scss +11 -3
  37. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -0
  38. data/app/assets/stylesheets/materialize/components/_preloader.scss +1 -1
  39. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -0
  40. data/app/assets/stylesheets/materialize/components/_sideNav.scss +6 -16
  41. data/app/assets/stylesheets/materialize/components/_slider.scss +1 -1
  42. data/app/assets/stylesheets/materialize/components/_table_of_contents.scss +0 -0
  43. data/app/assets/stylesheets/materialize/components/_tabs.scss +62 -19
  44. data/app/assets/stylesheets/materialize/components/_typography.scss +1 -1
  45. data/app/assets/stylesheets/materialize/components/_variables.scss +82 -82
  46. data/app/assets/stylesheets/materialize/components/_waves.scss +2 -2
  47. data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +13 -0
  48. data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +0 -2
  49. data/app/assets/stylesheets/materialize/components/forms/_select.scss +6 -1
  50. data/app/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  51. data/lib/materialize-sass/version.rb +1 -1
  52. metadata +4 -5
  53. data/app/assets/javascripts/materialize.min.js +0 -10
  54. data/app/assets/javascripts/materialize/leanModal.js +0 -192
@@ -1,7 +1,9 @@
1
1
  (function ($) {
2
2
  $.fn.collapsible = function(options) {
3
3
  var defaults = {
4
- accordion: undefined
4
+ accordion: undefined,
5
+ onOpen: undefined,
6
+ onClose: undefined
5
7
  };
6
8
 
7
9
  options = $.extend(defaults, options);
@@ -16,22 +18,22 @@
16
18
  var collapsible_type = $this.data("collapsible");
17
19
 
18
20
  // Turn off any existing event handlers
19
- $this.off('click.collapse', '> li > .collapsible-header');
20
- $panel_headers.off('click.collapse');
21
+ $this.off('click.collapse', '> li > .collapsible-header');
22
+ $panel_headers.off('click.collapse');
21
23
 
22
24
 
23
- /****************
24
- Helper Functions
25
- ****************/
25
+ /****************
26
+ Helper Functions
27
+ ****************/
26
28
 
27
29
  // Accordion Open
28
30
  function accordionOpen(object) {
29
31
  $panel_headers = $this.find('> li > .collapsible-header');
30
32
  if (object.hasClass('active')) {
31
- object.parent().addClass('active');
33
+ object.parent().addClass('active');
32
34
  }
33
35
  else {
34
- object.parent().removeClass('active');
36
+ object.parent().removeClass('active');
35
37
  }
36
38
  if (object.parent().hasClass('active')){
37
39
  object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
@@ -41,34 +43,64 @@
41
43
  }
42
44
 
43
45
  $panel_headers.not(object).removeClass('active').parent().removeClass('active');
44
- $panel_headers.not(object).parent().children('.collapsible-body').stop(true,false).slideUp(
45
- {
46
- duration: 350,
47
- easing: "easeOutQuart",
48
- queue: false,
49
- complete:
50
- function() {
51
- $(this).css('height', '');
52
- }
53
- });
46
+
47
+ // Close previously open accordion elements.
48
+ $panel_headers.not(object).parent().children('.collapsible-body').stop(true,false).each(function() {
49
+ if ($(this).is(':visible')) {
50
+ $(this).slideUp({
51
+ duration: 350,
52
+ easing: "easeOutQuart",
53
+ queue: false,
54
+ complete:
55
+ function() {
56
+ $(this).css('height', '');
57
+ execCallbacks($(this).siblings('.collapsible-header'));
58
+ }
59
+ });
60
+ }
61
+ });
54
62
  }
55
63
 
56
64
  // Expandable Open
57
65
  function expandableOpen(object) {
58
66
  if (object.hasClass('active')) {
59
- object.parent().addClass('active');
67
+ object.parent().addClass('active');
60
68
  }
61
69
  else {
62
- object.parent().removeClass('active');
70
+ object.parent().removeClass('active');
63
71
  }
64
72
  if (object.parent().hasClass('active')){
65
73
  object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
66
74
  }
67
- else{
75
+ else {
68
76
  object.siblings('.collapsible-body').stop(true,false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
69
77
  }
70
78
  }
71
79
 
80
+ // Open collapsible. object: .collapsible-header
81
+ function collapsibleOpen(object) {
82
+ if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
83
+ accordionOpen(object);
84
+ } else { // Handle Expandables
85
+ expandableOpen(object);
86
+ }
87
+
88
+ execCallbacks(object);
89
+ }
90
+
91
+ // Handle callbacks
92
+ function execCallbacks(object) {
93
+ if (object.hasClass('active')) {
94
+ if (typeof(options.onOpen) === "function") {
95
+ options.onOpen.call(this, object.parent());
96
+ }
97
+ } else {
98
+ if (typeof(options.onClose) === "function") {
99
+ options.onClose.call(this, object.parent());
100
+ }
101
+ }
102
+ }
103
+
72
104
  /**
73
105
  * Check if object is children of panel header
74
106
  * @param {Object} object Jquery object
@@ -97,8 +129,7 @@
97
129
 
98
130
  // Add click handler to only direct collapsible header children
99
131
  $this.on('click.collapse', '> li > .collapsible-header', function(e) {
100
- var $header = $(this),
101
- element = $(e.target);
132
+ var element = $(e.target);
102
133
 
103
134
  if (isChildrenOfPanelHeader(element)) {
104
135
  element = getPanelHeader(element);
@@ -106,32 +137,24 @@
106
137
 
107
138
  element.toggleClass('active');
108
139
 
109
- if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
110
- accordionOpen(element);
111
- } else { // Handle Expandables
112
- expandableOpen(element);
113
-
114
- if ($header.hasClass('active')) {
115
- expandableOpen($header);
116
- }
117
- }
140
+ collapsibleOpen(element);
118
141
  });
119
142
 
143
+
120
144
  // Open first active
121
- var $panel_headers = $this.find('> li > .collapsible-header');
122
145
  if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
123
- accordionOpen($panel_headers.filter('.active').first());
124
- }
125
- else { // Handle Expandables
146
+ collapsibleOpen($panel_headers.filter('.active').first());
147
+
148
+ } else { // Handle Expandables
126
149
  $panel_headers.filter('.active').each(function() {
127
- expandableOpen($(this));
150
+ collapsibleOpen($(this));
128
151
  });
129
152
  }
130
153
 
131
154
  });
132
155
  };
133
156
 
134
- $(document).ready(function(){
157
+ $(document).on('turbolinks:load', function(){
135
158
  $('.collapsible').collapsible();
136
159
  });
137
- }( jQuery ));
160
+ }( jQuery ));
@@ -37,7 +37,7 @@
37
37
 
38
38
  this.each(function(){
39
39
  var origin = $(this);
40
- var options = $.extend({}, defaults, options);
40
+ var curr_options = $.extend({}, defaults, options);
41
41
  var isFocused = false;
42
42
 
43
43
  // Dropdown menu
@@ -45,21 +45,21 @@
45
45
 
46
46
  function updateOptions() {
47
47
  if (origin.data('induration') !== undefined)
48
- options.inDuration = origin.data('induration');
48
+ curr_options.inDuration = origin.data('induration');
49
49
  if (origin.data('outduration') !== undefined)
50
- options.outDuration = origin.data('outduration');
50
+ curr_options.outDuration = origin.data('outduration');
51
51
  if (origin.data('constrainwidth') !== undefined)
52
- options.constrain_width = origin.data('constrainwidth');
52
+ curr_options.constrain_width = origin.data('constrainwidth');
53
53
  if (origin.data('hover') !== undefined)
54
- options.hover = origin.data('hover');
54
+ curr_options.hover = origin.data('hover');
55
55
  if (origin.data('gutter') !== undefined)
56
- options.gutter = origin.data('gutter');
56
+ curr_options.gutter = origin.data('gutter');
57
57
  if (origin.data('beloworigin') !== undefined)
58
- options.belowOrigin = origin.data('beloworigin');
58
+ curr_options.belowOrigin = origin.data('beloworigin');
59
59
  if (origin.data('alignment') !== undefined)
60
- options.alignment = origin.data('alignment');
60
+ curr_options.alignment = origin.data('alignment');
61
61
  if (origin.data('stoppropagation') !== undefined)
62
- options.stopPropagation = origin.data('stoppropagation');
62
+ curr_options.stopPropagation = origin.data('stoppropagation');
63
63
  }
64
64
 
65
65
  updateOptions();
@@ -85,7 +85,7 @@
85
85
  origin.addClass('active');
86
86
 
87
87
  // Constrain width
88
- if (options.constrain_width === true) {
88
+ if (curr_options.constrain_width === true) {
89
89
  activates.css('width', origin.outerWidth());
90
90
 
91
91
  } else {
@@ -97,13 +97,13 @@
97
97
  var originHeight = origin.innerHeight();
98
98
  var offsetLeft = origin.offset().left;
99
99
  var offsetTop = origin.offset().top - $(window).scrollTop();
100
- var currAlignment = options.alignment;
100
+ var currAlignment = curr_options.alignment;
101
101
  var gutterSpacing = 0;
102
102
  var leftPosition = 0;
103
103
 
104
104
  // Below Origin
105
105
  var verticalOffset = 0;
106
- if (options.belowOrigin === true) {
106
+ if (curr_options.belowOrigin === true) {
107
107
  verticalOffset = originHeight;
108
108
  }
109
109
 
@@ -146,12 +146,12 @@
146
146
 
147
147
  // Handle edge alignment
148
148
  if (currAlignment === 'left') {
149
- gutterSpacing = options.gutter;
149
+ gutterSpacing = curr_options.gutter;
150
150
  leftPosition = origin.position().left + gutterSpacing;
151
151
  }
152
152
  else if (currAlignment === 'right') {
153
153
  var offsetRight = origin.position().left + origin.outerWidth() - activates.outerWidth();
154
- gutterSpacing = -options.gutter;
154
+ gutterSpacing = -curr_options.gutter;
155
155
  leftPosition = offsetRight + gutterSpacing;
156
156
  }
157
157
 
@@ -167,26 +167,26 @@
167
167
  activates.stop(true, true).css('opacity', 0)
168
168
  .slideDown({
169
169
  queue: false,
170
- duration: options.inDuration,
170
+ duration: curr_options.inDuration,
171
171
  easing: 'easeOutCubic',
172
172
  complete: function() {
173
173
  $(this).css('height', '');
174
174
  }
175
175
  })
176
- .animate( {opacity: 1}, {queue: false, duration: options.inDuration, easing: 'easeOutSine'});
176
+ .animate( {opacity: 1}, {queue: false, duration: curr_options.inDuration, easing: 'easeOutSine'});
177
177
  }
178
178
 
179
179
  function hideDropdown() {
180
180
  // Check for simultaneous focus and click events.
181
181
  isFocused = false;
182
- activates.fadeOut(options.outDuration);
182
+ activates.fadeOut(curr_options.outDuration);
183
183
  activates.removeClass('active');
184
184
  origin.removeClass('active');
185
- setTimeout(function() { activates.css('max-height', ''); }, options.outDuration);
185
+ setTimeout(function() { activates.css('max-height', ''); }, curr_options.outDuration);
186
186
  }
187
187
 
188
188
  // Hover
189
- if (options.hover) {
189
+ if (curr_options.hover) {
190
190
  var open = false;
191
191
  origin.unbind('click.' + origin.attr('id'));
192
192
  // Hover handler to show dropdown
@@ -225,7 +225,7 @@
225
225
  !origin.hasClass('active') &&
226
226
  ($(e.target).closest('.dropdown-content').length === 0)) {
227
227
  e.preventDefault(); // Prevents button click from moving window
228
- if (options.stopPropagation) {
228
+ if (curr_options.stopPropagation) {
229
229
  e.stopPropagation();
230
230
  }
231
231
  placeDropdown('click');
@@ -259,7 +259,7 @@
259
259
  });
260
260
  }; // End dropdown plugin
261
261
 
262
- $(document).ready(function(){
262
+ $(document).on('turbolinks:load', function(){
263
263
  $('.dropdown-button').dropdown();
264
264
  });
265
265
  }( jQuery ));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v0.97.6 (http://materializecss.com)
2
+ * Materialize v0.97.8 (http://materializecss.com)
3
3
  * Copyright 2014-2015 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  (function ($) {
2
- $(document).ready(function() {
2
+ $(document).on('turbolinks:load', function() {
3
3
 
4
4
  // Function to update labels of text fields
5
5
  Materialize.updateTextFields = function() {
@@ -26,7 +26,7 @@
26
26
  });
27
27
 
28
28
  // Add active if input element has been pre-populated on document ready
29
- $(document).ready(function() {
29
+ $(document).on('turbolinks:load', function() {
30
30
  Materialize.updateTextFields();
31
31
  });
32
32
 
@@ -350,6 +350,7 @@
350
350
  // Set input value
351
351
  $autocomplete.on('click', 'li', function () {
352
352
  $input.val($(this).text().trim());
353
+ $input.trigger('change');
353
354
  $autocomplete.empty();
354
355
  });
355
356
  }
@@ -413,9 +414,9 @@
413
414
 
414
415
  // Check for multiple type.
415
416
  if (type === 'multiple') {
416
- options.append($('<li class="' + disabledClass + '"><img src="' + icon_url + '"' + classString + '><span><input type="checkbox"' + disabledClass + '/><label></label>' + option.html() + '</span></li>'));
417
+ options.append($('<li class="' + disabledClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span><input type="checkbox"' + disabledClass + '/><label></label>' + option.html() + '</span></li>'));
417
418
  } else {
418
- options.append($('<li class="' + disabledClass + optgroupClass + '"><img src="' + icon_url + '"' + classString + '><span>' + option.html() + '</span></li>'));
419
+ options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + option.html() + '</span></li>'));
419
420
  }
420
421
  return true;
421
422
  }
@@ -8,6 +8,49 @@
8
8
  })(window);
9
9
 
10
10
 
11
+ /*
12
+ * raf.js
13
+ * https://github.com/ngryman/raf.js
14
+ *
15
+ * original requestAnimationFrame polyfill by Erik Möller
16
+ * inspired from paul_irish gist and post
17
+ *
18
+ * Copyright (c) 2013 ngryman
19
+ * Licensed under the MIT license.
20
+ */
21
+ (function(window) {
22
+ var lastTime = 0,
23
+ vendors = ['webkit', 'moz'],
24
+ requestAnimationFrame = window.requestAnimationFrame,
25
+ cancelAnimationFrame = window.cancelAnimationFrame,
26
+ i = vendors.length;
27
+
28
+ // try to un-prefix existing raf
29
+ while (--i >= 0 && !requestAnimationFrame) {
30
+ requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
31
+ cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
32
+ }
33
+
34
+ // polyfill with setTimeout fallback
35
+ // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
36
+ if (!requestAnimationFrame || !cancelAnimationFrame) {
37
+ requestAnimationFrame = function(callback) {
38
+ var now = +Date.now(),
39
+ nextTime = Math.max(lastTime + 16, now);
40
+ return setTimeout(function() {
41
+ callback(lastTime = nextTime);
42
+ }, nextTime - now);
43
+ };
44
+
45
+ cancelAnimationFrame = clearTimeout;
46
+ }
47
+
48
+ // export to window
49
+ window.requestAnimationFrame = requestAnimationFrame;
50
+ window.cancelAnimationFrame = cancelAnimationFrame;
51
+ }(window));
52
+
53
+
11
54
  // Unique ID
12
55
  Materialize.guid = (function() {
13
56
  function s4() {
@@ -21,6 +64,15 @@ Materialize.guid = (function() {
21
64
  };
22
65
  })();
23
66
 
67
+ /**
68
+ * Escapes hash from special characters
69
+ * @param {string} hash String returned from this.hash
70
+ * @returns {string}
71
+ */
72
+ Materialize.escapeHash = function(hash) {
73
+ return hash.replace( /(:|\.|\[|\]|,|=)/g, "\\$1" );
74
+ };
75
+
24
76
  Materialize.elementOrParentIsFixed = function(element) {
25
77
  var $element = $(element);
26
78
  var $checkElements = $element.add($element.parents());
@@ -35,11 +87,12 @@ Materialize.elementOrParentIsFixed = function(element) {
35
87
  };
36
88
 
37
89
  // Velocity has conflicts when loaded with jQuery, this will check for it
90
+ // First, check if in noConflict mode
38
91
  var Vel;
39
- if ($) {
40
- Vel = $.Velocity;
41
- } else if (jQuery) {
92
+ if (jQuery) {
42
93
  Vel = jQuery.Velocity;
94
+ } else if ($) {
95
+ Vel = $.Velocity;
43
96
  } else {
44
97
  Vel = Velocity;
45
98
  }
@@ -142,7 +142,7 @@
142
142
  $('.carousel').carousel();
143
143
  $('.slider').slider({full_width: true});
144
144
  $('.parallax').parallax();
145
- $('.modal-trigger').leanModal();
145
+ $('.modal').modal();
146
146
  $('.scrollspy').scrollSpy();
147
147
  $('.button-collapse').sideNav({'edge': 'left'});
148
148
  $('.datepicker').pickadate({selectYears: 20});
@@ -151,6 +151,8 @@
151
151
  data: {"Apple": null, "Microsoft": null, "Google": 'http://placehold.it/250x250'}
152
152
  });
153
153
 
154
+ $('.chips').material_chip();
155
+
154
156
  $('.chips-initial').material_chip({
155
157
  readOnly: true,
156
158
  data: [{
@@ -167,7 +169,6 @@
167
169
  secondaryPlaceholder: '+Tag',
168
170
  });
169
171
 
170
- $('.chips').material_chip();
171
172
 
172
173
  }); // end of document ready
173
174
  })(jQuery); // end of jQuery name space
@@ -262,7 +262,7 @@
262
262
  });
263
263
  };
264
264
 
265
- $(document).ready(function(){
265
+ $(document).on('turbolinks:load', function(){
266
266
  $('.materialboxed').materialbox();
267
267
  });
268
268