mtl 1.1.7 → 1.1.8
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 +4 -4
- data/app/assets/javascripts/mtl.js +1 -1
- data/app/assets/stylesheets/mtl/all.scss +4 -0
- data/lib/mtl/version.rb +2 -2
- data/package.json +1 -1
- data/vendor/assets/javascripts/materialize/cards.js +13 -3
- data/vendor/assets/javascripts/materialize/carousel.js +78 -28
- data/vendor/assets/javascripts/materialize/chips.js +27 -27
- data/vendor/assets/javascripts/materialize/collapsible.js +34 -11
- data/vendor/assets/javascripts/materialize/date_picker/picker.date.js +137 -136
- data/vendor/assets/javascripts/materialize/date_picker/picker.js +0 -1
- data/vendor/assets/javascripts/materialize/date_picker/picker.time.js +686 -0
- data/vendor/assets/javascripts/materialize/dropdown.js +19 -12
- data/vendor/assets/javascripts/materialize/forms.js +98 -72
- data/vendor/assets/javascripts/materialize/global.js +14 -1
- data/vendor/assets/javascripts/materialize/jquery.easing.1.4.js +166 -0
- data/vendor/assets/javascripts/materialize/materialbox.js +48 -44
- data/vendor/assets/javascripts/materialize/modal.js +2 -1
- data/vendor/assets/javascripts/materialize/scrollspy.js +10 -5
- data/vendor/assets/javascripts/materialize/sideNav.js +44 -14
- data/vendor/assets/javascripts/materialize/slider.js +3 -3
- data/vendor/assets/javascripts/materialize/tabs.js +17 -7
- data/vendor/assets/javascripts/materialize/tapTarget.js +187 -0
- data/vendor/assets/javascripts/materialize/transitions.js +2 -2
- data/vendor/assets/javascripts/materialize/waves.js +1 -1
- data/vendor/assets/javascripts/pdfobject.js +1 -1
- data/vendor/assets/stylesheets/materialize/_buttons.scss +11 -12
- data/vendor/assets/stylesheets/materialize/_cards.scss +3 -0
- data/vendor/assets/stylesheets/materialize/_carousel.scss +7 -1
- data/vendor/assets/stylesheets/materialize/_chips.scss +6 -1
- data/vendor/assets/stylesheets/materialize/_collapsible.scss +1 -0
- data/vendor/assets/stylesheets/materialize/_color.scss +1 -1
- data/vendor/assets/stylesheets/materialize/_dropdown.scss +3 -0
- data/vendor/assets/stylesheets/materialize/_global.scss +18 -23
- data/vendor/assets/stylesheets/materialize/_grid.scss +44 -35
- data/vendor/assets/stylesheets/materialize/_modal.scss +2 -2
- data/vendor/assets/stylesheets/materialize/_preloader.scss +3 -3
- data/vendor/assets/stylesheets/materialize/_pulse.scss +34 -0
- data/vendor/assets/stylesheets/materialize/_sideNav.scss +17 -11
- data/vendor/assets/stylesheets/materialize/_tapTarget.scss +103 -0
- data/vendor/assets/stylesheets/materialize/_variables.scss +15 -6
- data/vendor/assets/stylesheets/materialize/date_picker/_default.date.scss +48 -27
- data/vendor/assets/stylesheets/materialize/date_picker/_default.scss +10 -0
- data/vendor/assets/stylesheets/materialize/date_picker/_default.time.scss +155 -13
- data/vendor/assets/stylesheets/materialize/forms/_input-fields.scss +18 -12
- data/vendor/assets/stylesheets/materialize/forms/_range.scss +3 -2
- data/vendor/assets/stylesheets/materialize/forms/_switches.scss +30 -17
- metadata +7 -7
- data/vendor/assets/javascripts/materialize/init.js +0 -211
- data/vendor/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
- data/vendor/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
- data/vendor/assets/javascripts/materialize/prism.js +0 -8
- data/vendor/assets/stylesheets/materialize/_prefixer.scss +0 -384
@@ -150,6 +150,14 @@
|
|
150
150
|
leftPosition = origin.position().left + gutterSpacing;
|
151
151
|
}
|
152
152
|
else if (currAlignment === 'right') {
|
153
|
+
// Material icons fix
|
154
|
+
activates
|
155
|
+
.stop(true, true)
|
156
|
+
.css({
|
157
|
+
opacity: 0,
|
158
|
+
left: 0
|
159
|
+
})
|
160
|
+
|
153
161
|
var offsetRight = origin.position().left + origin.outerWidth() - activates.outerWidth();
|
154
162
|
gutterSpacing = -curr_options.gutter;
|
155
163
|
leftPosition = offsetRight + gutterSpacing;
|
@@ -162,9 +170,8 @@
|
|
162
170
|
left: leftPosition + scrollXOffset
|
163
171
|
});
|
164
172
|
|
165
|
-
|
166
173
|
// Show dropdown
|
167
|
-
activates
|
174
|
+
activates
|
168
175
|
.slideDown({
|
169
176
|
queue: false,
|
170
177
|
duration: curr_options.inDuration,
|
@@ -176,12 +183,12 @@
|
|
176
183
|
.animate( {opacity: 1}, {queue: false, duration: curr_options.inDuration, easing: 'easeOutSine'});
|
177
184
|
|
178
185
|
// Add click close handler to document
|
179
|
-
|
180
|
-
|
186
|
+
setTimeout(function() {
|
187
|
+
$(document).on('click.'+ activates.attr('id'), function (e) {
|
181
188
|
hideDropdown();
|
182
|
-
$(document).
|
183
|
-
}
|
184
|
-
});
|
189
|
+
$(document).off('click.'+ activates.attr('id'));
|
190
|
+
});
|
191
|
+
}, 0);
|
185
192
|
}
|
186
193
|
|
187
194
|
function hideDropdown() {
|
@@ -190,14 +197,14 @@
|
|
190
197
|
activates.fadeOut(curr_options.outDuration);
|
191
198
|
activates.removeClass('active');
|
192
199
|
origin.removeClass('active');
|
193
|
-
$(document).
|
200
|
+
$(document).off('click.'+ activates.attr('id'));
|
194
201
|
setTimeout(function() { activates.css('max-height', ''); }, curr_options.outDuration);
|
195
202
|
}
|
196
203
|
|
197
204
|
// Hover
|
198
205
|
if (curr_options.hover) {
|
199
206
|
var open = false;
|
200
|
-
origin.
|
207
|
+
origin.off('click.' + origin.attr('id'));
|
201
208
|
// Hover handler to show dropdown
|
202
209
|
origin.on('mouseenter', function(e){ // Mouse over
|
203
210
|
if (open === false) {
|
@@ -227,8 +234,8 @@
|
|
227
234
|
// Click
|
228
235
|
} else {
|
229
236
|
// Click handler to show dropdown
|
230
|
-
origin.
|
231
|
-
origin.
|
237
|
+
origin.off('click.' + origin.attr('id'));
|
238
|
+
origin.on('click.'+origin.attr('id'), function(e){
|
232
239
|
if (!isFocused) {
|
233
240
|
if ( origin[0] == e.currentTarget &&
|
234
241
|
!origin.hasClass('active') &&
|
@@ -242,7 +249,7 @@
|
|
242
249
|
// If origin is clicked and menu is open, close menu
|
243
250
|
else if (origin.hasClass('active')) {
|
244
251
|
hideDropdown();
|
245
|
-
$(document).
|
252
|
+
$(document).off('click.'+ activates.attr('id'));
|
246
253
|
}
|
247
254
|
}
|
248
255
|
});
|
@@ -6,7 +6,7 @@
|
|
6
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
7
|
$(input_selector).each(function(index, element) {
|
8
8
|
var $this = $(this);
|
9
|
-
if ($(element).val().length > 0 || element.autofocus || $this.attr('placeholder') !== undefined) {
|
9
|
+
if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
|
10
10
|
$this.siblings('label').addClass('active');
|
11
11
|
} else if ($(element)[0].validity) {
|
12
12
|
$this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
|
@@ -129,9 +129,14 @@
|
|
129
129
|
if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
|
130
130
|
if (lineHeight) { hiddenDiv.css('line-height', lineHeight); }
|
131
131
|
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
// Set original-height, if none
|
133
|
+
if (!$textarea.data('original-height')) {
|
134
|
+
$textarea.data('original-height', $textarea.height());
|
135
|
+
}
|
136
|
+
|
137
|
+
if ($textarea.attr('wrap') === 'off') {
|
138
|
+
hiddenDiv.css('overflow-wrap', 'normal')
|
139
|
+
.css('white-space', 'pre');
|
135
140
|
}
|
136
141
|
|
137
142
|
hiddenDiv.text($textarea.val() + '\n');
|
@@ -149,14 +154,32 @@
|
|
149
154
|
hiddenDiv.css('width', $(window).width()/2);
|
150
155
|
}
|
151
156
|
|
152
|
-
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Resize if the new height is greater than the
|
160
|
+
* original height of the textarea
|
161
|
+
*/
|
162
|
+
if ($textarea.data('original-height') <= hiddenDiv.height()) {
|
163
|
+
$textarea.css('height', hiddenDiv.height());
|
164
|
+
} else if ($textarea.val().length < $textarea.data('previous-length')) {
|
165
|
+
/**
|
166
|
+
* In case the new height is less than original height, it
|
167
|
+
* means the textarea has less text than before
|
168
|
+
* So we set the height to the original one
|
169
|
+
*/
|
170
|
+
$textarea.css('height', $textarea.data('original-height'));
|
171
|
+
}
|
172
|
+
$textarea.data('previous-length', $textarea.val().length);
|
153
173
|
}
|
154
174
|
|
155
175
|
$(text_area_selector).each(function () {
|
156
176
|
var $textarea = $(this);
|
157
|
-
|
158
|
-
|
159
|
-
|
177
|
+
/**
|
178
|
+
* Instead of resizing textarea on document load,
|
179
|
+
* store the original height and the original length
|
180
|
+
*/
|
181
|
+
$textarea.data('original-height', $textarea.height());
|
182
|
+
$textarea.data('previous-length', $textarea.val().length);
|
160
183
|
});
|
161
184
|
|
162
185
|
$('body').on('keyup keydown autoresize', text_area_selector, function () {
|
@@ -189,15 +212,35 @@
|
|
189
212
|
$(this).after(thumb);
|
190
213
|
});
|
191
214
|
|
215
|
+
var showRangeBubble = function(thumb) {
|
216
|
+
var paddingLeft = parseInt(thumb.parent().css('padding-left'));
|
217
|
+
var marginLeft = (-7 + paddingLeft) + 'px';
|
218
|
+
thumb.velocity({ height: "30px", width: "30px", top: "-30px", marginLeft: marginLeft}, { duration: 300, easing: 'easeOutExpo' });
|
219
|
+
};
|
220
|
+
|
221
|
+
var calcRangeOffset = function(range) {
|
222
|
+
var width = range.width() - 15;
|
223
|
+
var max = parseFloat(range.attr('max'));
|
224
|
+
var min = parseFloat(range.attr('min'));
|
225
|
+
var percent = (parseFloat(range.val()) - min) / (max - min);
|
226
|
+
return percent * width;
|
227
|
+
}
|
228
|
+
|
192
229
|
var range_wrapper = '.range-field';
|
193
230
|
$(document).on('change', range_type, function(e) {
|
194
231
|
var thumb = $(this).siblings('.thumb');
|
195
232
|
thumb.find('.value').html($(this).val());
|
233
|
+
|
234
|
+
if (!thumb.hasClass('active')) {
|
235
|
+
showRangeBubble(thumb);
|
236
|
+
}
|
237
|
+
|
238
|
+
var offsetLeft = calcRangeOffset($(this));
|
239
|
+
thumb.addClass('active').css('left', offsetLeft);
|
196
240
|
});
|
197
241
|
|
198
|
-
$(document).on('
|
242
|
+
$(document).on('mousedown touchstart', range_type, function(e) {
|
199
243
|
var thumb = $(this).siblings('.thumb');
|
200
|
-
var width = $(this).outerWidth();
|
201
244
|
|
202
245
|
// If thumb indicator does not exist yet, create it
|
203
246
|
if (thumb.length <= 0) {
|
@@ -212,26 +255,13 @@
|
|
212
255
|
$(this).addClass('active');
|
213
256
|
|
214
257
|
if (!thumb.hasClass('active')) {
|
215
|
-
thumb
|
258
|
+
showRangeBubble(thumb);
|
216
259
|
}
|
217
260
|
|
218
261
|
if (e.type !== 'input') {
|
219
|
-
|
220
|
-
|
221
|
-
}
|
222
|
-
else{ // desktop
|
223
|
-
left = e.pageX - $(this).offset().left;
|
224
|
-
}
|
225
|
-
if (left < 0) {
|
226
|
-
left = 0;
|
227
|
-
}
|
228
|
-
else if (left > width) {
|
229
|
-
left = width;
|
230
|
-
}
|
231
|
-
thumb.addClass('active').css('left', left);
|
262
|
+
var offsetLeft = calcRangeOffset($(this));
|
263
|
+
thumb.addClass('active').css('left', offsetLeft);
|
232
264
|
}
|
233
|
-
|
234
|
-
thumb.find('.value').html($(this).val());
|
235
265
|
});
|
236
266
|
|
237
267
|
$(document).on('mouseup touchend', range_wrapper, function() {
|
@@ -239,28 +269,18 @@
|
|
239
269
|
$(this).removeClass('active');
|
240
270
|
});
|
241
271
|
|
242
|
-
$(document).on('mousemove touchmove', range_wrapper, function(e) {
|
272
|
+
$(document).on('input mousemove touchmove', range_wrapper, function(e) {
|
243
273
|
var thumb = $(this).children('.thumb');
|
244
274
|
var left;
|
275
|
+
var input = $(this).find(range_type);
|
276
|
+
|
245
277
|
if (range_mousedown) {
|
246
278
|
if (!thumb.hasClass('active')) {
|
247
|
-
thumb
|
248
|
-
}
|
249
|
-
if (e.pageX === undefined || e.pageX === null) { //mobile
|
250
|
-
left = e.originalEvent.touches[0].pageX - $(this).offset().left;
|
279
|
+
showRangeBubble(thumb);
|
251
280
|
}
|
252
|
-
else{ // desktop
|
253
|
-
left = e.pageX - $(this).offset().left;
|
254
|
-
}
|
255
|
-
var width = $(this).outerWidth();
|
256
281
|
|
257
|
-
|
258
|
-
|
259
|
-
}
|
260
|
-
else if (left > width) {
|
261
|
-
left = width;
|
262
|
-
}
|
263
|
-
thumb.addClass('active').css('left', left);
|
282
|
+
var offsetLeft = calcRangeOffset(input);
|
283
|
+
thumb.addClass('active').css('left', offsetLeft);
|
264
284
|
thumb.find('.value').html(thumb.siblings(range_type).val());
|
265
285
|
}
|
266
286
|
});
|
@@ -269,9 +289,11 @@
|
|
269
289
|
if (!range_mousedown) {
|
270
290
|
|
271
291
|
var thumb = $(this).children('.thumb');
|
292
|
+
var paddingLeft = parseInt($(this).css('padding-left'));
|
293
|
+
var marginLeft = (7 + paddingLeft) + 'px';
|
272
294
|
|
273
295
|
if (thumb.hasClass('active')) {
|
274
|
-
thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft:
|
296
|
+
thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft: marginLeft}, { duration: 100 });
|
275
297
|
}
|
276
298
|
thumb.removeClass('active');
|
277
299
|
}
|
@@ -285,7 +307,8 @@
|
|
285
307
|
var defaults = {
|
286
308
|
data: {},
|
287
309
|
limit: Infinity,
|
288
|
-
onAutocomplete: null
|
310
|
+
onAutocomplete: null,
|
311
|
+
minLength: 1
|
289
312
|
};
|
290
313
|
|
291
314
|
options = $.extend(defaults, options);
|
@@ -294,7 +317,7 @@
|
|
294
317
|
var $input = $(this);
|
295
318
|
var data = options.data,
|
296
319
|
count = 0,
|
297
|
-
activeIndex =
|
320
|
+
activeIndex = -1,
|
298
321
|
oldVal,
|
299
322
|
$inputDiv = $input.closest('.input-field'); // Div to append on
|
300
323
|
|
@@ -336,14 +359,26 @@
|
|
336
359
|
|
337
360
|
// Reset current element position
|
338
361
|
var resetCurrentElement = function() {
|
339
|
-
activeIndex =
|
362
|
+
activeIndex = -1;
|
340
363
|
$autocomplete.find('.active').removeClass('active');
|
341
364
|
}
|
342
365
|
|
366
|
+
// Remove autocomplete elements
|
367
|
+
var removeAutocomplete = function() {
|
368
|
+
$autocomplete.empty();
|
369
|
+
resetCurrentElement();
|
370
|
+
oldVal = undefined;
|
371
|
+
};
|
372
|
+
|
373
|
+
$input.off('blur.autocomplete').on('blur.autocomplete', function() {
|
374
|
+
removeAutocomplete();
|
375
|
+
});
|
376
|
+
|
343
377
|
// Perform search
|
344
|
-
$input.off('keyup.autocomplete').on('keyup.autocomplete', function (e) {
|
378
|
+
$input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
|
345
379
|
// Reset count.
|
346
380
|
count = 0;
|
381
|
+
var val = $input.val().toLowerCase();
|
347
382
|
|
348
383
|
// Don't capture enter or arrow key usage.
|
349
384
|
if (e.which === 13 ||
|
@@ -352,14 +387,12 @@
|
|
352
387
|
return;
|
353
388
|
}
|
354
389
|
|
355
|
-
var val = $input.val().toLowerCase();
|
356
390
|
|
357
391
|
// Check if the input isn't empty
|
358
392
|
if (oldVal !== val) {
|
359
|
-
|
360
|
-
resetCurrentElement();
|
393
|
+
removeAutocomplete();
|
361
394
|
|
362
|
-
if (val
|
395
|
+
if (val.length >= options.minLength) {
|
363
396
|
for(var key in data) {
|
364
397
|
if (data.hasOwnProperty(key) &&
|
365
398
|
key.toLowerCase().indexOf(val) !== -1 &&
|
@@ -396,10 +429,10 @@
|
|
396
429
|
$active = $autocomplete.children('.active').first();
|
397
430
|
|
398
431
|
// select element on Enter
|
399
|
-
if (keyCode === 13) {
|
432
|
+
if (keyCode === 13 && activeIndex >= 0) {
|
400
433
|
liElement = $autocomplete.children('li').eq(activeIndex);
|
401
434
|
if (liElement.length) {
|
402
|
-
liElement.
|
435
|
+
liElement.trigger('mousedown.autocomplete');
|
403
436
|
e.preventDefault();
|
404
437
|
}
|
405
438
|
return;
|
@@ -415,23 +448,23 @@
|
|
415
448
|
}
|
416
449
|
|
417
450
|
if (keyCode === 40 &&
|
418
|
-
activeIndex < (numItems - 1)
|
419
|
-
$active.length) {
|
451
|
+
activeIndex < (numItems - 1)) {
|
420
452
|
activeIndex++;
|
421
453
|
}
|
422
454
|
|
423
455
|
$active.removeClass('active');
|
424
|
-
|
456
|
+
if (activeIndex >= 0) {
|
457
|
+
$autocomplete.children('li').eq(activeIndex).addClass('active');
|
458
|
+
}
|
425
459
|
}
|
426
460
|
});
|
427
461
|
|
428
462
|
// Set input value
|
429
|
-
$autocomplete.on('
|
463
|
+
$autocomplete.on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
|
430
464
|
var text = $(this).text().trim();
|
431
465
|
$input.val(text);
|
432
466
|
$input.trigger('change');
|
433
|
-
|
434
|
-
resetCurrentElement();
|
467
|
+
removeAutocomplete();
|
435
468
|
|
436
469
|
// Handle onAutocomplete callback.
|
437
470
|
if (typeof(options.onAutocomplete) === "function") {
|
@@ -489,6 +522,7 @@
|
|
489
522
|
// Add disabled attr if disabled
|
490
523
|
var disabledClass = (option.is(':disabled')) ? 'disabled ' : '';
|
491
524
|
var optgroupClass = (type === 'optgroup-option') ? 'optgroup-option ' : '';
|
525
|
+
var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';
|
492
526
|
|
493
527
|
// add icons
|
494
528
|
var icon_url = option.data('icon');
|
@@ -498,20 +532,12 @@
|
|
498
532
|
if (!!classes) classString = ' class="' + classes + '"';
|
499
533
|
|
500
534
|
// Check for multiple type.
|
501
|
-
|
502
|
-
options.append($('<li class="' + disabledClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span><input type="checkbox"' + disabledClass + '/><label></label>' + option.html() + '</span></li>'));
|
503
|
-
} else {
|
504
|
-
options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + option.html() + '</span></li>'));
|
505
|
-
}
|
535
|
+
options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
|
506
536
|
return true;
|
507
537
|
}
|
508
538
|
|
509
539
|
// Check for multiple type.
|
510
|
-
|
511
|
-
options.append($('<li class="' + disabledClass + '"><span><input type="checkbox"' + disabledClass + '/><label></label>' + option.html() + '</span></li>'));
|
512
|
-
} else {
|
513
|
-
options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + option.html() + '</span></li>'));
|
514
|
-
}
|
540
|
+
options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
|
515
541
|
};
|
516
542
|
|
517
543
|
/* Create dropdown structure. */
|
@@ -545,7 +571,7 @@
|
|
545
571
|
|
546
572
|
if (multiple) {
|
547
573
|
$('input[type="checkbox"]', this).prop('checked', function(i, v) { return !v; });
|
548
|
-
selected = toggleEntryFromArray(valuesSelected,
|
574
|
+
selected = toggleEntryFromArray(valuesSelected, i, $select);
|
549
575
|
$newSelect.trigger('focus');
|
550
576
|
} else {
|
551
577
|
options.find('li').removeClass('active');
|
@@ -581,7 +607,7 @@
|
|
581
607
|
$newSelect.after(options);
|
582
608
|
// Check if section element is disabled
|
583
609
|
if (!$select.is(':disabled')) {
|
584
|
-
$newSelect.dropdown({'hover': false
|
610
|
+
$newSelect.dropdown({'hover': false});
|
585
611
|
}
|
586
612
|
|
587
613
|
// Copy tabindex
|
@@ -749,7 +775,7 @@
|
|
749
775
|
entriesArray.splice(index, 1);
|
750
776
|
}
|
751
777
|
|
752
|
-
select.siblings('ul.dropdown-content').find('li').eq(entryIndex).toggleClass('active');
|
778
|
+
select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active');
|
753
779
|
|
754
780
|
// use notAdded instead of true (to detect if the option is selected or not)
|
755
781
|
select.find('option').eq(entryIndex).prop('selected', notAdded);
|
@@ -51,7 +51,20 @@
|
|
51
51
|
}(window));
|
52
52
|
|
53
53
|
|
54
|
-
|
54
|
+
/**
|
55
|
+
* Generate approximated selector string for a jQuery object
|
56
|
+
* @param {jQuery} obj jQuery object to be parsed
|
57
|
+
* @returns {string}
|
58
|
+
*/
|
59
|
+
Materialize.objectSelectorString = function(obj) {
|
60
|
+
var tagStr = obj.prop('tagName') || '';
|
61
|
+
var idStr = obj.attr('id') || '';
|
62
|
+
var classStr = obj.attr('class') || '';
|
63
|
+
return (tagStr + idStr + classStr).replace(/\s/g,'');
|
64
|
+
};
|
65
|
+
|
66
|
+
|
67
|
+
// Unique Random ID
|
55
68
|
Materialize.guid = (function() {
|
56
69
|
function s4() {
|
57
70
|
return Math.floor((1 + Math.random()) * 0x10000)
|
@@ -0,0 +1,166 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
|
3
|
+
* Open source under the BSD License.
|
4
|
+
* Copyright © 2008 George McGinley Smith
|
5
|
+
* All rights reserved.
|
6
|
+
* https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function (factory) {
|
10
|
+
if (typeof define === "function" && define.amd) {
|
11
|
+
define(['jquery'], function ($) {
|
12
|
+
return factory($);
|
13
|
+
});
|
14
|
+
} else if (typeof module === "object" && typeof module.exports === "object") {
|
15
|
+
exports = factory(require('jquery'));
|
16
|
+
} else {
|
17
|
+
factory(jQuery);
|
18
|
+
}
|
19
|
+
})(function($){
|
20
|
+
|
21
|
+
// Preserve the original jQuery "swing" easing as "jswing"
|
22
|
+
$.easing['jswing'] = $.easing['swing'];
|
23
|
+
|
24
|
+
var pow = Math.pow,
|
25
|
+
sqrt = Math.sqrt,
|
26
|
+
sin = Math.sin,
|
27
|
+
cos = Math.cos,
|
28
|
+
PI = Math.PI,
|
29
|
+
c1 = 1.70158,
|
30
|
+
c2 = c1 * 1.525,
|
31
|
+
c3 = c1 + 1,
|
32
|
+
c4 = ( 2 * PI ) / 3,
|
33
|
+
c5 = ( 2 * PI ) / 4.5;
|
34
|
+
|
35
|
+
// x is the fraction of animation progress, in the range 0..1
|
36
|
+
function bounceOut(x) {
|
37
|
+
var n1 = 7.5625,
|
38
|
+
d1 = 2.75;
|
39
|
+
if ( x < 1/d1 ) {
|
40
|
+
return n1*x*x;
|
41
|
+
} else if ( x < 2/d1 ) {
|
42
|
+
return n1*(x-=(1.5/d1))*x + .75;
|
43
|
+
} else if ( x < 2.5/d1 ) {
|
44
|
+
return n1*(x-=(2.25/d1))*x + .9375;
|
45
|
+
} else {
|
46
|
+
return n1*(x-=(2.625/d1))*x + .984375;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
$.extend( $.easing,
|
51
|
+
{
|
52
|
+
def: 'easeOutQuad',
|
53
|
+
swing: function (x) {
|
54
|
+
return $.easing[$.easing.def](x);
|
55
|
+
},
|
56
|
+
easeInQuad: function (x) {
|
57
|
+
return x * x;
|
58
|
+
},
|
59
|
+
easeOutQuad: function (x) {
|
60
|
+
return 1 - ( 1 - x ) * ( 1 - x );
|
61
|
+
},
|
62
|
+
easeInOutQuad: function (x) {
|
63
|
+
return x < 0.5 ?
|
64
|
+
2 * x * x :
|
65
|
+
1 - pow( -2 * x + 2, 2 ) / 2;
|
66
|
+
},
|
67
|
+
easeInCubic: function (x) {
|
68
|
+
return x * x * x;
|
69
|
+
},
|
70
|
+
easeOutCubic: function (x) {
|
71
|
+
return 1 - pow( 1 - x, 3 );
|
72
|
+
},
|
73
|
+
easeInOutCubic: function (x) {
|
74
|
+
return x < 0.5 ?
|
75
|
+
4 * x * x * x :
|
76
|
+
1 - pow( -2 * x + 2, 3 ) / 2;
|
77
|
+
},
|
78
|
+
easeInQuart: function (x) {
|
79
|
+
return x * x * x * x;
|
80
|
+
},
|
81
|
+
easeOutQuart: function (x) {
|
82
|
+
return 1 - pow( 1 - x, 4 );
|
83
|
+
},
|
84
|
+
easeInOutQuart: function (x) {
|
85
|
+
return x < 0.5 ?
|
86
|
+
8 * x * x * x * x :
|
87
|
+
1 - pow( -2 * x + 2, 4 ) / 2;
|
88
|
+
},
|
89
|
+
easeInQuint: function (x) {
|
90
|
+
return x * x * x * x * x;
|
91
|
+
},
|
92
|
+
easeOutQuint: function (x) {
|
93
|
+
return 1 - pow( 1 - x, 5 );
|
94
|
+
},
|
95
|
+
easeInOutQuint: function (x) {
|
96
|
+
return x < 0.5 ?
|
97
|
+
16 * x * x * x * x * x :
|
98
|
+
1 - pow( -2 * x + 2, 5 ) / 2;
|
99
|
+
},
|
100
|
+
easeInSine: function (x) {
|
101
|
+
return 1 - cos( x * PI/2 );
|
102
|
+
},
|
103
|
+
easeOutSine: function (x) {
|
104
|
+
return sin( x * PI/2 );
|
105
|
+
},
|
106
|
+
easeInOutSine: function (x) {
|
107
|
+
return -( cos( PI * x ) - 1 ) / 2;
|
108
|
+
},
|
109
|
+
easeInExpo: function (x) {
|
110
|
+
return x === 0 ? 0 : pow( 2, 10 * x - 10 );
|
111
|
+
},
|
112
|
+
easeOutExpo: function (x) {
|
113
|
+
return x === 1 ? 1 : 1 - pow( 2, -10 * x );
|
114
|
+
},
|
115
|
+
easeInOutExpo: function (x) {
|
116
|
+
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
117
|
+
pow( 2, 20 * x - 10 ) / 2 :
|
118
|
+
( 2 - pow( 2, -20 * x + 10 ) ) / 2;
|
119
|
+
},
|
120
|
+
easeInCirc: function (x) {
|
121
|
+
return 1 - sqrt( 1 - pow( x, 2 ) );
|
122
|
+
},
|
123
|
+
easeOutCirc: function (x) {
|
124
|
+
return sqrt( 1 - pow( x - 1, 2 ) );
|
125
|
+
},
|
126
|
+
easeInOutCirc: function (x) {
|
127
|
+
return x < 0.5 ?
|
128
|
+
( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
|
129
|
+
( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
|
130
|
+
},
|
131
|
+
easeInElastic: function (x) {
|
132
|
+
return x === 0 ? 0 : x === 1 ? 1 :
|
133
|
+
-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
|
134
|
+
},
|
135
|
+
easeOutElastic: function (x) {
|
136
|
+
return x === 0 ? 0 : x === 1 ? 1 :
|
137
|
+
pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
|
138
|
+
},
|
139
|
+
easeInOutElastic: function (x) {
|
140
|
+
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
141
|
+
-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
|
142
|
+
pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
|
143
|
+
},
|
144
|
+
easeInBack: function (x) {
|
145
|
+
return c3 * x * x * x - c1 * x * x;
|
146
|
+
},
|
147
|
+
easeOutBack: function (x) {
|
148
|
+
return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
|
149
|
+
},
|
150
|
+
easeInOutBack: function (x) {
|
151
|
+
return x < 0.5 ?
|
152
|
+
( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
|
153
|
+
( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
|
154
|
+
},
|
155
|
+
easeInBounce: function (x) {
|
156
|
+
return 1 - bounceOut( 1 - x );
|
157
|
+
},
|
158
|
+
easeOutBounce: bounceOut,
|
159
|
+
easeInOutBounce: function (x) {
|
160
|
+
return x < 0.5 ?
|
161
|
+
( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
|
162
|
+
( 1 + bounceOut( 2 * x - 1 ) ) / 2;
|
163
|
+
}
|
164
|
+
});
|
165
|
+
|
166
|
+
});
|