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,178 +0,0 @@
1
- (function ($) {
2
-
3
- // Add posibility to scroll to selected option
4
- // usefull for select for example
5
- $.fn.scrollTo = function(elem) {
6
- $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
7
- return this;
8
- };
9
-
10
- $.fn.dropdown = function (option) {
11
- var defaults = {
12
- inDuration: 300,
13
- outDuration: 225,
14
- constrain_width: true, // Constrains width of dropdown to the activator
15
- hover: false,
16
- gutter: 0, // Spacing from edge
17
- belowOrigin: false
18
- };
19
-
20
- this.each(function(){
21
- var origin = $(this);
22
- var options = $.extend({}, defaults, option);
23
-
24
- // Dropdown menu
25
- var activates = $("#"+ origin.attr('data-activates'));
26
-
27
- function updateOptions() {
28
- if (origin.data('induration') !== undefined)
29
- options.inDuration = origin.data('inDuration');
30
- if (origin.data('outduration') !== undefined)
31
- options.outDuration = origin.data('outDuration');
32
- if (origin.data('constrainwidth') !== undefined)
33
- options.constrain_width = origin.data('constrainwidth');
34
- if (origin.data('hover') !== undefined)
35
- options.hover = origin.data('hover');
36
- if (origin.data('gutter') !== undefined)
37
- options.gutter = origin.data('gutter');
38
- if (origin.data('beloworigin') !== undefined)
39
- options.belowOrigin = origin.data('beloworigin');
40
- }
41
-
42
- updateOptions();
43
-
44
- // Attach dropdown to its activator
45
- origin.after(activates);
46
-
47
- /*
48
- Helper function to position and resize dropdown.
49
- Used in hover and click handler.
50
- */
51
- function placeDropdown() {
52
- // Check html data attributes
53
- updateOptions();
54
-
55
- // Set Dropdown state
56
- activates.addClass('active');
57
-
58
- // Constrain width
59
- if (options.constrain_width === true) {
60
- activates.css('width', origin.outerWidth());
61
- }
62
- var offset = 0;
63
- if (options.belowOrigin === true) {
64
- offset = origin.height();
65
- }
66
-
67
- // Handle edge alignment
68
- var offsetLeft = origin.offset().left;
69
- var width_difference = 0;
70
- var gutter_spacing = options.gutter;
71
-
72
-
73
- if (offsetLeft + activates.innerWidth() > $(window).width()) {
74
- width_difference = origin.innerWidth() - activates.innerWidth();
75
- gutter_spacing = gutter_spacing * -1;
76
- }
77
-
78
- // Position dropdown
79
- activates.css({
80
- position: 'absolute',
81
- top: origin.position().top + offset,
82
- left: origin.position().left + width_difference + gutter_spacing
83
- });
84
-
85
-
86
-
87
- // Show dropdown
88
- activates.stop(true, true).css('opacity', 0)
89
- .slideDown({
90
- queue: false,
91
- duration: options.inDuration,
92
- easing: 'easeOutCubic',
93
- complete: function() {
94
- $(this).css('height', '');
95
- }
96
- })
97
- .animate( {opacity: 1}, {queue: false, duration: options.inDuration, easing: 'easeOutSine'});
98
- }
99
-
100
- function hideDropdown() {
101
- activates.fadeOut(options.outDuration);
102
- activates.removeClass('active');
103
- }
104
-
105
- // Hover
106
- if (options.hover) {
107
- var open = false;
108
- origin.unbind('click.' + origin.attr('id'));
109
- // Hover handler to show dropdown
110
- origin.on('mouseenter', function(e){ // Mouse over
111
- if (open === false) {
112
- placeDropdown();
113
- open = true;
114
- }
115
- });
116
- origin.on('mouseleave', function(e){
117
- // If hover on origin then to something other than dropdown content, then close
118
- var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
119
- if(!$(toEl).closest('.dropdown-content').is(activates)) {
120
- activates.stop(true, true);
121
- hideDropdown();
122
- open = false;
123
- }
124
- });
125
-
126
- activates.on('mouseleave', function(e){ // Mouse out
127
- var toEl = e.toElement || e.relatedTarget;
128
- if(!$(toEl).closest('.dropdown-button').is(origin)) {
129
- activates.stop(true, true);
130
- hideDropdown();
131
- open = false;
132
- }
133
- });
134
-
135
- // Click
136
- } else {
137
-
138
- // Click handler to show dropdown
139
- origin.unbind('click.' + origin.attr('id'));
140
- origin.bind('click.'+origin.attr('id'), function(e){
141
-
142
- if ( origin[0] == e.currentTarget && ($(e.target).closest('.dropdown-content').length === 0) ) {
143
- e.preventDefault(); // Prevents button click from moving window
144
- placeDropdown();
145
-
146
- }
147
- // If origin is clicked and menu is open, close menu
148
- else {
149
- if (origin.hasClass('active')) {
150
- hideDropdown();
151
- $(document).unbind('click.' + activates.attr('id'));
152
- }
153
- }
154
- // If menu open, add click close handler to document
155
- if (activates.hasClass('active')) {
156
- $(document).bind('click.'+ activates.attr('id'), function (e) {
157
- if (!activates.is(e.target) && !origin.is(e.target) && (!origin.find(e.target).length > 0) ) {
158
- hideDropdown();
159
- $(document).unbind('click.' + activates.attr('id'));
160
- }
161
- });
162
- }
163
- });
164
-
165
- } // End else
166
-
167
- // Listen to open and close event - useful for select component
168
- origin.on('open', placeDropdown);
169
- origin.on('close', hideDropdown);
170
-
171
-
172
- });
173
- }; // End dropdown plugin
174
-
175
- $(document).ready(function(){
176
- $('.dropdown-button').dropdown();
177
- });
178
- }( jQuery ));
@@ -1,456 +0,0 @@
1
- (function ($) {
2
- $(document).ready(function() {
3
-
4
- // Function to update labels of text fields
5
- Materialize.updateTextFields = function() {
6
- var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
7
- $(input_selector).each(function(index, element) {
8
- if ($(element).val().length > 0 || $(this).attr('placeholder') !== undefined || $(element)[0].validity.badInput === true) {
9
- $(this).siblings('label, i').addClass('active');
10
- }
11
- else {
12
- $(this).siblings('label, i').removeClass('active');
13
- }
14
- });
15
- };
16
-
17
- // Text based inputs
18
- var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
19
-
20
- // Handle HTML5 autofocus
21
- $('input[autofocus]').siblings('label, i').addClass('active');
22
-
23
- // Add active if form auto complete
24
- $(document).on('change', input_selector, function () {
25
- if($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
26
- $(this).siblings('label, i').addClass('active');
27
- }
28
- validate_field($(this));
29
- });
30
-
31
- // Add active if input element has been pre-populated on document ready
32
- $(document).ready(function() {
33
- Materialize.updateTextFields();
34
- });
35
-
36
- // HTML DOM FORM RESET handling
37
- $(document).on('reset', function(e) {
38
- var formReset = $(e.target);
39
- if (formReset.is('form')) {
40
- formReset.find(input_selector).removeClass('valid').removeClass('invalid');
41
- formReset.find(input_selector).each(function () {
42
- if ($(this).attr('value') === '') {
43
- $(this).siblings('label, i').removeClass('active');
44
- }
45
- });
46
-
47
- // Reset select
48
- formReset.find('select.initialized').each(function () {
49
- var reset_text = formReset.find('option[selected]').text();
50
- formReset.siblings('input.select-dropdown').val(reset_text);
51
- });
52
- }
53
- });
54
-
55
- // Add active when element has focus
56
- $(document).on('focus', input_selector, function () {
57
- $(this).siblings('label, i').addClass('active');
58
- });
59
-
60
- $(document).on('blur', input_selector, function () {
61
- var $inputElement = $(this);
62
- if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
63
- $inputElement.siblings('label, i').removeClass('active');
64
- }
65
- validate_field($inputElement);
66
- });
67
-
68
- validate_field = function(object) {
69
- var hasLength = object.attr('length') !== undefined;
70
- var lenAttr = parseInt(object.attr('length'));
71
- var len = object.val().length;
72
-
73
- if (object.val().length === 0 && object[0].validity.badInput === false) {
74
- if (object.hasClass('validate')) {
75
- object.removeClass('valid');
76
- object.removeClass('invalid');
77
- }
78
- }
79
- else {
80
- if (object.hasClass('validate')) {
81
- // Check for character counter attributes
82
- if ((object.is(':valid') && hasLength && (len < lenAttr)) || (object.is(':valid') && !hasLength)) {
83
- object.removeClass('invalid');
84
- object.addClass('valid');
85
- }
86
- else {
87
- object.removeClass('valid');
88
- object.addClass('invalid');
89
- }
90
- }
91
- }
92
- };
93
-
94
-
95
- // Textarea Auto Resize
96
- var hiddenDiv = $('.hiddendiv').first();
97
- if (!hiddenDiv.length) {
98
- hiddenDiv = $('<div class="hiddendiv common"></div>');
99
- $('body').append(hiddenDiv);
100
- }
101
- var text_area_selector = '.materialize-textarea';
102
-
103
- function textareaAutoResize($textarea) {
104
- // Set font properties of hiddenDiv
105
-
106
- var fontFamily = $textarea.css('font-family');
107
- var fontSize = $textarea.css('font-size');
108
-
109
- if (fontSize) { hiddenDiv.css('font-size', fontSize); }
110
- if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
111
-
112
- if ($textarea.attr('wrap') === "off") {
113
- hiddenDiv.css('overflow-wrap', "normal")
114
- .css('white-space', "pre");
115
- }
116
-
117
-
118
-
119
-
120
- hiddenDiv.text($textarea.val() + '\n');
121
- var content = hiddenDiv.html().replace(/\n/g, '<br>');
122
- hiddenDiv.html(content);
123
-
124
-
125
- // When textarea is hidden, width goes crazy.
126
- // Approximate with half of window size
127
-
128
- if ($textarea.is(':visible')) {
129
- hiddenDiv.css('width', $textarea.width());
130
- }
131
- else {
132
- hiddenDiv.css('width', $(window).width()/2);
133
- }
134
-
135
- $textarea.css('height', hiddenDiv.height());
136
- }
137
-
138
- $(text_area_selector).each(function () {
139
- var $textarea = $(this);
140
- if ($textarea.val().length) {
141
- textareaAutoResize($textarea);
142
- }
143
- });
144
-
145
- $('body').on('keyup keydown', text_area_selector, function () {
146
- textareaAutoResize($(this));
147
- });
148
-
149
-
150
- // File Input Path
151
- $('.file-field').each(function() {
152
- var path_input = $(this).find('input.file-path');
153
- $(this).find('input[type="file"]').change(function () {
154
- if ($(this)[0].files.length){
155
- path_input.val($(this)[0].files[0].name);
156
- path_input.trigger('change');
157
- }
158
- });
159
- });
160
-
161
-
162
-
163
- /****************
164
- * Range Input *
165
- ****************/
166
-
167
- var range_type = 'input[type=range]';
168
- var range_mousedown = false;
169
- var left;
170
-
171
- $(range_type).each(function () {
172
- var thumb = $('<span class="thumb"><span class="value"></span></span>');
173
- $(this).after(thumb);
174
- });
175
-
176
- var range_wrapper = '.range-field';
177
- $(document).on('change', range_type, function(e) {
178
- var thumb = $(this).siblings('.thumb');
179
- thumb.find('.value').html($(this).val());
180
- });
181
-
182
- $(document).on('mousedown touchstart', range_type, function(e) {
183
- var thumb = $(this).siblings('.thumb');
184
-
185
- // If thumb indicator does not exist yet, create it
186
- if (thumb.length <= 0) {
187
- thumb = $('<span class="thumb"><span class="value"></span></span>');
188
- $(this).append(thumb);
189
- }
190
-
191
- // Set indicator value
192
- thumb.find('.value').html($(this).val());
193
-
194
- range_mousedown = true;
195
- $(this).addClass('active');
196
-
197
- if (!thumb.hasClass('active')) {
198
- thumb.velocity({ height: "30px", width: "30px", top: "-20px", marginLeft: "-15px"}, { duration: 300, easing: 'easeOutExpo' });
199
- }
200
-
201
- if(e.pageX === undefined || e.pageX === null){//mobile
202
- left = e.originalEvent.touches[0].pageX - $(this).offset().left;
203
- }
204
- else{ // desktop
205
- left = e.pageX - $(this).offset().left;
206
- }
207
- var width = $(this).outerWidth();
208
-
209
- if (left < 0) {
210
- left = 0;
211
- }
212
- else if (left > width) {
213
- left = width;
214
- }
215
- thumb.addClass('active').css('left', left);
216
- thumb.find('.value').html($(this).val());
217
-
218
-
219
- });
220
-
221
- $(document).on('mouseup touchend', range_wrapper, function() {
222
- range_mousedown = false;
223
- $(this).removeClass('active');
224
- });
225
-
226
- $(document).on('mousemove touchmove', range_wrapper, function(e) {
227
- var thumb = $(this).children('.thumb');
228
- var left;
229
- if (range_mousedown) {
230
- if (!thumb.hasClass('active')) {
231
- thumb.velocity({ height: '30px', width: '30px', top: '-20px', marginLeft: '-15px'}, { duration: 300, easing: 'easeOutExpo' });
232
- }
233
- if (e.pageX === undefined || e.pageX === null) { //mobile
234
- left = e.originalEvent.touches[0].pageX - $(this).offset().left;
235
- }
236
- else{ // desktop
237
- left = e.pageX - $(this).offset().left;
238
- }
239
- var width = $(this).outerWidth();
240
-
241
- if (left < 0) {
242
- left = 0;
243
- }
244
- else if (left > width) {
245
- left = width;
246
- }
247
- thumb.addClass('active').css('left', left);
248
-
249
- }
250
-
251
- });
252
-
253
- $(document).on('mouseout touchleave', range_wrapper, function() {
254
- if (!range_mousedown) {
255
-
256
- var thumb = $(this).children('.thumb');
257
-
258
- if (thumb.hasClass('active')) {
259
- thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft: '-6px'}, { duration: 100 });
260
- }
261
- thumb.removeClass('active');
262
- }
263
- });
264
-
265
- }); // End of $(document).ready
266
-
267
-
268
-
269
-
270
- // Select Plugin
271
- $.fn.material_select = function (callback) {
272
- $(this).each(function(){
273
- $select = $(this);
274
-
275
- if ( $select.hasClass('browser-default')) {
276
- return; // Continue to next (return false breaks out of entire loop)
277
- }
278
-
279
- // Tear down structure if Select needs to be rebuilt
280
- var lastID = $select.data('select-id');
281
- if (lastID) {
282
- $select.parent().find('i').remove();
283
- $select.parent().find('input').remove();
284
-
285
- $select.unwrap();
286
- $('ul#select-options-'+lastID).remove();
287
- }
288
-
289
- // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
290
- if(callback === 'destroy') {
291
- $select.data('select-id', null).removeClass('initialized');
292
- return;
293
- }
294
-
295
- var uniqueID = Materialize.guid();
296
- $select.data('select-id', uniqueID);
297
- var wrapper = $('<div class="select-wrapper"></div>');
298
- wrapper.addClass($select.attr('class'));
299
- var options = $('<ul id="select-options-' + uniqueID+'" class="dropdown-content select-dropdown"></ul>');
300
- var selectOptions = $select.children('option');
301
-
302
- var label;
303
- if ($select.find('option:selected') !== undefined) {
304
- label = $select.find('option:selected');
305
- }
306
- else {
307
- label = options.first();
308
- }
309
-
310
-
311
- // Create Dropdown structure
312
- selectOptions.each(function () {
313
- // Add disabled attr if disabled
314
- options.append($('<li class="' + (($(this).is(':disabled')) ? 'disabled' : '') + '"><span>' + $(this).html() + '</span></li>'));
315
- });
316
-
317
-
318
- options.find('li').each(function (i) {
319
- var $curr_select = $select;
320
- $(this).click(function () {
321
- // Check if option element is disabled
322
- if (!$(this).hasClass('disabled')) {
323
- $curr_select.find('option').eq(i).prop('selected', true);
324
- // Trigger onchange() event
325
- $curr_select.trigger('change');
326
- $curr_select.siblings('input.select-dropdown').val($(this).text());
327
- if (typeof callback !== 'undefined') callback();
328
- }
329
- });
330
-
331
- });
332
-
333
- // Wrap Elements
334
- $select.wrap(wrapper);
335
- // Add Select Display Element
336
- var dropdownIcon = $('<span class="caret">&#9660;</span>');
337
- if ( $select.is(':disabled') )
338
- dropdownIcon.addClass('disabled');
339
-
340
- var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + (($select.is(':disabled')) ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID +'" value="'+ label.html() +'"/>');
341
- $select.before($newSelect);
342
- $newSelect.before(dropdownIcon);
343
-
344
- $('body').append(options);
345
- // Check if section element is disabled
346
- if (!$select.is(':disabled')) {
347
- $newSelect.dropdown({"hover": false});
348
- }
349
-
350
- // Copy tabindex
351
- if ($select.attr('tabindex')) {
352
- $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
353
- }
354
-
355
- $select.addClass('initialized');
356
-
357
- $newSelect.on('focus', function(){
358
- $(this).trigger('open');
359
- label = $(this).val();
360
- selectedOption = options.find('li').filter(function() {
361
- return $(this).text().toLowerCase() === label.toLowerCase();
362
- })[0];
363
- activateOption(options, selectedOption);
364
- });
365
-
366
- $newSelect.on('blur', function(){
367
- $(this).trigger('close');
368
- });
369
-
370
- // Make option as selected and scroll to selected position
371
- activateOption = function(collection, newOption) {
372
- collection.find('li.active').removeClass('active');
373
- $(newOption).addClass('active');
374
- collection.scrollTo(newOption);
375
- };
376
-
377
- // Allow user to search by typing
378
- // this array is cleared after 1 second
379
- filterQuery = [];
380
-
381
- onKeyDown = function(event){
382
- // TAB - switch to another input
383
- if(event.which == 9){
384
- $newSelect.trigger('close');
385
- return;
386
- }
387
-
388
- // ARROW DOWN WHEN SELECT IS CLOSED - open select options
389
- if(event.which == 40 && !options.is(":visible")){
390
- $newSelect.trigger('open');
391
- return;
392
- }
393
-
394
- // ENTER WHEN SELECT IS CLOSED - submit form
395
- if(event.which == 13 && !options.is(":visible")){
396
- return;
397
- }
398
-
399
- event.preventDefault();
400
-
401
- // CASE WHEN USER TYPE LETTERS
402
- letter = String.fromCharCode(event.which).toLowerCase();
403
- var nonLetters = [9,13,27,38,40];
404
- if (letter && (nonLetters.indexOf(event.which) === -1)){
405
- filterQuery.push(letter);
406
-
407
- string = filterQuery.join("");
408
-
409
- newOption = options.find('li').filter(function() {
410
- return $(this).text().toLowerCase().indexOf(string) === 0;
411
- })[0];
412
-
413
- if(newOption){
414
- activateOption(options, newOption);
415
- }
416
- }
417
-
418
- // ENTER - select option and close when select options are opened
419
- if(event.which == 13){
420
- activeOption = options.find('li.active:not(.disabled)')[0];
421
- if(activeOption){
422
- $(activeOption).trigger('click');
423
- $newSelect.trigger('close');
424
- }
425
- }
426
-
427
- // ARROW DOWN - move to next not disabled option
428
- if(event.which == 40){
429
- newOption = options.find('li.active').next('li:not(.disabled)')[0];
430
- if(newOption){
431
- activateOption(options, newOption);
432
- }
433
- }
434
-
435
- // ESC - close options
436
- if(event.which == 27){
437
- $newSelect.trigger('close');
438
- }
439
-
440
- // ARROW UP - move to previous not disabled option
441
- if(event.which == 38){
442
- newOption = options.find('li.active').prev('li:not(.disabled)')[0];
443
- if(newOption){
444
- activateOption(options, newOption);
445
- }
446
- }
447
-
448
- // Automaticaly clean filter query so user can search again by starting letters
449
- setTimeout(function(){ filterQuery = []; }, 1000);
450
- };
451
-
452
- $newSelect.on('keydown', onKeyDown);
453
- });
454
- };
455
-
456
- }( jQuery ));
@@ -1,36 +0,0 @@
1
- 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
- Materialize.elementOrParentIsFixed = function(element) {
17
- var $element = $(element);
18
- var $checkElements = $element.add($element.parents());
19
- var isFixed = false;
20
- $checkElements.each(function(){
21
- if ($(this).css("position") === "fixed") {
22
- isFixed = true;
23
- return false;
24
- }
25
- });
26
- return isFixed;
27
- };
28
-
29
- // Velocity has conflicts when loaded with jQuery, this will check for it
30
- var Vel;
31
- if ($) {
32
- Vel = $.Velocity;
33
- }
34
- else {
35
- Vel = Velocity;
36
- }