materialize-sass 0.97.3 → 0.97.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/fonts/roboto/Roboto-Bold.eot +0 -0
  3. data/app/assets/fonts/roboto/Roboto-Light.eot +0 -0
  4. data/app/assets/fonts/roboto/Roboto-Medium.eot +0 -0
  5. data/app/assets/fonts/roboto/Roboto-Regular.eot +0 -0
  6. data/app/assets/fonts/roboto/Roboto-Thin.eot +0 -0
  7. data/app/assets/javascripts/materialize-sprockets.js +1 -0
  8. data/app/assets/javascripts/materialize.js +537 -192
  9. data/app/assets/javascripts/materialize.min.js +6 -6
  10. data/app/assets/javascripts/materialize/buttons.js +2 -3
  11. data/app/assets/javascripts/materialize/collapsible.js +1 -1
  12. data/app/assets/javascripts/materialize/dropdown.js +1 -1
  13. data/app/assets/javascripts/materialize/extras/nouislider.js +5 -0
  14. data/app/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  15. data/app/assets/javascripts/materialize/forms.js +56 -47
  16. data/app/assets/javascripts/materialize/global.js +3 -2
  17. data/app/assets/javascripts/materialize/initial.js +4 -0
  18. data/app/assets/javascripts/materialize/tooltip.js +120 -118
  19. data/app/assets/stylesheets/materialize/components/_buttons.scss +2 -1
  20. data/app/assets/stylesheets/materialize/components/_cards.scss +2 -2
  21. data/app/assets/stylesheets/materialize/components/_carousel.scss +1 -5
  22. data/app/assets/stylesheets/materialize/components/_collapsible.scss +1 -1
  23. data/app/assets/stylesheets/materialize/components/_form.scss +23 -24
  24. data/app/assets/stylesheets/materialize/components/_global.scss +40 -27
  25. data/app/assets/stylesheets/materialize/components/_grid.scss +30 -3
  26. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +6 -0
  27. data/app/assets/stylesheets/materialize/components/_materialbox.scss +1 -1
  28. data/app/assets/stylesheets/materialize/components/_mixins.scss +5 -5
  29. data/app/assets/stylesheets/materialize/components/_navbar.scss +28 -12
  30. data/app/assets/stylesheets/materialize/components/_prefixer.scss +291 -291
  31. data/app/assets/stylesheets/materialize/components/_roboto.scss +17 -10
  32. data/app/assets/stylesheets/materialize/components/_sideNav.scss +3 -2
  33. data/app/assets/stylesheets/materialize/components/_slider.scss +1 -1
  34. data/app/assets/stylesheets/materialize/components/_tabs.scss +4 -4
  35. data/app/assets/stylesheets/materialize/components/_toast.scss +6 -8
  36. data/app/assets/stylesheets/materialize/components/_tooltip.scss +1 -1
  37. data/app/assets/stylesheets/materialize/components/_variables.scss +1 -0
  38. data/app/assets/stylesheets/materialize/components/_waves.scss +5 -8
  39. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +2 -2
  40. data/app/assets/stylesheets/materialize/extras/nouislider.css +5 -0
  41. data/lib/materialize-sass/version.rb +1 -1
  42. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff09f56488481fffe6091e4ee10158a5d3786096
4
- data.tar.gz: 33add87521329e92282e1b7b3874ed8b8d7c68f8
3
+ metadata.gz: 60c38baa5bb1044a4cc35b8177eced113ef58bd3
4
+ data.tar.gz: 0156d1cae9eb4c39f0e620f26bef8dec5b8d06f9
5
5
  SHA512:
6
- metadata.gz: bba44aafc79c033208f84465c62249dac66a7ca68a3d693ad234bacc80a3fb8ba204c5c8a898d95a057e60d2bbaa210f4b79a5efa4dcf9b2719e6a6b7250416d
7
- data.tar.gz: cafa286354373804be1cdc9c89d7b6cf3ad1e29b4409e7b39d069dd57d0676d740463354a33972ee45bcfe0ecfe333db10002d6f8de76eb9e6a089566f5f1970
6
+ metadata.gz: ac6febc046c192b9c4d0b3978239bec10d83b9dd7b230a0cdee634309ca0580bdd21351968d6fd68b8602f944b2a3c17563cecb07897bb7e45d56546af1bf9b4
7
+ data.tar.gz: 6d116b19254378dfc3a9d41f040ae1f3d530be7a26b37a38a95ca32bb155b4d1c0dc51060acf745113595e5dcaac26a72d2792ebe2a28ec2b72d7a8a2387804c
@@ -1,3 +1,4 @@
1
+ //= require ./materialize/initial
1
2
  //= require ./materialize/jquery.easing.1.3
2
3
  //= require ./materialize/animation
3
4
  //= require ./materialize/velocity.min
@@ -1,9 +1,12 @@
1
1
  /*!
2
- * Materialize v0.97.3 (http://materializecss.com)
2
+ * Materialize v0.97.4 (http://materializecss.com)
3
3
  * Copyright 2014-2015 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
5
  */
6
- /*
6
+ // Check for jQuery.
7
+ if (typeof(jQuery) === 'undefined') {
8
+ var jQuery = $ = require('jQuery');
9
+ };/*
7
10
  * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
8
11
  *
9
12
  * Uses the built in easing capabilities added In jQuery 1.1
@@ -294,8 +297,9 @@ Materialize.elementOrParentIsFixed = function(element) {
294
297
  var Vel;
295
298
  if ($) {
296
299
  Vel = $.Velocity;
297
- }
298
- else {
300
+ } else if (jQuery) {
301
+ Vel = jQuery.Velocity;
302
+ } else {
299
303
  Vel = Velocity;
300
304
  }
301
305
  ; (function ($) {
@@ -316,7 +320,7 @@ else {
316
320
  var collapsible_type = $this.data("collapsible");
317
321
 
318
322
  // Turn off any existing event handlers
319
- $this.off('click.collapse', '.collapsible-header');
323
+ $this.off('click.collapse', '> li > .collapsible-header');
320
324
  $panel_headers.off('click.collapse');
321
325
 
322
326
 
@@ -583,8 +587,8 @@ else {
583
587
  isFocused = false;
584
588
  activates.fadeOut(options.outDuration);
585
589
  activates.removeClass('active');
586
- activates.css('max-height', '');
587
590
  origin.removeClass('active');
591
+ setTimeout(function() { activates.css('max-height', ''); }, options.outDuration);
588
592
  }
589
593
 
590
594
  // Hover
@@ -1180,7 +1184,6 @@ $(document).ready(function(){
1180
1184
  var $active, $content, $links = $this.find('li.tab a'),
1181
1185
  $tabs_width = $this.width(),
1182
1186
  $tab_width = $this.find('li').first().outerWidth(),
1183
- $tab_min_width = parseInt($this.find('li').first().css('minWidth')),
1184
1187
  $index = 0;
1185
1188
 
1186
1189
  // If the location.hash matches one of the links, use that as the active tab.
@@ -1272,24 +1275,6 @@ $(document).ready(function(){
1272
1275
  // Prevent the anchor's default click action
1273
1276
  e.preventDefault();
1274
1277
  });
1275
-
1276
- // Add scroll for small screens
1277
- if ($tab_width <= $tab_min_width) {
1278
- $this.wrap('<div class="hide-tab-scrollbar"></div>');
1279
-
1280
- // Create the measurement node
1281
- var scrollDiv = document.createElement("div");
1282
- scrollDiv.className = "scrollbar-measure";
1283
- document.body.appendChild(scrollDiv);
1284
- var scrollbarHeight = scrollDiv.offsetHeight - scrollDiv.clientHeight;
1285
- document.body.removeChild(scrollDiv);
1286
-
1287
- if (scrollbarHeight === 0) {
1288
- scrollbarHeight = 15;
1289
- $this.find('.indicator').css('bottom', scrollbarHeight);
1290
- }
1291
- $this.height($(this).height() + scrollbarHeight);
1292
- }
1293
1278
  });
1294
1279
 
1295
1280
  },
@@ -1316,9 +1301,6 @@ $(document).ready(function(){
1316
1301
  ;(function ($) {
1317
1302
  $.fn.tooltip = function (options) {
1318
1303
  var timeout = null,
1319
- counter = null,
1320
- started = false,
1321
- counterInterval = null,
1322
1304
  margin = 5;
1323
1305
 
1324
1306
  // Defaults
@@ -1330,6 +1312,7 @@ $(document).ready(function(){
1330
1312
  if (options === "remove") {
1331
1313
  this.each(function(){
1332
1314
  $('#' + $(this).attr('data-tooltip-id')).remove();
1315
+ $(this).off('mouseenter.tooltip mouseleave.tooltip');
1333
1316
  });
1334
1317
  return false;
1335
1318
  }
@@ -1356,136 +1339,140 @@ $(document).ready(function(){
1356
1339
  backdrop.css({ top: 0, left:0 });
1357
1340
 
1358
1341
 
1359
- //Destroy previously binded events
1342
+ //Destroy previously binded events
1360
1343
  origin.off('mouseenter.tooltip mouseleave.tooltip');
1361
- // Mouse In
1344
+ // Mouse In
1345
+ var started = false, timeoutRef;
1362
1346
  origin.on({
1363
1347
  'mouseenter.tooltip': function(e) {
1364
- var tooltip_delay = origin.data("delay");
1365
- tooltip_delay = (tooltip_delay === undefined || tooltip_delay === '') ? options.delay : tooltip_delay;
1366
- counter = 0;
1367
- counterInterval = setInterval(function(){
1368
- counter += 10;
1369
- if (counter >= tooltip_delay && started === false) {
1370
- started = true;
1371
- newTooltip.css({ display: 'block', left: '0px', top: '0px' });
1372
-
1373
- // Set Tooltip text
1374
- newTooltip.children('span').text(origin.attr('data-tooltip'));
1375
-
1376
- // Tooltip positioning
1377
- var originWidth = origin.outerWidth();
1378
- var originHeight = origin.outerHeight();
1379
- var tooltipPosition = origin.attr('data-position');
1380
- var tooltipHeight = newTooltip.outerHeight();
1381
- var tooltipWidth = newTooltip.outerWidth();
1382
- var tooltipVerticalMovement = '0px';
1383
- var tooltipHorizontalMovement = '0px';
1384
- var scale_factor = 8;
1385
- var targetTop, targetLeft, newCoordinates;
1386
-
1387
- if (tooltipPosition === "top") {
1388
- // Top Position
1389
- targetTop = origin.offset().top - tooltipHeight - margin;
1390
- targetLeft = origin.offset().left + originWidth/2 - tooltipWidth/2;
1391
- newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1392
-
1393
- tooltipVerticalMovement = '-10px';
1394
- backdrop.css({
1395
- borderRadius: '14px 14px 0 0',
1396
- transformOrigin: '50% 90%',
1397
- marginTop: tooltipHeight,
1398
- marginLeft: (tooltipWidth/2) - (backdrop.width()/2)
1399
- });
1400
- }
1401
- // Left Position
1402
- else if (tooltipPosition === "left") {
1403
- targetTop = origin.offset().top + originHeight/2 - tooltipHeight/2;
1404
- targetLeft = origin.offset().left - tooltipWidth - margin;
1405
- newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1406
-
1407
- tooltipHorizontalMovement = '-10px';
1408
- backdrop.css({
1409
- width: '14px',
1410
- height: '14px',
1411
- borderRadius: '14px 0 0 14px',
1412
- transformOrigin: '95% 50%',
1413
- marginTop: tooltipHeight/2,
1414
- marginLeft: tooltipWidth
1415
- });
1416
- }
1417
- // Right Position
1418
- else if (tooltipPosition === "right") {
1419
- targetTop = origin.offset().top + originHeight/2 - tooltipHeight/2;
1420
- targetLeft = origin.offset().left + originWidth + margin;
1421
- newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1422
-
1423
- tooltipHorizontalMovement = '+10px';
1424
- backdrop.css({
1425
- width: '14px',
1426
- height: '14px',
1427
- borderRadius: '0 14px 14px 0',
1428
- transformOrigin: '5% 50%',
1429
- marginTop: tooltipHeight/2,
1430
- marginLeft: '0px'
1431
- });
1432
- }
1433
- else {
1434
- // Bottom Position
1435
- targetTop = origin.offset().top + origin.outerHeight() + margin;
1436
- targetLeft = origin.offset().left + originWidth/2 - tooltipWidth/2;
1437
- newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1438
- tooltipVerticalMovement = '+10px';
1439
- backdrop.css({
1440
- marginLeft: (tooltipWidth/2) - (backdrop.width()/2)
1441
- });
1442
- }
1443
-
1444
- // Set tooptip css placement
1445
- newTooltip.css({
1446
- top: newCoordinates.y,
1447
- left: newCoordinates.x
1348
+ var tooltip_delay = origin.attr('data-delay');
1349
+ tooltip_delay = (tooltip_delay === undefined || tooltip_delay === '') ?
1350
+ options.delay : tooltip_delay;
1351
+ timeoutRef = setTimeout(function(){
1352
+ started = true;
1353
+ newTooltip.velocity('stop');
1354
+ backdrop.velocity('stop');
1355
+ newTooltip.css({ display: 'block', left: '0px', top: '0px' });
1356
+
1357
+ // Set Tooltip text
1358
+ newTooltip.children('span').text(origin.attr('data-tooltip'));
1359
+
1360
+ // Tooltip positioning
1361
+ var originWidth = origin.outerWidth();
1362
+ var originHeight = origin.outerHeight();
1363
+ var tooltipPosition = origin.attr('data-position');
1364
+ var tooltipHeight = newTooltip.outerHeight();
1365
+ var tooltipWidth = newTooltip.outerWidth();
1366
+ var tooltipVerticalMovement = '0px';
1367
+ var tooltipHorizontalMovement = '0px';
1368
+ var scale_factor = 8;
1369
+ var targetTop, targetLeft, newCoordinates;
1370
+
1371
+ if (tooltipPosition === "top") {
1372
+ // Top Position
1373
+ targetTop = origin.offset().top - tooltipHeight - margin;
1374
+ targetLeft = origin.offset().left + originWidth/2 - tooltipWidth/2;
1375
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1376
+
1377
+ tooltipVerticalMovement = '-10px';
1378
+ backdrop.css({
1379
+ borderRadius: '14px 14px 0 0',
1380
+ transformOrigin: '50% 90%',
1381
+ marginTop: tooltipHeight,
1382
+ marginLeft: (tooltipWidth/2) - (backdrop.width()/2)
1383
+ });
1384
+ }
1385
+ // Left Position
1386
+ else if (tooltipPosition === "left") {
1387
+ targetTop = origin.offset().top + originHeight/2 - tooltipHeight/2;
1388
+ targetLeft = origin.offset().left - tooltipWidth - margin;
1389
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1390
+
1391
+ tooltipHorizontalMovement = '-10px';
1392
+ backdrop.css({
1393
+ width: '14px',
1394
+ height: '14px',
1395
+ borderRadius: '14px 0 0 14px',
1396
+ transformOrigin: '95% 50%',
1397
+ marginTop: tooltipHeight/2,
1398
+ marginLeft: tooltipWidth
1448
1399
  });
1400
+ }
1401
+ // Right Position
1402
+ else if (tooltipPosition === "right") {
1403
+ targetTop = origin.offset().top + originHeight/2 - tooltipHeight/2;
1404
+ targetLeft = origin.offset().left + originWidth + margin;
1405
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1406
+
1407
+ tooltipHorizontalMovement = '+10px';
1408
+ backdrop.css({
1409
+ width: '14px',
1410
+ height: '14px',
1411
+ borderRadius: '0 14px 14px 0',
1412
+ transformOrigin: '5% 50%',
1413
+ marginTop: tooltipHeight/2,
1414
+ marginLeft: '0px'
1415
+ });
1416
+ }
1417
+ else {
1418
+ // Bottom Position
1419
+ targetTop = origin.offset().top + origin.outerHeight() + margin;
1420
+ targetLeft = origin.offset().left + originWidth/2 - tooltipWidth/2;
1421
+ newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
1422
+ tooltipVerticalMovement = '+10px';
1423
+ backdrop.css({
1424
+ marginLeft: (tooltipWidth/2) - (backdrop.width()/2)
1425
+ });
1426
+ }
1449
1427
 
1450
- // Calculate Scale to fill
1451
- scale_factor = tooltipWidth / 8;
1452
- if (scale_factor < 8) {
1453
- scale_factor = 8;
1454
- }
1455
- if (tooltipPosition === "right" || tooltipPosition === "left") {
1456
- scale_factor = tooltipWidth / 10;
1457
- if (scale_factor < 6)
1458
- scale_factor = 6;
1459
- }
1428
+ // Set tooptip css placement
1429
+ newTooltip.css({
1430
+ top: newCoordinates.y,
1431
+ left: newCoordinates.x
1432
+ });
1460
1433
 
1461
- newTooltip.velocity({ marginTop: tooltipVerticalMovement, marginLeft: tooltipHorizontalMovement}, { duration: 350, queue: false })
1462
- .velocity({opacity: 1}, {duration: 300, delay: 50, queue: false});
1463
- backdrop.css({ display: 'block' })
1434
+ // Calculate Scale to fill
1435
+ scale_factor = tooltipWidth / 8;
1436
+ if (scale_factor < 8) {
1437
+ scale_factor = 8;
1438
+ }
1439
+ if (tooltipPosition === "right" || tooltipPosition === "left") {
1440
+ scale_factor = tooltipWidth / 10;
1441
+ if (scale_factor < 6)
1442
+ scale_factor = 6;
1443
+ }
1444
+
1445
+ newTooltip.velocity({ marginTop: tooltipVerticalMovement, marginLeft: tooltipHorizontalMovement}, { duration: 350, queue: false })
1446
+ .velocity({opacity: 1}, {duration: 300, delay: 50, queue: false});
1447
+ backdrop.css({ display: 'block' })
1464
1448
  .velocity({opacity:1},{duration: 55, delay: 0, queue: false})
1465
1449
  .velocity({scale: scale_factor}, {duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad'});
1466
1450
 
1467
- }
1468
- }, 10); // End Interval
1451
+
1452
+ }, tooltip_delay); // End Interval
1469
1453
 
1470
1454
  // Mouse Out
1471
1455
  },
1472
1456
  'mouseleave.tooltip': function(){
1473
1457
  // Reset State
1474
- clearInterval(counterInterval);
1475
- counter = 0;
1458
+ started = false;
1459
+ clearTimeout(timeoutRef);
1476
1460
 
1477
1461
  // Animate back
1478
- newTooltip.velocity({
1479
- opacity: 0, marginTop: 0, marginLeft: 0}, { duration: 225, queue: false, delay: 225 }
1480
- );
1481
- backdrop.velocity({opacity: 0, scale: 1}, {
1482
- duration:225,
1483
- delay: 275, queue: false,
1484
- complete: function(){
1485
- backdrop.css('display', 'none');
1486
- newTooltip.css('display', 'none');
1487
- started = false;}
1488
- });
1462
+ setTimeout(function() {
1463
+ if (started != true) {
1464
+ newTooltip.velocity({
1465
+ opacity: 0, marginTop: 0, marginLeft: 0}, { duration: 225, queue: false});
1466
+ backdrop.velocity({opacity: 0, scale: 1}, {
1467
+ duration:225,
1468
+ queue: false,
1469
+ complete: function(){
1470
+ backdrop.css('display', 'none');
1471
+ newTooltip.css('display', 'none');
1472
+ started = false;}
1473
+ });
1474
+ }
1475
+ },225);
1489
1476
  }
1490
1477
  });
1491
1478
  });
@@ -2593,8 +2580,8 @@ $(document).ready(function(){
2593
2580
  Materialize.updateTextFields = function() {
2594
2581
  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';
2595
2582
  $(input_selector).each(function(index, element) {
2596
- if ($(element).val().length > 0 || $(this).attr('placeholder') !== undefined || $(element)[0].validity.badInput === true) {
2597
- $(this).siblings('label').addClass('active');
2583
+ if ($(element).val().length > 0 || element.autofocus ||$(this).attr('placeholder') !== undefined || $(element)[0].validity.badInput === true) {
2584
+ $(this).siblings('label, i').addClass('active');
2598
2585
  }
2599
2586
  else {
2600
2587
  $(this).siblings('label, i').removeClass('active');
@@ -2605,9 +2592,6 @@ $(document).ready(function(){
2605
2592
  // Text based inputs
2606
2593
  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';
2607
2594
 
2608
- // Handle HTML5 autofocus
2609
- $('input[autofocus]').siblings('label, i').addClass('active');
2610
-
2611
2595
  // Add active if form auto complete
2612
2596
  $(document).on('change', input_selector, function () {
2613
2597
  if($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
@@ -2774,7 +2758,7 @@ $(document).ready(function(){
2774
2758
  // If thumb indicator does not exist yet, create it
2775
2759
  if (thumb.length <= 0) {
2776
2760
  thumb = $('<span class="thumb"><span class="value"></span></span>');
2777
- $(this).append(thumb);
2761
+ $(this).after(thumb);
2778
2762
  }
2779
2763
 
2780
2764
  // Set indicator value
@@ -2882,18 +2866,12 @@ $(document).ready(function(){
2882
2866
  $select.data('select-id', uniqueID);
2883
2867
  var wrapper = $('<div class="select-wrapper"></div>');
2884
2868
  wrapper.addClass($select.attr('class'));
2885
- var options = $('<ul id="select-options-' + uniqueID +'" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>');
2886
- var selectOptions = $select.children('option');
2887
- var selectOptGroups = $select.children('optgroup');
2888
-
2889
- var valuesSelected = [],
2869
+ var options = $('<ul id="select-options-' + uniqueID +'" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>'),
2870
+ selectChildren = $select.children('option, optgroup'),
2871
+ valuesSelected = [],
2890
2872
  optionsHover = false;
2891
2873
 
2892
- if ($select.find('option:selected').length > 0) {
2893
- label = $select.find('option:selected');
2894
- } else {
2895
- label = selectOptions.first();
2896
- }
2874
+ var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
2897
2875
 
2898
2876
  // Function that renders and appends the option taking into
2899
2877
  // account type and possible image icon.
@@ -2926,49 +2904,48 @@ $(document).ready(function(){
2926
2904
  };
2927
2905
 
2928
2906
  /* Create dropdown structure. */
2929
- if (selectOptGroups.length) {
2930
- // Check for optgroup
2931
- selectOptGroups.each(function() {
2932
- selectOptions = $(this).children('option');
2933
- options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
2934
-
2935
- selectOptions.each(function() {
2936
- appendOptionWithIcon($select, $(this));
2937
- });
2938
- });
2939
- } else {
2940
- selectOptions.each(function () {
2941
- var disabledClass = ($(this).is(':disabled')) ? 'disabled ' : '';
2942
- if (multiple) {
2943
- appendOptionWithIcon($select, $(this), 'multiple');
2907
+ if (selectChildren.length) {
2908
+ selectChildren.each(function() {
2909
+ if ($(this).is('option')) {
2910
+ // Direct descendant option.
2911
+ if (multiple) {
2912
+ appendOptionWithIcon($select, $(this), 'multiple');
2944
2913
 
2945
- } else {
2946
- appendOptionWithIcon($select, $(this));
2914
+ } else {
2915
+ appendOptionWithIcon($select, $(this));
2916
+ }
2917
+ } else if ($(this).is('optgroup')) {
2918
+ // Optgroup.
2919
+ var selectOptions = $(this).children('option');
2920
+ options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
2921
+
2922
+ selectOptions.each(function() {
2923
+ appendOptionWithIcon($select, $(this));
2924
+ });
2947
2925
  }
2948
2926
  });
2949
2927
  }
2950
2928
 
2951
-
2952
2929
  options.find('li:not(.optgroup)').each(function (i) {
2953
- var $curr_select = $select;
2954
2930
  $(this).click(function (e) {
2955
2931
  // Check if option element is disabled
2956
2932
  if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
2933
+ var selected = true;
2934
+
2957
2935
  if (multiple) {
2958
2936
  $('input[type="checkbox"]', this).prop('checked', function(i, v) { return !v; });
2959
- toggleEntryFromArray(valuesSelected, $(this).index(), $curr_select);
2937
+ selected = toggleEntryFromArray(valuesSelected, $(this).index(), $select);
2960
2938
  $newSelect.trigger('focus');
2961
-
2962
2939
  } else {
2963
2940
  options.find('li').removeClass('active');
2964
2941
  $(this).toggleClass('active');
2965
- $curr_select.siblings('input.select-dropdown').val($(this).text());
2942
+ $newSelect.val($(this).text());
2966
2943
  }
2967
2944
 
2968
2945
  activateOption(options, $(this));
2969
- $curr_select.find('option').eq(i).prop('selected', true);
2946
+ $select.find('option').eq(i).prop('selected', selected);
2970
2947
  // Trigger onchange() event
2971
- $curr_select.trigger('change');
2948
+ $select.trigger('change');
2972
2949
  if (typeof callback !== 'undefined') callback();
2973
2950
  }
2974
2951
 
@@ -2984,7 +2961,7 @@ $(document).ready(function(){
2984
2961
  dropdownIcon.addClass('disabled');
2985
2962
 
2986
2963
  // escape double quotes
2987
- var sanitizedLabelHtml = label.html() && label.html().replace(/"/g, '&quot;');
2964
+ var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
2988
2965
 
2989
2966
  var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + (($select.is(':disabled')) ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID +'" value="'+ sanitizedLabelHtml +'"/>');
2990
2967
  $select.before($newSelect);
@@ -3036,15 +3013,29 @@ $(document).ready(function(){
3036
3013
  });
3037
3014
 
3038
3015
  $(window).on({
3039
- 'click': function (e){
3016
+ 'click': function () {
3040
3017
  multiple && (optionsHover || $newSelect.trigger('close'));
3041
3018
  }
3042
3019
  });
3043
3020
 
3021
+ // Add initial multiple selections.
3022
+ if (multiple) {
3023
+ $select.find("option:selected:not(:disabled)").each(function () {
3024
+ var index = $(this).index();
3025
+
3026
+ toggleEntryFromArray(valuesSelected, index, $select);
3027
+ options.find("li").eq(index).find(":checkbox").prop("checked", true);
3028
+ });
3029
+ }
3030
+
3044
3031
  // Make option as selected and scroll to selected position
3045
3032
  activateOption = function(collection, newOption) {
3046
- collection.find('li.selected').removeClass('selected');
3047
- $(newOption).addClass('selected');
3033
+ if (newOption) {
3034
+ collection.find('li.selected').removeClass('selected');
3035
+ var option = $(newOption);
3036
+ option.addClass('selected');
3037
+ options.scrollTo(option);
3038
+ }
3048
3039
  };
3049
3040
 
3050
3041
  // Allow user to search by typing
@@ -3127,17 +3118,22 @@ $(document).ready(function(){
3127
3118
  });
3128
3119
 
3129
3120
  function toggleEntryFromArray(entriesArray, entryIndex, select) {
3130
- var index = entriesArray.indexOf(entryIndex);
3121
+ var index = entriesArray.indexOf(entryIndex),
3122
+ notAdded = index === -1;
3131
3123
 
3132
- if (index === -1) {
3124
+ if (notAdded) {
3133
3125
  entriesArray.push(entryIndex);
3134
3126
  } else {
3135
3127
  entriesArray.splice(index, 1);
3136
3128
  }
3137
3129
 
3138
3130
  select.siblings('ul.dropdown-content').find('li').eq(entryIndex).toggleClass('active');
3139
- select.find('option').eq(entryIndex).prop('selected', true);
3131
+
3132
+ // use notAdded instead of true (to detect if the option is selected or not)
3133
+ select.find('option').eq(entryIndex).prop('selected', notAdded);
3140
3134
  setValueToInput(entriesArray, select);
3135
+
3136
+ return notAdded;
3141
3137
  }
3142
3138
 
3143
3139
  function setValueToInput(entriesArray, select) {
@@ -3606,11 +3602,10 @@ $(document).ready(function(){
3606
3602
 
3607
3603
  $.fn.extend({
3608
3604
  openFAB: function() {
3609
- var $this = $(this);
3610
- openFABMenu($this);
3605
+ openFABMenu($(this));
3611
3606
  },
3612
3607
  closeFAB: function() {
3613
- closeFABMenu($this);
3608
+ closeFABMenu($(this));
3614
3609
  }
3615
3610
  });
3616
3611
 
@@ -6476,3 +6471,353 @@ Picker.extend( 'pickadate', DatePicker )
6476
6471
  });
6477
6472
 
6478
6473
  }( jQuery ));
6474
+ ;(function ($) {
6475
+
6476
+ var methods = {
6477
+
6478
+ init : function(options) {
6479
+ var defaults = {
6480
+ time_constant: 200, // ms
6481
+ dist: -100, // zoom scale TODO: make this more intuitive as an option
6482
+ shift: 0, // spacing for center image
6483
+ padding: 0, // Padding between non center items
6484
+ full_width: false // Change to full width styles
6485
+ };
6486
+ options = $.extend(defaults, options);
6487
+
6488
+ return this.each(function() {
6489
+
6490
+ var images, offset, center, pressed, dim, count,
6491
+ reference, referenceY, amplitude, target, velocity,
6492
+ xform, frame, timestamp, ticker, dragged, vertical_dragged;
6493
+
6494
+ // Initialize
6495
+ var view = $(this);
6496
+ // Don't double initialize.
6497
+ if (view.hasClass('initialized')) {
6498
+ return true;
6499
+ }
6500
+
6501
+ // Options
6502
+ if (options.full_width) {
6503
+ options.dist = 0;
6504
+ imageHeight = view.find('.carousel-item img').first().load(function(){
6505
+ view.css('height', $(this).height());
6506
+ });
6507
+ }
6508
+
6509
+ view.addClass('initialized');
6510
+ pressed = false;
6511
+ offset = target = 0;
6512
+ images = [];
6513
+ item_width = view.find('.carousel-item').first().innerWidth();
6514
+ dim = item_width * 2 + options.padding;
6515
+
6516
+ view.find('.carousel-item').each(function () {
6517
+ images.push($(this)[0]);
6518
+ });
6519
+
6520
+ count = images.length;
6521
+
6522
+
6523
+ function setupEvents() {
6524
+ if (typeof window.ontouchstart !== 'undefined') {
6525
+ view[0].addEventListener('touchstart', tap);
6526
+ view[0].addEventListener('touchmove', drag);
6527
+ view[0].addEventListener('touchend', release);
6528
+ }
6529
+ view[0].addEventListener('mousedown', tap);
6530
+ view[0].addEventListener('mousemove', drag);
6531
+ view[0].addEventListener('mouseup', release);
6532
+ view[0].addEventListener('click', click);
6533
+ }
6534
+
6535
+ function xpos(e) {
6536
+ // touch event
6537
+ if (e.targetTouches && (e.targetTouches.length >= 1)) {
6538
+ return e.targetTouches[0].clientX;
6539
+ }
6540
+
6541
+ // mouse event
6542
+ return e.clientX;
6543
+ }
6544
+
6545
+ function ypos(e) {
6546
+ // touch event
6547
+ if (e.targetTouches && (e.targetTouches.length >= 1)) {
6548
+ return e.targetTouches[0].clientY;
6549
+ }
6550
+
6551
+ // mouse event
6552
+ return e.clientY;
6553
+ }
6554
+
6555
+ function wrap(x) {
6556
+ return (x >= count) ? (x % count) : (x < 0) ? wrap(count + (x % count)) : x;
6557
+ }
6558
+
6559
+ function scroll(x) {
6560
+ var i, half, delta, dir, tween, el, alignment, xTranslation;
6561
+
6562
+ offset = (typeof x === 'number') ? x : offset;
6563
+ center = Math.floor((offset + dim / 2) / dim);
6564
+ delta = offset - center * dim;
6565
+ dir = (delta < 0) ? 1 : -1;
6566
+ tween = -dir * delta * 2 / dim;
6567
+
6568
+ if (!options.full_width) {
6569
+ alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
6570
+ alignment += 'translateY(' + (view[0].clientHeight - item_width) / 2 + 'px)';
6571
+ } else {
6572
+ alignment = 'translateX(0)';
6573
+ }
6574
+
6575
+ // center
6576
+ el = images[wrap(center)];
6577
+ el.style[xform] = alignment +
6578
+ ' translateX(' + (-delta / 2) + 'px)' +
6579
+ ' translateX(' + (dir * options.shift * tween * i) + 'px)' +
6580
+ ' translateZ(' + (options.dist * tween) + 'px)';
6581
+ el.style.zIndex = 0;
6582
+ if (options.full_width) { tweenedOpacity = 1; }
6583
+ else { tweenedOpacity = 1 - 0.2 * tween; }
6584
+ el.style.opacity = tweenedOpacity;
6585
+ half = count >> 1;
6586
+
6587
+ for (i = 1; i <= half; ++i) {
6588
+ // right side
6589
+ if (options.full_width) {
6590
+ zTranslation = options.dist;
6591
+ tweenedOpacity = (i === half && delta < 0) ? 1 - tween : 1;
6592
+ } else {
6593
+ zTranslation = options.dist * (i * 2 + tween * dir);
6594
+ tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
6595
+ }
6596
+ el = images[wrap(center + i)];
6597
+ el.style[xform] = alignment +
6598
+ ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' +
6599
+ ' translateZ(' + zTranslation + 'px)';
6600
+ el.style.zIndex = -i;
6601
+ el.style.opacity = tweenedOpacity;
6602
+
6603
+
6604
+ // left side
6605
+ if (options.full_width) {
6606
+ zTranslation = options.dist;
6607
+ tweenedOpacity = (i === half && delta > 0) ? 1 - tween : 1;
6608
+ } else {
6609
+ zTranslation = options.dist * (i * 2 - tween * dir);
6610
+ tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
6611
+ }
6612
+ el = images[wrap(center - i)];
6613
+ el.style[xform] = alignment +
6614
+ ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' +
6615
+ ' translateZ(' + zTranslation + 'px)';
6616
+ el.style.zIndex = -i;
6617
+ el.style.opacity = tweenedOpacity;
6618
+ }
6619
+
6620
+ // center
6621
+ el = images[wrap(center)];
6622
+ el.style[xform] = alignment +
6623
+ ' translateX(' + (-delta / 2) + 'px)' +
6624
+ ' translateX(' + (dir * options.shift * tween) + 'px)' +
6625
+ ' translateZ(' + (options.dist * tween) + 'px)';
6626
+ el.style.zIndex = 0;
6627
+ if (options.full_width) { tweenedOpacity = 1; }
6628
+ else { tweenedOpacity = 1 - 0.2 * tween; }
6629
+ el.style.opacity = tweenedOpacity;
6630
+ }
6631
+
6632
+ function track() {
6633
+ var now, elapsed, delta, v;
6634
+
6635
+ now = Date.now();
6636
+ elapsed = now - timestamp;
6637
+ timestamp = now;
6638
+ delta = offset - frame;
6639
+ frame = offset;
6640
+
6641
+ v = 1000 * delta / (1 + elapsed);
6642
+ velocity = 0.8 * v + 0.2 * velocity;
6643
+ }
6644
+
6645
+ function autoScroll() {
6646
+ var elapsed, delta;
6647
+
6648
+ if (amplitude) {
6649
+ elapsed = Date.now() - timestamp;
6650
+ delta = amplitude * Math.exp(-elapsed / options.time_constant);
6651
+ if (delta > 2 || delta < -2) {
6652
+ scroll(target - delta);
6653
+ requestAnimationFrame(autoScroll);
6654
+ } else {
6655
+ scroll(target);
6656
+ }
6657
+ }
6658
+ }
6659
+
6660
+ function click(e) {
6661
+ // Disable clicks if carousel was dragged.
6662
+ if (dragged) {
6663
+ e.preventDefault();
6664
+ e.stopPropagation();
6665
+ return false;
6666
+
6667
+ } else if (!options.full_width) {
6668
+ var clickedIndex = $(e.target).closest('.carousel-item').index();
6669
+ var diff = (center % count) - clickedIndex;
6670
+
6671
+ // Account for wraparound.
6672
+ if (diff < 0) {
6673
+ if (Math.abs(diff + count) < Math.abs(diff)) { diff += count; }
6674
+
6675
+ } else if (diff > 0) {
6676
+ if (Math.abs(diff - count) < diff) { diff -= count; }
6677
+ }
6678
+
6679
+ // Call prev or next accordingly.
6680
+ if (diff < 0) {
6681
+ $(this).trigger('carouselNext', [Math.abs(diff)]);
6682
+
6683
+ } else if (diff > 0) {
6684
+ $(this).trigger('carouselPrev', [diff]);
6685
+ }
6686
+ }
6687
+ }
6688
+
6689
+ function tap(e) {
6690
+ pressed = true;
6691
+ dragged = false;
6692
+ vertical_dragged = false;
6693
+ reference = xpos(e);
6694
+ referenceY = ypos(e);
6695
+
6696
+ velocity = amplitude = 0;
6697
+ frame = offset;
6698
+ timestamp = Date.now();
6699
+ clearInterval(ticker);
6700
+ ticker = setInterval(track, 100);
6701
+
6702
+ }
6703
+
6704
+ function drag(e) {
6705
+ var x, delta, deltaY;
6706
+ if (pressed) {
6707
+ x = xpos(e);
6708
+ y = ypos(e);
6709
+ delta = reference - x;
6710
+ deltaY = Math.abs(referenceY - y);
6711
+ if (deltaY < 30 && !vertical_dragged) {
6712
+ // If vertical scrolling don't allow dragging.
6713
+ if (delta > 2 || delta < -2) {
6714
+ dragged = true;
6715
+ reference = x;
6716
+ scroll(offset + delta);
6717
+ }
6718
+
6719
+ } else if (dragged) {
6720
+ // If dragging don't allow vertical scroll.
6721
+ e.preventDefault();
6722
+ e.stopPropagation();
6723
+ return false;
6724
+
6725
+ } else {
6726
+ // Vertical scrolling.
6727
+ vertical_dragged = true;
6728
+ }
6729
+ }
6730
+
6731
+ if (dragged) {
6732
+ // If dragging don't allow vertical scroll.
6733
+ e.preventDefault();
6734
+ e.stopPropagation();
6735
+ return false;
6736
+ }
6737
+ }
6738
+
6739
+ function release(e) {
6740
+ pressed = false;
6741
+
6742
+ clearInterval(ticker);
6743
+ target = offset;
6744
+ if (velocity > 10 || velocity < -10) {
6745
+ amplitude = 0.9 * velocity;
6746
+ target = offset + amplitude;
6747
+ }
6748
+ target = Math.round(target / dim) * dim;
6749
+ amplitude = target - offset;
6750
+ timestamp = Date.now();
6751
+ requestAnimationFrame(autoScroll);
6752
+
6753
+ e.preventDefault();
6754
+ e.stopPropagation();
6755
+ return false;
6756
+ }
6757
+
6758
+ xform = 'transform';
6759
+ ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
6760
+ var e = prefix + 'Transform';
6761
+ if (typeof document.body.style[e] !== 'undefined') {
6762
+ xform = e;
6763
+ return false;
6764
+ }
6765
+ return true;
6766
+ });
6767
+
6768
+
6769
+
6770
+ window.onresize = scroll;
6771
+
6772
+ setupEvents();
6773
+ scroll(offset);
6774
+
6775
+ $(this).on('carouselNext', function(e, n) {
6776
+ if (n === undefined) {
6777
+ n = 1;
6778
+ }
6779
+ target = offset + dim * n;
6780
+ if (offset !== target) {
6781
+ amplitude = target - offset;
6782
+ timestamp = Date.now();
6783
+ requestAnimationFrame(autoScroll);
6784
+ }
6785
+ });
6786
+
6787
+ $(this).on('carouselPrev', function(e, n) {
6788
+ if (n === undefined) {
6789
+ n = 1;
6790
+ }
6791
+ target = offset - dim * n;
6792
+ if (offset !== target) {
6793
+ amplitude = target - offset;
6794
+ timestamp = Date.now();
6795
+ requestAnimationFrame(autoScroll);
6796
+ }
6797
+ });
6798
+
6799
+ });
6800
+
6801
+
6802
+
6803
+ },
6804
+ next : function(n) {
6805
+ $(this).trigger('carouselNext', [n]);
6806
+ },
6807
+ prev : function(n) {
6808
+ $(this).trigger('carouselPrev', [n]);
6809
+ },
6810
+ };
6811
+
6812
+
6813
+ $.fn.carousel = function(methodOrOptions) {
6814
+ if ( methods[methodOrOptions] ) {
6815
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
6816
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
6817
+ // Default to "init"
6818
+ return methods.init.apply( this, arguments );
6819
+ } else {
6820
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.carousel' );
6821
+ }
6822
+ }; // Plugin end
6823
+ }( jQuery ));