materialize-sass 0.95.3.3 → 0.95.3.4
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.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/app/assets/javascripts/materialize-sprockets.js +2 -1
- data/app/assets/javascripts/materialize/buttons.js +4 -4
- data/app/assets/javascripts/materialize/collapsible.js +11 -14
- data/app/assets/javascripts/materialize/dropdown.js +5 -1
- data/app/assets/javascripts/materialize/forms.js +157 -151
- data/app/assets/javascripts/materialize/global.js +18 -0
- data/app/assets/javascripts/materialize/init.js +5 -1
- data/app/assets/javascripts/materialize/leanModal.js +0 -1
- data/app/assets/javascripts/materialize/pushpin.js +1 -14
- data/app/assets/javascripts/materialize/scrollFire.js +60 -21
- data/app/assets/javascripts/materialize/scrollspy.js +4 -7
- data/app/assets/javascripts/materialize/sideNav.js +58 -21
- data/app/assets/javascripts/materialize/slider.js +1 -1
- data/app/assets/javascripts/materialize/toasts.js +90 -73
- data/app/assets/javascripts/materialize/transitions.js +57 -61
- data/app/assets/javascripts/materialize/waves.js +6 -3
- data/app/assets/stylesheets/materialize/components/_buttons.scss +3 -3
- data/app/assets/stylesheets/materialize/components/_cards.scss +5 -7
- data/app/assets/stylesheets/materialize/components/_collapsible.scss +3 -11
- data/app/assets/stylesheets/materialize/components/_dropdown.scss +1 -1
- data/app/assets/stylesheets/materialize/components/_form.scss +178 -162
- data/app/assets/stylesheets/materialize/components/_global.scss +11 -10
- data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +766 -2230
- data/app/assets/stylesheets/materialize/components/_materialbox.scss +2 -3
- data/app/assets/stylesheets/materialize/components/_modal.scss +3 -3
- data/app/assets/stylesheets/materialize/components/_navbar.scss +4 -7
- data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -40
- data/app/assets/stylesheets/materialize/components/_preloader.scss +2 -4
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +9 -9
- data/app/assets/stylesheets/materialize/components/_slider.scss +6 -6
- data/app/assets/stylesheets/materialize/components/_table_of_contents.scss +1 -1
- data/app/assets/stylesheets/materialize/components/_tabs.scss +2 -2
- data/app/assets/stylesheets/materialize/components/_toast.scss +4 -5
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +2 -2
- data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +20 -47
- data/lib/materialize-sass.rb +75 -6
- data/lib/materialize-sass/engine.rb +13 -0
- data/lib/materialize-sass/version.rb +1 -1
- metadata +9 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd2c374425f1d4f9baa6937139a349103e5de5bc
|
4
|
+
data.tar.gz: 2dd3747f6efe6a109ed48261bdbd0e8f3bd7a5c7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bca13c7a46a9b929a9646cf3c189abfd25e3da673c6a9d319c3c1d45b3bdc03363a5b04447158aabedcd4b2627f2c11174759163e7d6360c4ce1275905e7ac3e
|
7
|
+
data.tar.gz: eaf0bc50a9f7f63f8841f84403cabb4b4f0bec7c7b75c7fc6f1d321ef8c988e0fb8c95765f02d435e09d82d8701460044e168a28eb65483808c9a81af474719d
|
data/README.md
CHANGED
@@ -43,7 +43,7 @@ $ rm app/assets/stylesheets/application.css
|
|
43
43
|
|
44
44
|
### b. JavaScript
|
45
45
|
|
46
|
-
Require
|
46
|
+
Require Materialize javascripts in `app/assets/javascripts/application.js`:
|
47
47
|
|
48
48
|
```js
|
49
49
|
//= require jquery
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -2,6 +2,7 @@
|
|
2
2
|
//= require ./materialize/animation
|
3
3
|
//= require ./materialize/velocity.min
|
4
4
|
//= require ./materialize/hammer.min
|
5
|
+
//= require ./materialize/global
|
5
6
|
//= require ./materialize/jquery.hammer
|
6
7
|
//= require ./materialize/collapsible
|
7
8
|
//= require ./materialize/dropdown
|
@@ -13,7 +14,6 @@
|
|
13
14
|
//= require ./materialize/waves
|
14
15
|
//= require ./materialize/toasts
|
15
16
|
//= require ./materialize/sideNav
|
16
|
-
//= require ./materialize/scrollFire
|
17
17
|
//= require ./materialize/scrollspy
|
18
18
|
//= require ./materialize/forms
|
19
19
|
//= require ./materialize/slider
|
@@ -21,5 +21,6 @@
|
|
21
21
|
//= require ./materialize/pushpin
|
22
22
|
//= require ./materialize/buttons
|
23
23
|
//= require ./materialize/transitions
|
24
|
+
//= require ./materialize/scrollFire
|
24
25
|
//= require ./materialize/date_picker/picker
|
25
26
|
//= require ./materialize/date_picker/picker.date
|
@@ -7,12 +7,12 @@
|
|
7
7
|
$(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn', function(e) {
|
8
8
|
var $this = $(this);
|
9
9
|
|
10
|
-
$this.find('ul
|
10
|
+
$this.find('ul .btn-floating').velocity(
|
11
11
|
{ scaleY: ".4", scaleX: ".4", translateY: "40px"},
|
12
12
|
{ duration: 0 });
|
13
13
|
|
14
14
|
var time = 0;
|
15
|
-
$this.find('ul
|
15
|
+
$this.find('ul .btn-floating').reverse().each(function () {
|
16
16
|
$(this).velocity(
|
17
17
|
{ opacity: "1", scaleX: "1", scaleY: "1", translateY: "0"},
|
18
18
|
{ duration: 80, delay: time });
|
@@ -25,8 +25,8 @@
|
|
25
25
|
var $this = $(this);
|
26
26
|
|
27
27
|
var time = 0;
|
28
|
-
$this.find('ul
|
29
|
-
$this.find('ul
|
28
|
+
$this.find('ul .btn-floating').velocity("stop", true);
|
29
|
+
$this.find('ul .btn-floating').velocity(
|
30
30
|
{ opacity: "0", scaleX: ".4", scaleY: ".4", translateY: "40px"},
|
31
31
|
{ duration: 80 });
|
32
32
|
});
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
var $this = $(this);
|
13
13
|
|
14
|
-
var $panel_headers = $(this).find('.collapsible-header');
|
14
|
+
var $panel_headers = $(this).find('> li > .collapsible-header');
|
15
15
|
|
16
16
|
var collapsible_type = $this.data("collapsible");
|
17
17
|
|
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
// Accordion Open
|
28
28
|
function accordionOpen(object) {
|
29
|
-
$panel_headers = $this.find('.collapsible-header');
|
29
|
+
$panel_headers = $this.find('> li > .collapsible-header');
|
30
30
|
object.parent().toggleClass('active');
|
31
31
|
if (object.parent().hasClass('active')){
|
32
32
|
object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false});
|
@@ -37,8 +37,9 @@
|
|
37
37
|
$panel_headers.not(object).parent().removeClass('active');
|
38
38
|
$panel_headers.not(object).parent().children('.collapsible-body').stop(true,false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false});
|
39
39
|
}
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
// Expandable Open
|
42
|
+
function expandableOpen(object) {
|
42
43
|
object.parent().toggleClass('active');
|
43
44
|
if (object.parent().hasClass('active')){
|
44
45
|
object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false});
|
@@ -53,26 +54,22 @@
|
|
53
54
|
|
54
55
|
|
55
56
|
if (options.accordion || collapsible_type == "accordion" || collapsible_type == undefined) { // Handle Accordion
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
accordionOpen($(e.currentTarget));
|
57
|
+
// Add click handler to only direct collapsible header children
|
58
|
+
$this.find('> li > .collapsible-header').on('click.collapse', function (e) {
|
59
|
+
accordionOpen($(e.target));
|
60
60
|
});
|
61
|
-
|
62
61
|
// Open first active
|
63
62
|
accordionOpen($panel_headers.filter('.active').first());
|
64
63
|
}
|
65
64
|
else { // Handle Expandables
|
66
65
|
$panel_headers.each(function () {
|
67
|
-
|
68
|
-
// Event delegation to open collapsible section
|
66
|
+
// Add click handler to only direct collapsible header children
|
69
67
|
$(this).on('click.collapse', function (e) {
|
70
|
-
|
68
|
+
expandableOpen($(e.target));
|
71
69
|
});
|
72
|
-
|
73
70
|
// Open any bodies that have the active class
|
74
71
|
if ($(this).hasClass('active')) {
|
75
|
-
|
72
|
+
expandableOpen($(this));
|
76
73
|
}
|
77
74
|
|
78
75
|
});
|
@@ -12,7 +12,7 @@
|
|
12
12
|
inDuration: 300,
|
13
13
|
outDuration: 225,
|
14
14
|
constrain_width: true, // Constrains width of dropdown to the activator
|
15
|
-
hover:
|
15
|
+
hover: false,
|
16
16
|
gutter: 0, // Spacing from edge
|
17
17
|
belowOrigin: false
|
18
18
|
}
|
@@ -177,4 +177,8 @@
|
|
177
177
|
|
178
178
|
});
|
179
179
|
}; // End dropdown plugin
|
180
|
+
|
181
|
+
$(document).ready(function(){
|
182
|
+
$('.dropdown-button').dropdown();
|
183
|
+
});
|
180
184
|
}( jQuery ));
|
@@ -1,12 +1,28 @@
|
|
1
1
|
(function ($) {
|
2
2
|
$(document).ready(function() {
|
3
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) {
|
9
|
+
$(this).siblings('label, i').addClass('active');
|
10
|
+
}
|
11
|
+
else {
|
12
|
+
$(this).siblings('label, i').removeClass('active');
|
13
|
+
}
|
14
|
+
});
|
15
|
+
}
|
16
|
+
|
4
17
|
// Text based inputs
|
5
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';
|
6
19
|
|
20
|
+
// Handle HTML5 autofocus
|
21
|
+
$('input[autofocus]').siblings('label, i').addClass('active');
|
22
|
+
|
7
23
|
// Add active if form auto complete
|
8
24
|
$(document).on('change', input_selector, function () {
|
9
|
-
if($(this).val().length !== 0) {
|
25
|
+
if($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
|
10
26
|
$(this).siblings('label, i').addClass('active');
|
11
27
|
}
|
12
28
|
validate_field($(this));
|
@@ -14,11 +30,7 @@
|
|
14
30
|
|
15
31
|
// Add active if input element has been pre-populated on document ready
|
16
32
|
$(document).ready(function() {
|
17
|
-
|
18
|
-
if($(element).val().length > 0) {
|
19
|
-
$(this).siblings('label, i').addClass('active');
|
20
|
-
}
|
21
|
-
});
|
33
|
+
Materialize.updateTextFields();
|
22
34
|
});
|
23
35
|
|
24
36
|
// HTML DOM FORM RESET handling
|
@@ -40,7 +52,7 @@
|
|
40
52
|
});
|
41
53
|
|
42
54
|
$(document).on('blur', input_selector, function () {
|
43
|
-
if ($(this).val().length === 0) {
|
55
|
+
if ($(this).val().length === 0 && $(this).attr('placeholder') === undefined) {
|
44
56
|
$(this).siblings('label, i').removeClass('active');
|
45
57
|
}
|
46
58
|
validate_field($(this));
|
@@ -110,7 +122,7 @@
|
|
110
122
|
$('.file-field').each(function() {
|
111
123
|
var path_input = $(this).find('input.file-path');
|
112
124
|
$(this).find('input[type="file"]').change(function () {
|
113
|
-
path_input.val($(this).
|
125
|
+
path_input.val($(this)[0].files[0].name);
|
114
126
|
path_input.trigger('change');
|
115
127
|
});
|
116
128
|
});
|
@@ -191,187 +203,181 @@
|
|
191
203
|
}
|
192
204
|
});
|
193
205
|
|
194
|
-
|
206
|
+
}); // End of $(document).ready
|
195
207
|
|
196
|
-
// Select Plugin
|
197
|
-
$.fn.material_select = function (callback) {
|
198
|
-
$(this).each(function(){
|
199
|
-
$select = $(this);
|
200
208
|
|
201
|
-
if ( $select.hasClass('browser-default')) {
|
202
|
-
return; // Continue to next (return false breaks out of entire loop)
|
203
|
-
}
|
204
209
|
|
205
|
-
// Tear down structure if Select needs to be rebuilt
|
206
|
-
var lastID = $select.data('select-id');
|
207
|
-
if (lastID) {
|
208
|
-
$select.parent().find('i').remove();
|
209
|
-
$select.parent().find('input').remove();
|
210
210
|
|
211
|
-
|
212
|
-
|
213
|
-
|
211
|
+
// Select Plugin
|
212
|
+
$.fn.material_select = function (callback) {
|
213
|
+
$(this).each(function(){
|
214
|
+
$select = $(this);
|
214
215
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
var options = $('<ul id="select-options-' + uniqueID+'" class="dropdown-content select-dropdown"></ul>');
|
219
|
-
var selectOptions = $select.children('option');
|
220
|
-
if ($select.find('option:selected') !== undefined) {
|
221
|
-
var label = $select.find('option:selected');
|
222
|
-
}
|
223
|
-
else {
|
224
|
-
var label = options.first();
|
225
|
-
}
|
216
|
+
if ( $select.hasClass('browser-default')) {
|
217
|
+
return; // Continue to next (return false breaks out of entire loop)
|
218
|
+
}
|
226
219
|
|
220
|
+
// Tear down structure if Select needs to be rebuilt
|
221
|
+
var lastID = $select.data('select-id');
|
222
|
+
if (lastID) {
|
223
|
+
$select.parent().find('i').remove();
|
224
|
+
$select.parent().find('input').remove();
|
227
225
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
options.append($('<li class="' + (($(this).is(':disabled')) ? 'disabled' : '') + '"><span>' + $(this).html() + '</span></li>'));
|
232
|
-
});
|
226
|
+
$select.unwrap();
|
227
|
+
$('ul#select-options-'+lastID).remove();
|
228
|
+
}
|
233
229
|
|
230
|
+
var uniqueID = Materialize.guid();
|
231
|
+
$select.data('select-id', uniqueID);
|
232
|
+
var wrapper = $('<div class="select-wrapper"></div>');
|
233
|
+
var options = $('<ul id="select-options-' + uniqueID+'" class="dropdown-content select-dropdown"></ul>');
|
234
|
+
var selectOptions = $select.children('option');
|
235
|
+
if ($select.find('option:selected') !== undefined) {
|
236
|
+
var label = $select.find('option:selected');
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
var label = options.first();
|
240
|
+
}
|
234
241
|
|
235
|
-
options.find('li').each(function (i) {
|
236
|
-
var $curr_select = $select;
|
237
|
-
$(this).click(function () {
|
238
|
-
// Check if option element is disabled
|
239
|
-
if (!$(this).hasClass('disabled')) {
|
240
|
-
$curr_select.find('option').eq(i).prop('selected', true);
|
241
|
-
// Trigger onchange() event
|
242
|
-
$curr_select.trigger('change');
|
243
|
-
$curr_select.siblings('input.select-dropdown').val($(this).text());
|
244
|
-
if (typeof callback !== 'undefined') callback();
|
245
|
-
}
|
246
|
-
});
|
247
242
|
|
248
|
-
|
243
|
+
// Create Dropdown structure
|
244
|
+
selectOptions.each(function () {
|
245
|
+
// Add disabled attr if disabled
|
246
|
+
options.append($('<li class="' + (($(this).is(':disabled')) ? 'disabled' : '') + '"><span>' + $(this).html() + '</span></li>'));
|
247
|
+
});
|
249
248
|
|
250
|
-
// Wrap Elements
|
251
|
-
$select.wrap(wrapper);
|
252
|
-
// Add Select Display Element
|
253
|
-
var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + (($select.is(':disabled')) ? 'disabled' : '')
|
254
|
-
+ ' data-activates="select-options-' + uniqueID +'" value="'+ label.html() +'"/><i class="mdi-navigation-arrow-drop-down">');
|
255
|
-
$select.before($newSelect);
|
256
|
-
$('body').append(options);
|
257
|
-
// Check if section element is disabled
|
258
|
-
if (!$select.is(':disabled')) {
|
259
|
-
$newSelect.dropdown({"hover": false});
|
260
|
-
}
|
261
|
-
$select.addClass('initialized');
|
262
249
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
250
|
+
options.find('li').each(function (i) {
|
251
|
+
var $curr_select = $select;
|
252
|
+
$(this).click(function () {
|
253
|
+
// Check if option element is disabled
|
254
|
+
if (!$(this).hasClass('disabled')) {
|
255
|
+
$curr_select.find('option').eq(i).prop('selected', true);
|
256
|
+
// Trigger onchange() event
|
257
|
+
$curr_select.trigger('change');
|
258
|
+
$curr_select.siblings('input.select-dropdown').val($(this).text());
|
259
|
+
if (typeof callback !== 'undefined') callback();
|
260
|
+
}
|
270
261
|
});
|
271
262
|
|
272
|
-
|
273
|
-
$(this).trigger('close');
|
274
|
-
});
|
263
|
+
});
|
275
264
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
265
|
+
// Wrap Elements
|
266
|
+
$select.wrap(wrapper);
|
267
|
+
// Add Select Display Element
|
268
|
+
var dropdownIcon = $('<i class="mdi-navigation-arrow-drop-down"></i>');
|
269
|
+
if ( $select.is(':disabled') )
|
270
|
+
dropdownIcon.addClass('disabled');
|
271
|
+
|
272
|
+
var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + (($select.is(':disabled')) ? 'disabled' : '')
|
273
|
+
+ ' data-activates="select-options-' + uniqueID +'" value="'+ label.html() +'"/>');
|
274
|
+
$select.before($newSelect);
|
275
|
+
$newSelect.before(dropdownIcon);
|
276
|
+
|
277
|
+
$('body').append(options);
|
278
|
+
// Check if section element is disabled
|
279
|
+
if (!$select.is(':disabled')) {
|
280
|
+
$newSelect.dropdown({"hover": false});
|
281
|
+
}
|
282
|
+
$select.addClass('initialized');
|
283
|
+
|
284
|
+
$newSelect.on('focus', function(){
|
285
|
+
$(this).trigger('open');
|
286
|
+
label = $(this).val();
|
287
|
+
selectedOption = options.find('li').filter(function() {
|
288
|
+
return $(this).text().toLowerCase() === label.toLowerCase();
|
289
|
+
})[0];
|
290
|
+
activateOption(options, selectedOption);
|
291
|
+
});
|
282
292
|
|
283
|
-
|
284
|
-
|
285
|
-
|
293
|
+
$newSelect.on('blur', function(){
|
294
|
+
$(this).trigger('close');
|
295
|
+
});
|
286
296
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
297
|
+
// Make option as selected and scroll to selected position
|
298
|
+
activateOption = function(collection, newOption) {
|
299
|
+
collection.find('li.active').removeClass('active');
|
300
|
+
$(newOption).addClass('active');
|
301
|
+
collection.scrollTo(newOption);
|
302
|
+
}
|
293
303
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
return
|
298
|
-
}
|
304
|
+
// Allow user to search by typing
|
305
|
+
// this array is cleared after 1 second
|
306
|
+
filterQuery = []
|
299
307
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
308
|
+
onKeyDown = function(event){
|
309
|
+
// TAB - switch to another input
|
310
|
+
if(event.which == 9){
|
311
|
+
$newSelect.trigger('close');
|
312
|
+
return
|
313
|
+
}
|
304
314
|
|
305
|
-
|
315
|
+
// ARROW DOWN WHEN SELECT IS CLOSED - open select options
|
316
|
+
if(event.which == 40 && !options.is(":visible")){
|
317
|
+
$newSelect.trigger('open');
|
318
|
+
return
|
319
|
+
}
|
306
320
|
|
307
|
-
|
308
|
-
|
321
|
+
// ENTER WHEN SELECT IS CLOSED - submit form
|
322
|
+
if(event.which == 13 && !options.is(":visible")){
|
323
|
+
return
|
324
|
+
}
|
309
325
|
|
310
|
-
|
311
|
-
filterQuery.push(letter);
|
326
|
+
event.preventDefault();
|
312
327
|
|
313
|
-
|
328
|
+
// CASE WHEN USER TYPE LETTERS
|
329
|
+
letter = String.fromCharCode(event.which).toLowerCase();
|
314
330
|
|
315
|
-
|
316
|
-
|
317
|
-
})[0];
|
331
|
+
if (letter){
|
332
|
+
filterQuery.push(letter);
|
318
333
|
|
319
|
-
|
320
|
-
activateOption(options, newOption);
|
321
|
-
}
|
322
|
-
}
|
334
|
+
string = filterQuery.join("");
|
323
335
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
if(activeOption){
|
328
|
-
$(activeOption).trigger('click');
|
329
|
-
$newSelect.trigger('close');
|
330
|
-
}
|
331
|
-
}
|
336
|
+
newOption = options.find('li').filter(function() {
|
337
|
+
return $(this).text().toLowerCase().indexOf(string) === 0;
|
338
|
+
})[0];
|
332
339
|
|
333
|
-
|
334
|
-
|
335
|
-
newOption = options.find('li.active').next('li:not(.disabled)')[0];
|
336
|
-
if(newOption){
|
337
|
-
activateOption(options, newOption);
|
338
|
-
}
|
340
|
+
if(newOption){
|
341
|
+
activateOption(options, newOption);
|
339
342
|
}
|
343
|
+
}
|
340
344
|
|
341
|
-
|
342
|
-
|
345
|
+
// ENTER - select option and close when select options are opened
|
346
|
+
if(event.which == 13){
|
347
|
+
activeOption = options.find('li.active:not(.disabled)')[0];
|
348
|
+
if(activeOption){
|
349
|
+
$(activeOption).trigger('click');
|
343
350
|
$newSelect.trigger('close');
|
344
351
|
}
|
352
|
+
}
|
345
353
|
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
}
|
354
|
+
// ARROW DOWN - move to next not disabled option
|
355
|
+
if(event.which == 40){
|
356
|
+
newOption = options.find('li.active').next('li:not(.disabled)')[0];
|
357
|
+
if(newOption){
|
358
|
+
activateOption(options, newOption);
|
352
359
|
}
|
360
|
+
}
|
353
361
|
|
354
|
-
|
355
|
-
|
362
|
+
// ESC - close options
|
363
|
+
if(event.which == 27){
|
364
|
+
$newSelect.trigger('close');
|
356
365
|
}
|
357
366
|
|
358
|
-
|
359
|
-
|
360
|
-
|
367
|
+
// ARROW UP - move to previous not disabled option
|
368
|
+
if(event.which == 38){
|
369
|
+
newOption = options.find('li.active').prev('li:not(.disabled)')[0];
|
370
|
+
if(newOption){
|
371
|
+
activateOption(options, newOption);
|
372
|
+
}
|
373
|
+
}
|
361
374
|
|
362
|
-
|
363
|
-
|
364
|
-
function s4() {
|
365
|
-
return Math.floor((1 + Math.random()) * 0x10000)
|
366
|
-
.toString(16)
|
367
|
-
.substring(1);
|
375
|
+
// Automaticaly clean filter query so user can search again by starting letters
|
376
|
+
setTimeout(function(){filterQuery = []}, 1000)
|
368
377
|
}
|
369
|
-
return function() {
|
370
|
-
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
371
|
-
s4() + '-' + s4() + s4() + s4();
|
372
|
-
};
|
373
|
-
})();
|
374
378
|
|
375
|
-
|
379
|
+
$newSelect.on('keydown', onKeyDown);
|
380
|
+
});
|
381
|
+
}
|
376
382
|
|
377
383
|
}( jQuery ));
|