materialize-sass 0.97.6 → 0.97.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/app/assets/javascripts/materialize-sprockets.js +1 -4
- data/app/assets/javascripts/materialize.js +887 -338
- data/app/assets/javascripts/materialize.min.js +5 -5
- data/app/assets/javascripts/materialize/animation.js +0 -0
- data/app/assets/javascripts/materialize/buttons.js +0 -0
- data/app/assets/javascripts/materialize/cards.js +0 -3
- data/app/assets/javascripts/materialize/carousel.js +150 -46
- data/app/assets/javascripts/materialize/character_counter.js +0 -0
- data/app/assets/javascripts/materialize/chips.js +262 -4
- data/app/assets/javascripts/materialize/collapsible.js +0 -0
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -0
- data/app/assets/javascripts/materialize/date_picker/picker.js +0 -0
- data/app/assets/javascripts/materialize/dropdown.js +206 -178
- data/app/assets/javascripts/materialize/extras/nouislider.js +0 -0
- data/app/assets/javascripts/materialize/extras/nouislider.min.js +0 -0
- data/app/assets/javascripts/materialize/forms.js +94 -9
- data/app/assets/javascripts/materialize/global.js +0 -0
- data/app/assets/javascripts/materialize/hammer.min.js +0 -0
- data/app/assets/javascripts/materialize/init.js +21 -3
- data/app/assets/javascripts/materialize/initial.js +0 -0
- data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -0
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -0
- data/app/assets/javascripts/materialize/leanModal.js +11 -10
- data/app/assets/javascripts/materialize/materialbox.js +0 -0
- data/app/assets/javascripts/materialize/parallax.js +0 -0
- data/app/assets/javascripts/materialize/prism.js +0 -0
- data/app/assets/javascripts/materialize/pushpin.js +15 -1
- data/app/assets/javascripts/materialize/scrollFire.js +2 -2
- data/app/assets/javascripts/materialize/scrollspy.js +7 -8
- data/app/assets/javascripts/materialize/sideNav.js +15 -7
- data/app/assets/javascripts/materialize/slider.js +1 -1
- data/app/assets/javascripts/materialize/tabs.js +15 -2
- data/app/assets/javascripts/materialize/toasts.js +0 -0
- data/app/assets/javascripts/materialize/tooltip.js +86 -59
- data/app/assets/javascripts/materialize/transitions.js +20 -5
- data/app/assets/javascripts/materialize/velocity.min.js +0 -0
- data/app/assets/javascripts/materialize/waves.js +0 -0
- data/app/assets/stylesheets/materialize/components/_buttons.scss +15 -1
- data/app/assets/stylesheets/materialize/components/_cards.scss +54 -7
- data/app/assets/stylesheets/materialize/components/_carousel.scss +60 -9
- data/app/assets/stylesheets/materialize/components/_chips.scss +49 -2
- data/app/assets/stylesheets/materialize/components/_collapsible.scss +3 -3
- data/app/assets/stylesheets/materialize/components/_color.scss +1 -1
- data/app/assets/stylesheets/materialize/components/_global.scss +7 -8
- data/app/assets/stylesheets/materialize/components/_grid.scss +1 -0
- data/app/assets/stylesheets/materialize/components/_navbar.scss +15 -4
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +93 -8
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +20 -22
- data/app/assets/stylesheets/materialize/components/_variables.scss +11 -7
- data/app/assets/stylesheets/materialize/components/_waves.scss +5 -1
- data/app/assets/stylesheets/materialize/components/forms/_checkboxes.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_file-input.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_forms.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +23 -4
- data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_range.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_select.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_switches.scss +0 -0
- data/app/assets/stylesheets/materialize/extras/nouislider.css +0 -0
- data/lib/materialize-sass/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 774a4666b7adb674d01fd664b5972f969da1c736
|
4
|
+
data.tar.gz: 49ca467c5f0c2795e7bdd480570e48720ceb00ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d7389377de8c092eafc089eda8619fe6f67f1bd33511fd552df2e83a3f89139a4ac2ca6d909a37d2ffcd09f3f40faae446e0186999a294eecb64a1aece4167
|
7
|
+
data.tar.gz: 6e92260588897363d28ece9a8f55e84f3480e353fafa76b41e1ce071401b912c82a8ee81656d30f6427a9d037a29ff76f75495bdd5cec40005010d2667ca8fd5
|
data/.gitignore
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Materialize v0.97.
|
2
|
+
* Materialize v0.97.7 (http://materializecss.com)
|
3
3
|
* Copyright 2014-2015 Materialize
|
4
4
|
* MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
|
5
5
|
*/
|
@@ -455,7 +455,7 @@ if ($) {
|
|
455
455
|
return this;
|
456
456
|
};
|
457
457
|
|
458
|
-
$.fn.dropdown = function (
|
458
|
+
$.fn.dropdown = function (options) {
|
459
459
|
var defaults = {
|
460
460
|
inDuration: 300,
|
461
461
|
outDuration: 225,
|
@@ -463,220 +463,248 @@ if ($) {
|
|
463
463
|
hover: false,
|
464
464
|
gutter: 0, // Spacing from edge
|
465
465
|
belowOrigin: false,
|
466
|
-
alignment: 'left'
|
466
|
+
alignment: 'left',
|
467
|
+
stopPropagation: false
|
467
468
|
};
|
468
469
|
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
var activates = $("#"+ origin.attr('data-activates'));
|
476
|
-
|
477
|
-
function updateOptions() {
|
478
|
-
if (origin.data('induration') !== undefined)
|
479
|
-
options.inDuration = origin.data('inDuration');
|
480
|
-
if (origin.data('outduration') !== undefined)
|
481
|
-
options.outDuration = origin.data('outDuration');
|
482
|
-
if (origin.data('constrainwidth') !== undefined)
|
483
|
-
options.constrain_width = origin.data('constrainwidth');
|
484
|
-
if (origin.data('hover') !== undefined)
|
485
|
-
options.hover = origin.data('hover');
|
486
|
-
if (origin.data('gutter') !== undefined)
|
487
|
-
options.gutter = origin.data('gutter');
|
488
|
-
if (origin.data('beloworigin') !== undefined)
|
489
|
-
options.belowOrigin = origin.data('beloworigin');
|
490
|
-
if (origin.data('alignment') !== undefined)
|
491
|
-
options.alignment = origin.data('alignment');
|
470
|
+
// Open dropdown.
|
471
|
+
if (options === "open") {
|
472
|
+
this.each(function() {
|
473
|
+
$(this).trigger('open');
|
474
|
+
});
|
475
|
+
return false;
|
492
476
|
}
|
493
477
|
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
478
|
+
// Close dropdown.
|
479
|
+
if (options === "close") {
|
480
|
+
this.each(function() {
|
481
|
+
$(this).trigger('close');
|
482
|
+
});
|
483
|
+
return false;
|
484
|
+
}
|
498
485
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
//
|
505
|
-
|
506
|
-
|
486
|
+
this.each(function(){
|
487
|
+
var origin = $(this);
|
488
|
+
var options = $.extend({}, defaults, options);
|
489
|
+
var isFocused = false;
|
490
|
+
|
491
|
+
// Dropdown menu
|
492
|
+
var activates = $("#"+ origin.attr('data-activates'));
|
493
|
+
|
494
|
+
function updateOptions() {
|
495
|
+
if (origin.data('induration') !== undefined)
|
496
|
+
options.inDuration = origin.data('induration');
|
497
|
+
if (origin.data('outduration') !== undefined)
|
498
|
+
options.outDuration = origin.data('outduration');
|
499
|
+
if (origin.data('constrainwidth') !== undefined)
|
500
|
+
options.constrain_width = origin.data('constrainwidth');
|
501
|
+
if (origin.data('hover') !== undefined)
|
502
|
+
options.hover = origin.data('hover');
|
503
|
+
if (origin.data('gutter') !== undefined)
|
504
|
+
options.gutter = origin.data('gutter');
|
505
|
+
if (origin.data('beloworigin') !== undefined)
|
506
|
+
options.belowOrigin = origin.data('beloworigin');
|
507
|
+
if (origin.data('alignment') !== undefined)
|
508
|
+
options.alignment = origin.data('alignment');
|
509
|
+
if (origin.data('stoppropagation') !== undefined)
|
510
|
+
options.stopPropagation = origin.data('stoppropagation');
|
507
511
|
}
|
508
512
|
|
509
|
-
// Check html data attributes
|
510
513
|
updateOptions();
|
511
514
|
|
512
|
-
//
|
513
|
-
|
514
|
-
origin.addClass('active');
|
515
|
-
|
516
|
-
// Constrain width
|
517
|
-
if (options.constrain_width === true) {
|
518
|
-
activates.css('width', origin.outerWidth());
|
519
|
-
|
520
|
-
} else {
|
521
|
-
activates.css('white-space', 'nowrap');
|
522
|
-
}
|
515
|
+
// Attach dropdown to its activator
|
516
|
+
origin.after(activates);
|
523
517
|
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
// Below Origin
|
534
|
-
var verticalOffset = 0;
|
535
|
-
if (options.belowOrigin === true) {
|
536
|
-
verticalOffset = originHeight;
|
537
|
-
}
|
518
|
+
/*
|
519
|
+
Helper function to position and resize dropdown.
|
520
|
+
Used in hover and click handler.
|
521
|
+
*/
|
522
|
+
function placeDropdown(eventType) {
|
523
|
+
// Check for simultaneous focus and click events.
|
524
|
+
if (eventType === 'focus') {
|
525
|
+
isFocused = true;
|
526
|
+
}
|
538
527
|
|
539
|
-
|
540
|
-
|
541
|
-
var wrapper = origin.parent();
|
542
|
-
if (!wrapper.is('body') && wrapper[0].scrollHeight > wrapper[0].clientHeight) {
|
543
|
-
scrollOffset = wrapper[0].scrollTop;
|
544
|
-
}
|
528
|
+
// Check html data attributes
|
529
|
+
updateOptions();
|
545
530
|
|
531
|
+
// Set Dropdown state
|
532
|
+
activates.addClass('active');
|
533
|
+
origin.addClass('active');
|
546
534
|
|
547
|
-
|
548
|
-
|
549
|
-
|
535
|
+
// Constrain width
|
536
|
+
if (options.constrain_width === true) {
|
537
|
+
activates.css('width', origin.outerWidth());
|
550
538
|
|
551
|
-
} else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
|
552
|
-
// Dropdown goes past screen on left, force left alignment
|
553
|
-
currAlignment = 'left';
|
554
|
-
}
|
555
|
-
// Vertical bottom offscreen detection
|
556
|
-
if (offsetTop + activates.innerHeight() > windowHeight) {
|
557
|
-
// If going upwards still goes offscreen, just crop height of dropdown.
|
558
|
-
if (offsetTop + originHeight - activates.innerHeight() < 0) {
|
559
|
-
var adjustedHeight = windowHeight - offsetTop - verticalOffset;
|
560
|
-
activates.css('max-height', adjustedHeight);
|
561
539
|
} else {
|
562
|
-
|
563
|
-
if (!verticalOffset) {
|
564
|
-
verticalOffset += originHeight;
|
565
|
-
}
|
566
|
-
verticalOffset -= activates.innerHeight();
|
540
|
+
activates.css('white-space', 'nowrap');
|
567
541
|
}
|
568
|
-
}
|
569
542
|
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
var
|
577
|
-
|
578
|
-
|
579
|
-
|
543
|
+
// Offscreen detection
|
544
|
+
var windowHeight = window.innerHeight;
|
545
|
+
var originHeight = origin.innerHeight();
|
546
|
+
var offsetLeft = origin.offset().left;
|
547
|
+
var offsetTop = origin.offset().top - $(window).scrollTop();
|
548
|
+
var currAlignment = options.alignment;
|
549
|
+
var gutterSpacing = 0;
|
550
|
+
var leftPosition = 0;
|
551
|
+
|
552
|
+
// Below Origin
|
553
|
+
var verticalOffset = 0;
|
554
|
+
if (options.belowOrigin === true) {
|
555
|
+
verticalOffset = originHeight;
|
556
|
+
}
|
557
|
+
|
558
|
+
// Check for scrolling positioned container.
|
559
|
+
var scrollYOffset = 0;
|
560
|
+
var scrollXOffset = 0;
|
561
|
+
var wrapper = origin.parent();
|
562
|
+
if (!wrapper.is('body')) {
|
563
|
+
if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
|
564
|
+
scrollYOffset = wrapper[0].scrollTop;
|
565
|
+
}
|
566
|
+
if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
|
567
|
+
scrollXOffset = wrapper[0].scrollLeft;
|
568
|
+
}
|
569
|
+
}
|
580
570
|
|
581
|
-
// Position dropdown
|
582
|
-
activates.css({
|
583
|
-
position: 'absolute',
|
584
|
-
top: origin.position().top + verticalOffset + scrollOffset,
|
585
|
-
left: leftPosition
|
586
|
-
});
|
587
571
|
|
572
|
+
if (offsetLeft + activates.innerWidth() > $(window).width()) {
|
573
|
+
// Dropdown goes past screen on right, force right alignment
|
574
|
+
currAlignment = 'right';
|
588
575
|
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
576
|
+
} else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
|
577
|
+
// Dropdown goes past screen on left, force left alignment
|
578
|
+
currAlignment = 'left';
|
579
|
+
}
|
580
|
+
// Vertical bottom offscreen detection
|
581
|
+
if (offsetTop + activates.innerHeight() > windowHeight) {
|
582
|
+
// If going upwards still goes offscreen, just crop height of dropdown.
|
583
|
+
if (offsetTop + originHeight - activates.innerHeight() < 0) {
|
584
|
+
var adjustedHeight = windowHeight - offsetTop - verticalOffset;
|
585
|
+
activates.css('max-height', adjustedHeight);
|
586
|
+
} else {
|
587
|
+
// Flow upwards.
|
588
|
+
if (!verticalOffset) {
|
589
|
+
verticalOffset += originHeight;
|
590
|
+
}
|
591
|
+
verticalOffset -= activates.innerHeight();
|
592
|
+
}
|
597
593
|
}
|
598
|
-
})
|
599
|
-
.animate( {opacity: 1}, {queue: false, duration: options.inDuration, easing: 'easeOutSine'});
|
600
|
-
}
|
601
|
-
|
602
|
-
function hideDropdown() {
|
603
|
-
// Check for simultaneous focus and click events.
|
604
|
-
isFocused = false;
|
605
|
-
activates.fadeOut(options.outDuration);
|
606
|
-
activates.removeClass('active');
|
607
|
-
origin.removeClass('active');
|
608
|
-
setTimeout(function() { activates.css('max-height', ''); }, options.outDuration);
|
609
|
-
}
|
610
594
|
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
// Hover handler to show dropdown
|
616
|
-
origin.on('mouseenter', function(e){ // Mouse over
|
617
|
-
if (open === false) {
|
618
|
-
placeDropdown();
|
619
|
-
open = true;
|
595
|
+
// Handle edge alignment
|
596
|
+
if (currAlignment === 'left') {
|
597
|
+
gutterSpacing = options.gutter;
|
598
|
+
leftPosition = origin.position().left + gutterSpacing;
|
620
599
|
}
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
if(!$(toEl).closest('.dropdown-content').is(activates)) {
|
626
|
-
activates.stop(true, true);
|
627
|
-
hideDropdown();
|
628
|
-
open = false;
|
600
|
+
else if (currAlignment === 'right') {
|
601
|
+
var offsetRight = origin.position().left + origin.outerWidth() - activates.outerWidth();
|
602
|
+
gutterSpacing = -options.gutter;
|
603
|
+
leftPosition = offsetRight + gutterSpacing;
|
629
604
|
}
|
630
|
-
});
|
631
605
|
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
}
|
639
|
-
});
|
606
|
+
// Position dropdown
|
607
|
+
activates.css({
|
608
|
+
position: 'absolute',
|
609
|
+
top: origin.position().top + verticalOffset + scrollYOffset,
|
610
|
+
left: leftPosition + scrollXOffset
|
611
|
+
});
|
640
612
|
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
613
|
+
|
614
|
+
// Show dropdown
|
615
|
+
activates.stop(true, true).css('opacity', 0)
|
616
|
+
.slideDown({
|
617
|
+
queue: false,
|
618
|
+
duration: options.inDuration,
|
619
|
+
easing: 'easeOutCubic',
|
620
|
+
complete: function() {
|
621
|
+
$(this).css('height', '');
|
622
|
+
}
|
623
|
+
})
|
624
|
+
.animate( {opacity: 1}, {queue: false, duration: options.inDuration, easing: 'easeOutSine'});
|
625
|
+
}
|
626
|
+
|
627
|
+
function hideDropdown() {
|
628
|
+
// Check for simultaneous focus and click events.
|
629
|
+
isFocused = false;
|
630
|
+
activates.fadeOut(options.outDuration);
|
631
|
+
activates.removeClass('active');
|
632
|
+
origin.removeClass('active');
|
633
|
+
setTimeout(function() { activates.css('max-height', ''); }, options.outDuration);
|
634
|
+
}
|
635
|
+
|
636
|
+
// Hover
|
637
|
+
if (options.hover) {
|
638
|
+
var open = false;
|
639
|
+
origin.unbind('click.' + origin.attr('id'));
|
640
|
+
// Hover handler to show dropdown
|
641
|
+
origin.on('mouseenter', function(e){ // Mouse over
|
642
|
+
if (open === false) {
|
643
|
+
placeDropdown();
|
644
|
+
open = true;
|
645
|
+
}
|
646
|
+
});
|
647
|
+
origin.on('mouseleave', function(e){
|
648
|
+
// If hover on origin then to something other than dropdown content, then close
|
649
|
+
var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
|
650
|
+
if(!$(toEl).closest('.dropdown-content').is(activates)) {
|
651
|
+
activates.stop(true, true);
|
652
|
+
hideDropdown();
|
653
|
+
open = false;
|
652
654
|
}
|
653
|
-
|
654
|
-
|
655
|
+
});
|
656
|
+
|
657
|
+
activates.on('mouseleave', function(e){ // Mouse out
|
658
|
+
var toEl = e.toElement || e.relatedTarget;
|
659
|
+
if(!$(toEl).closest('.dropdown-button').is(origin)) {
|
660
|
+
activates.stop(true, true);
|
655
661
|
hideDropdown();
|
656
|
-
|
662
|
+
open = false;
|
657
663
|
}
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
+
});
|
665
|
+
|
666
|
+
// Click
|
667
|
+
} else {
|
668
|
+
// Click handler to show dropdown
|
669
|
+
origin.unbind('click.' + origin.attr('id'));
|
670
|
+
origin.bind('click.'+origin.attr('id'), function(e){
|
671
|
+
if (!isFocused) {
|
672
|
+
if ( origin[0] == e.currentTarget &&
|
673
|
+
!origin.hasClass('active') &&
|
674
|
+
($(e.target).closest('.dropdown-content').length === 0)) {
|
675
|
+
e.preventDefault(); // Prevents button click from moving window
|
676
|
+
if (options.stopPropagation) {
|
677
|
+
e.stopPropagation();
|
664
678
|
}
|
665
|
-
|
679
|
+
placeDropdown('click');
|
680
|
+
}
|
681
|
+
// If origin is clicked and menu is open, close menu
|
682
|
+
else if (origin.hasClass('active')) {
|
683
|
+
hideDropdown();
|
684
|
+
$(document).unbind('click.'+ activates.attr('id') + ' touchstart.' + activates.attr('id'));
|
685
|
+
}
|
686
|
+
// If menu open, add click close handler to document
|
687
|
+
if (activates.hasClass('active')) {
|
688
|
+
$(document).bind('click.'+ activates.attr('id') + ' touchstart.' + activates.attr('id'), function (e) {
|
689
|
+
if (!activates.is(e.target) && !origin.is(e.target) && (!origin.find(e.target).length) ) {
|
690
|
+
hideDropdown();
|
691
|
+
$(document).unbind('click.'+ activates.attr('id') + ' touchstart.' + activates.attr('id'));
|
692
|
+
}
|
693
|
+
});
|
694
|
+
}
|
666
695
|
}
|
667
|
-
}
|
668
|
-
});
|
696
|
+
});
|
669
697
|
|
670
|
-
|
698
|
+
} // End else
|
671
699
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
700
|
+
// Listen to open and close event - useful for select component
|
701
|
+
origin.on('open', function(e, eventType) {
|
702
|
+
placeDropdown(eventType);
|
703
|
+
});
|
704
|
+
origin.on('close', hideDropdown);
|
677
705
|
|
678
706
|
|
679
|
-
|
707
|
+
});
|
680
708
|
}; // End dropdown plugin
|
681
709
|
|
682
710
|
$(document).ready(function(){
|
@@ -706,16 +734,17 @@ if ($) {
|
|
706
734
|
ready: undefined,
|
707
735
|
complete: undefined,
|
708
736
|
dismissible: true,
|
709
|
-
starting_top: '4%'
|
710
|
-
|
711
|
-
|
737
|
+
starting_top: '4%',
|
738
|
+
ending_top: '10%'
|
739
|
+
};
|
740
|
+
var $modal = $(this);
|
712
741
|
|
713
742
|
if ($modal.hasClass('open')) {
|
714
743
|
return;
|
715
744
|
}
|
716
745
|
|
717
|
-
overlayID = _generateID();
|
718
|
-
$overlay = $('<div class="lean-overlay"></div>');
|
746
|
+
var overlayID = _generateID();
|
747
|
+
var $overlay = $('<div class="lean-overlay"></div>');
|
719
748
|
lStack = (++_stack);
|
720
749
|
|
721
750
|
// Store a reference of the overlay
|
@@ -771,7 +800,7 @@ if ($) {
|
|
771
800
|
else {
|
772
801
|
$.Velocity.hook($modal, "scaleX", 0.7);
|
773
802
|
$modal.css({ top: options.starting_top });
|
774
|
-
$modal.velocity({top:
|
803
|
+
$modal.velocity({top: options.ending_top, opacity: 1, scaleX: '1'}, {
|
775
804
|
duration: options.in_duration,
|
776
805
|
queue: false,
|
777
806
|
ease: "easeOutCubic",
|
@@ -793,10 +822,10 @@ if ($) {
|
|
793
822
|
var defaults = {
|
794
823
|
out_duration: 250,
|
795
824
|
complete: undefined
|
796
|
-
}
|
797
|
-
$modal = $(this)
|
798
|
-
overlayID = $modal.data('overlay-id')
|
799
|
-
$overlay = $('#' + overlayID);
|
825
|
+
};
|
826
|
+
var $modal = $(this);
|
827
|
+
var overlayID = $modal.data('overlay-id');
|
828
|
+
var $overlay = $('#' + overlayID);
|
800
829
|
$modal.removeClass('open');
|
801
830
|
|
802
831
|
options = $.extend(defaults, options);
|
@@ -1203,7 +1232,12 @@ $(document).ready(function(){
|
|
1203
1232
|
}( jQuery ));;(function ($) {
|
1204
1233
|
|
1205
1234
|
var methods = {
|
1206
|
-
init : function() {
|
1235
|
+
init : function(options) {
|
1236
|
+
var defaults = {
|
1237
|
+
onShow: null
|
1238
|
+
};
|
1239
|
+
options = $.extend(defaults, options);
|
1240
|
+
|
1207
1241
|
return this.each(function() {
|
1208
1242
|
|
1209
1243
|
// For each set of tabs, we want to keep track of
|
@@ -1222,7 +1256,7 @@ $(document).ready(function(){
|
|
1222
1256
|
|
1223
1257
|
// If no match is found, use the first link or any with class 'active' as the initial active tab.
|
1224
1258
|
if ($active.length === 0) {
|
1225
|
-
|
1259
|
+
$active = $(this).find('li.tab a.active').first();
|
1226
1260
|
}
|
1227
1261
|
if ($active.length === 0) {
|
1228
1262
|
$active = $(this).find('li.tab a').first();
|
@@ -1270,6 +1304,11 @@ $(document).ready(function(){
|
|
1270
1304
|
return;
|
1271
1305
|
}
|
1272
1306
|
|
1307
|
+
// Act as regular link if target attribute is specified.
|
1308
|
+
if (!!$(this).attr("target")) {
|
1309
|
+
return;
|
1310
|
+
}
|
1311
|
+
|
1273
1312
|
$tabs_width = $this.width();
|
1274
1313
|
$tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
|
1275
1314
|
|
@@ -1296,6 +1335,9 @@ $(document).ready(function(){
|
|
1296
1335
|
|
1297
1336
|
if ($content !== undefined) {
|
1298
1337
|
$content.show();
|
1338
|
+
if (typeof(options.onShow) === "function") {
|
1339
|
+
options.onShow.call(this, $content);
|
1340
|
+
}
|
1299
1341
|
}
|
1300
1342
|
|
1301
1343
|
// Update indicator
|
@@ -1337,17 +1379,20 @@ $(document).ready(function(){
|
|
1337
1379
|
}( jQuery ));
|
1338
1380
|
;(function ($) {
|
1339
1381
|
$.fn.tooltip = function (options) {
|
1340
|
-
|
1341
|
-
|
1382
|
+
var timeout = null,
|
1383
|
+
margin = 5;
|
1342
1384
|
|
1343
1385
|
// Defaults
|
1344
1386
|
var defaults = {
|
1345
|
-
delay: 350
|
1387
|
+
delay: 350,
|
1388
|
+
tooltip: '',
|
1389
|
+
position: 'bottom',
|
1390
|
+
html: false
|
1346
1391
|
};
|
1347
1392
|
|
1348
1393
|
// Remove tooltip from the activator
|
1349
1394
|
if (options === "remove") {
|
1350
|
-
this.each(function(){
|
1395
|
+
this.each(function() {
|
1351
1396
|
$('#' + $(this).attr('data-tooltip-id')).remove();
|
1352
1397
|
$(this).off('mouseenter.tooltip mouseleave.tooltip');
|
1353
1398
|
});
|
@@ -1356,53 +1401,76 @@ $(document).ready(function(){
|
|
1356
1401
|
|
1357
1402
|
options = $.extend(defaults, options);
|
1358
1403
|
|
1359
|
-
|
1360
|
-
return this.each(function(){
|
1404
|
+
return this.each(function() {
|
1361
1405
|
var tooltipId = Materialize.guid();
|
1362
1406
|
var origin = $(this);
|
1363
1407
|
origin.attr('data-tooltip-id', tooltipId);
|
1364
1408
|
|
1365
|
-
//
|
1366
|
-
var
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1409
|
+
// Get attributes.
|
1410
|
+
var allowHtml,
|
1411
|
+
tooltipDelay,
|
1412
|
+
tooltipPosition,
|
1413
|
+
tooltipText,
|
1414
|
+
tooltipEl,
|
1415
|
+
backdrop;
|
1416
|
+
var setAttributes = function() {
|
1417
|
+
allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
|
1418
|
+
tooltipDelay = origin.attr('data-delay');
|
1419
|
+
tooltipDelay = (tooltipDelay === undefined || tooltipDelay === '') ?
|
1420
|
+
options.delay : tooltipDelay;
|
1421
|
+
tooltipPosition = origin.attr('data-position');
|
1422
|
+
tooltipPosition = (tooltipPosition === undefined || tooltipPosition === '') ?
|
1423
|
+
options.position : tooltipPosition;
|
1424
|
+
tooltipText = origin.attr('data-tooltip');
|
1425
|
+
tooltipText = (tooltipText === undefined || tooltipText === '') ?
|
1426
|
+
options.tooltip : tooltipText;
|
1427
|
+
};
|
1428
|
+
setAttributes();
|
1429
|
+
|
1430
|
+
var renderTooltipEl = function() {
|
1431
|
+
var tooltip = $('<div class="material-tooltip"></div>');
|
1432
|
+
|
1433
|
+
// Create Text span
|
1434
|
+
if (allowHtml) {
|
1435
|
+
tooltipText = $('<span></span>').html(tooltipText);
|
1436
|
+
} else{
|
1437
|
+
tooltipText = $('<span></span>').text(tooltipText);
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
// Create tooltip
|
1441
|
+
tooltip.append(tooltipText)
|
1442
|
+
.appendTo($('body'))
|
1443
|
+
.attr('id', tooltipId);
|
1444
|
+
|
1445
|
+
// Create backdrop
|
1446
|
+
backdrop = $('<div class="backdrop"></div>');
|
1447
|
+
backdrop.appendTo(tooltip);
|
1448
|
+
return tooltip;
|
1449
|
+
};
|
1450
|
+
tooltipEl = renderTooltipEl();
|
1451
|
+
|
1452
|
+
// Destroy previously binded events
|
1453
|
+
origin.off('mouseenter.tooltip mouseleave.tooltip');
|
1454
|
+
// Mouse In
|
1455
|
+
var started = false, timeoutRef;
|
1456
|
+
origin.on({'mouseenter.tooltip': function(e) {
|
1457
|
+
var showTooltip = function() {
|
1458
|
+
setAttributes();
|
1389
1459
|
started = true;
|
1390
|
-
|
1460
|
+
tooltipEl.velocity('stop');
|
1391
1461
|
backdrop.velocity('stop');
|
1392
|
-
|
1393
|
-
|
1394
|
-
// Set Tooltip text
|
1395
|
-
newTooltip.children('span').text(origin.attr('data-tooltip'));
|
1462
|
+
tooltipEl.css({ display: 'block', left: '0px', top: '0px' });
|
1396
1463
|
|
1397
1464
|
// Tooltip positioning
|
1398
1465
|
var originWidth = origin.outerWidth();
|
1399
1466
|
var originHeight = origin.outerHeight();
|
1400
|
-
|
1401
|
-
var tooltipHeight =
|
1402
|
-
var tooltipWidth =
|
1467
|
+
|
1468
|
+
var tooltipHeight = tooltipEl.outerHeight();
|
1469
|
+
var tooltipWidth = tooltipEl.outerWidth();
|
1403
1470
|
var tooltipVerticalMovement = '0px';
|
1404
1471
|
var tooltipHorizontalMovement = '0px';
|
1405
|
-
var
|
1472
|
+
var scaleXFactor = 8;
|
1473
|
+
var scaleYFactor = 8;
|
1406
1474
|
var targetTop, targetLeft, newCoordinates;
|
1407
1475
|
|
1408
1476
|
if (tooltipPosition === "top") {
|
@@ -1413,8 +1481,10 @@ $(document).ready(function(){
|
|
1413
1481
|
|
1414
1482
|
tooltipVerticalMovement = '-10px';
|
1415
1483
|
backdrop.css({
|
1484
|
+
bottom: 0,
|
1485
|
+
left: 0,
|
1416
1486
|
borderRadius: '14px 14px 0 0',
|
1417
|
-
transformOrigin: '50%
|
1487
|
+
transformOrigin: '50% 100%',
|
1418
1488
|
marginTop: tooltipHeight,
|
1419
1489
|
marginLeft: (tooltipWidth/2) - (backdrop.width()/2)
|
1420
1490
|
});
|
@@ -1427,6 +1497,8 @@ $(document).ready(function(){
|
|
1427
1497
|
|
1428
1498
|
tooltipHorizontalMovement = '-10px';
|
1429
1499
|
backdrop.css({
|
1500
|
+
top: '-7px',
|
1501
|
+
right: 0,
|
1430
1502
|
width: '14px',
|
1431
1503
|
height: '14px',
|
1432
1504
|
borderRadius: '14px 0 0 14px',
|
@@ -1443,6 +1515,8 @@ $(document).ready(function(){
|
|
1443
1515
|
|
1444
1516
|
tooltipHorizontalMovement = '+10px';
|
1445
1517
|
backdrop.css({
|
1518
|
+
top: '-7px',
|
1519
|
+
left: 0,
|
1446
1520
|
width: '14px',
|
1447
1521
|
height: '14px',
|
1448
1522
|
borderRadius: '0 14px 14px 0',
|
@@ -1458,35 +1532,30 @@ $(document).ready(function(){
|
|
1458
1532
|
newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
|
1459
1533
|
tooltipVerticalMovement = '+10px';
|
1460
1534
|
backdrop.css({
|
1535
|
+
top: 0,
|
1536
|
+
left: 0,
|
1461
1537
|
marginLeft: (tooltipWidth/2) - (backdrop.width()/2)
|
1462
1538
|
});
|
1463
1539
|
}
|
1464
1540
|
|
1465
1541
|
// Set tooptip css placement
|
1466
|
-
|
1542
|
+
tooltipEl.css({
|
1467
1543
|
top: newCoordinates.y,
|
1468
1544
|
left: newCoordinates.x
|
1469
1545
|
});
|
1470
1546
|
|
1471
1547
|
// Calculate Scale to fill
|
1472
|
-
|
1473
|
-
|
1474
|
-
scale_factor = 8;
|
1475
|
-
}
|
1476
|
-
if (tooltipPosition === "right" || tooltipPosition === "left") {
|
1477
|
-
scale_factor = tooltipWidth / 10;
|
1478
|
-
if (scale_factor < 6)
|
1479
|
-
scale_factor = 6;
|
1480
|
-
}
|
1548
|
+
scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdrop.css('width'));
|
1549
|
+
scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdrop.css('height'));
|
1481
1550
|
|
1482
|
-
|
1551
|
+
tooltipEl.velocity({ marginTop: tooltipVerticalMovement, marginLeft: tooltipHorizontalMovement}, { duration: 350, queue: false })
|
1483
1552
|
.velocity({opacity: 1}, {duration: 300, delay: 50, queue: false});
|
1484
1553
|
backdrop.css({ display: 'block' })
|
1485
1554
|
.velocity({opacity:1},{duration: 55, delay: 0, queue: false})
|
1486
|
-
.velocity({
|
1487
|
-
|
1555
|
+
.velocity({scaleX: scaleXFactor, scaleY: scaleYFactor}, {duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad'});
|
1556
|
+
};
|
1488
1557
|
|
1489
|
-
|
1558
|
+
timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
|
1490
1559
|
|
1491
1560
|
// Mouse Out
|
1492
1561
|
},
|
@@ -1497,15 +1566,15 @@ $(document).ready(function(){
|
|
1497
1566
|
|
1498
1567
|
// Animate back
|
1499
1568
|
setTimeout(function() {
|
1500
|
-
if (started
|
1501
|
-
|
1569
|
+
if (started !== true) {
|
1570
|
+
tooltipEl.velocity({
|
1502
1571
|
opacity: 0, marginTop: 0, marginLeft: 0}, { duration: 225, queue: false});
|
1503
|
-
backdrop.velocity({opacity: 0,
|
1572
|
+
backdrop.velocity({opacity: 0, scaleX: 1, scaleY: 1}, {
|
1504
1573
|
duration:225,
|
1505
1574
|
queue: false,
|
1506
1575
|
complete: function(){
|
1507
1576
|
backdrop.css('display', 'none');
|
1508
|
-
|
1577
|
+
tooltipEl.css('display', 'none');
|
1509
1578
|
started = false;}
|
1510
1579
|
});
|
1511
1580
|
}
|
@@ -1516,7 +1585,7 @@ $(document).ready(function(){
|
|
1516
1585
|
};
|
1517
1586
|
|
1518
1587
|
var repositionWithinScreen = function(x, y, width, height) {
|
1519
|
-
var newX = x
|
1588
|
+
var newX = x;
|
1520
1589
|
var newY = y;
|
1521
1590
|
|
1522
1591
|
if (newX < 0) {
|
@@ -2017,7 +2086,7 @@ $(document).ready(function(){
|
|
2017
2086
|
var methods = {
|
2018
2087
|
init : function(options) {
|
2019
2088
|
var defaults = {
|
2020
|
-
menuWidth:
|
2089
|
+
menuWidth: 300,
|
2021
2090
|
edge: 'left',
|
2022
2091
|
closeOnClick: false
|
2023
2092
|
};
|
@@ -2028,7 +2097,7 @@ $(document).ready(function(){
|
|
2028
2097
|
var menu_id = $("#"+ $this.attr('data-activates'));
|
2029
2098
|
|
2030
2099
|
// Set to width
|
2031
|
-
if (options.menuWidth !=
|
2100
|
+
if (options.menuWidth != 300) {
|
2032
2101
|
menu_id.css('width', options.menuWidth);
|
2033
2102
|
}
|
2034
2103
|
|
@@ -2058,7 +2127,7 @@ $(document).ready(function(){
|
|
2058
2127
|
$(window).resize( function() {
|
2059
2128
|
if (window.innerWidth > 992) {
|
2060
2129
|
// Close menu if window is resized bigger than 992 and user has fixed sidenav
|
2061
|
-
if ($('#sidenav-overlay').length
|
2130
|
+
if ($('#sidenav-overlay').length !== 0 && menuOut) {
|
2062
2131
|
removeMenu(true);
|
2063
2132
|
}
|
2064
2133
|
else {
|
@@ -2144,7 +2213,9 @@ $(document).ready(function(){
|
|
2144
2213
|
var menuOut = false;
|
2145
2214
|
|
2146
2215
|
dragTarget.on('click', function(){
|
2147
|
-
|
2216
|
+
if (menuOut) {
|
2217
|
+
removeMenu();
|
2218
|
+
}
|
2148
2219
|
});
|
2149
2220
|
|
2150
2221
|
dragTarget.hammer({
|
@@ -2234,13 +2305,14 @@ $(document).ready(function(){
|
|
2234
2305
|
if (options.edge === 'left') {
|
2235
2306
|
// If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
|
2236
2307
|
if ((menuOut && velocityX <= 0.3) || velocityX < -0.5) {
|
2237
|
-
|
2308
|
+
// Return menu to open
|
2309
|
+
if (leftPos !== 0) {
|
2238
2310
|
menu_id.velocity({'translateX': [0, leftPos]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
|
2239
2311
|
}
|
2240
2312
|
|
2241
|
-
// menu_id.css({'translateX': 0});
|
2242
2313
|
$('#sidenav-overlay').velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
|
2243
2314
|
dragTarget.css({width: '50%', right: 0, left: ''});
|
2315
|
+
menuOut = true;
|
2244
2316
|
}
|
2245
2317
|
else if (!menuOut || velocityX > 0.3) {
|
2246
2318
|
// Enable Scrolling
|
@@ -2259,9 +2331,14 @@ $(document).ready(function(){
|
|
2259
2331
|
}
|
2260
2332
|
else {
|
2261
2333
|
if ((menuOut && velocityX >= -0.3) || velocityX > 0.5) {
|
2262
|
-
|
2334
|
+
// Return menu to open
|
2335
|
+
if (rightPos !== 0) {
|
2336
|
+
menu_id.velocity({'translateX': [0, rightPos]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
|
2337
|
+
}
|
2338
|
+
|
2263
2339
|
$('#sidenav-overlay').velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
|
2264
2340
|
dragTarget.css({width: '50%', right: '', left: 0});
|
2341
|
+
menuOut = true;
|
2265
2342
|
}
|
2266
2343
|
else if (!menuOut || velocityX < -0.3) {
|
2267
2344
|
// Enable Scrolling
|
@@ -2528,6 +2605,12 @@ $(document).ready(function(){
|
|
2528
2605
|
* @returns {jQuery}
|
2529
2606
|
*/
|
2530
2607
|
$.scrollSpy = function(selector, options) {
|
2608
|
+
var defaults = {
|
2609
|
+
throttle: 100,
|
2610
|
+
scrollOffset: 200 // offset - 200 allows elements near bottom of page to scroll
|
2611
|
+
};
|
2612
|
+
options = $.extend(defaults, options);
|
2613
|
+
|
2531
2614
|
var visible = [];
|
2532
2615
|
selector = $(selector);
|
2533
2616
|
selector.each(function(i, element) {
|
@@ -2537,16 +2620,9 @@ $(document).ready(function(){
|
|
2537
2620
|
$('a[href="#' + $(element).attr('id') + '"]').click(function(e) {
|
2538
2621
|
e.preventDefault();
|
2539
2622
|
var offset = $(this.hash).offset().top + 1;
|
2540
|
-
|
2541
|
-
// offset - 200 allows elements near bottom of page to scroll
|
2542
|
-
|
2543
|
-
$('html, body').animate({ scrollTop: offset - 200 }, {duration: 400, queue: false, easing: 'easeOutCubic'});
|
2544
|
-
|
2623
|
+
$('html, body').animate({ scrollTop: offset - options.scrollOffset }, {duration: 400, queue: false, easing: 'easeOutCubic'});
|
2545
2624
|
});
|
2546
2625
|
});
|
2547
|
-
options = options || {
|
2548
|
-
throttle: 100
|
2549
|
-
};
|
2550
2626
|
|
2551
2627
|
offset.top = options.offsetTop || 0;
|
2552
2628
|
offset.right = options.offsetRight || 0;
|
@@ -2648,10 +2724,10 @@ $(document).ready(function(){
|
|
2648
2724
|
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';
|
2649
2725
|
$(input_selector).each(function(index, element) {
|
2650
2726
|
if ($(element).val().length > 0 || element.autofocus ||$(this).attr('placeholder') !== undefined || $(element)[0].validity.badInput === true) {
|
2651
|
-
$(this).siblings('label
|
2727
|
+
$(this).siblings('label').addClass('active');
|
2652
2728
|
}
|
2653
2729
|
else {
|
2654
|
-
$(this).siblings('label
|
2730
|
+
$(this).siblings('label').removeClass('active');
|
2655
2731
|
}
|
2656
2732
|
});
|
2657
2733
|
};
|
@@ -2679,7 +2755,7 @@ $(document).ready(function(){
|
|
2679
2755
|
formReset.find(input_selector).removeClass('valid').removeClass('invalid');
|
2680
2756
|
formReset.find(input_selector).each(function () {
|
2681
2757
|
if ($(this).attr('value') === '') {
|
2682
|
-
$(this).siblings('label
|
2758
|
+
$(this).siblings('label').removeClass('active');
|
2683
2759
|
}
|
2684
2760
|
});
|
2685
2761
|
|
@@ -2693,18 +2769,19 @@ $(document).ready(function(){
|
|
2693
2769
|
|
2694
2770
|
// Add active when element has focus
|
2695
2771
|
$(document).on('focus', input_selector, function () {
|
2696
|
-
$(this).siblings('label,
|
2772
|
+
$(this).siblings('label, .prefix').addClass('active');
|
2697
2773
|
});
|
2698
2774
|
|
2699
2775
|
$(document).on('blur', input_selector, function () {
|
2700
2776
|
var $inputElement = $(this);
|
2777
|
+
var selector = ".prefix";
|
2778
|
+
|
2701
2779
|
if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
|
2702
|
-
|
2780
|
+
selector += ", label";
|
2703
2781
|
}
|
2704
2782
|
|
2705
|
-
|
2706
|
-
|
2707
|
-
}
|
2783
|
+
$inputElement.siblings(selector).removeClass('active');
|
2784
|
+
|
2708
2785
|
validate_field($inputElement);
|
2709
2786
|
});
|
2710
2787
|
|
@@ -2742,7 +2819,7 @@ $(document).ready(function(){
|
|
2742
2819
|
$(this).addClass('tabbed');
|
2743
2820
|
var $this = $(this);
|
2744
2821
|
$this.one('blur', function(e) {
|
2745
|
-
|
2822
|
+
|
2746
2823
|
$(this).removeClass('tabbed');
|
2747
2824
|
});
|
2748
2825
|
return;
|
@@ -2762,9 +2839,11 @@ $(document).ready(function(){
|
|
2762
2839
|
|
2763
2840
|
var fontFamily = $textarea.css('font-family');
|
2764
2841
|
var fontSize = $textarea.css('font-size');
|
2842
|
+
var lineHeight = $textarea.css('line-height');
|
2765
2843
|
|
2766
2844
|
if (fontSize) { hiddenDiv.css('font-size', fontSize); }
|
2767
2845
|
if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
|
2846
|
+
if (lineHeight) { hiddenDiv.css('line-height', lineHeight); }
|
2768
2847
|
|
2769
2848
|
if ($textarea.attr('wrap') === "off") {
|
2770
2849
|
hiddenDiv.css('overflow-wrap', "normal")
|
@@ -2913,6 +2992,88 @@ $(document).ready(function(){
|
|
2913
2992
|
thumb.removeClass('active');
|
2914
2993
|
}
|
2915
2994
|
});
|
2995
|
+
|
2996
|
+
/**************************
|
2997
|
+
* Auto complete plugin *
|
2998
|
+
*************************/
|
2999
|
+
$.fn.autocomplete = function (options) {
|
3000
|
+
// Defaults
|
3001
|
+
var defaults = {
|
3002
|
+
data: {}
|
3003
|
+
};
|
3004
|
+
|
3005
|
+
options = $.extend(defaults, options);
|
3006
|
+
|
3007
|
+
return this.each(function() {
|
3008
|
+
var $input = $(this);
|
3009
|
+
var data = options.data,
|
3010
|
+
$inputDiv = $input.closest('.input-field'); // Div to append on
|
3011
|
+
|
3012
|
+
// Check if data isn't empty
|
3013
|
+
if (!$.isEmptyObject(data)) {
|
3014
|
+
// Create autocomplete element
|
3015
|
+
var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
|
3016
|
+
|
3017
|
+
// Append autocomplete element
|
3018
|
+
if ($inputDiv.length) {
|
3019
|
+
$inputDiv.append($autocomplete); // Set ul in body
|
3020
|
+
} else {
|
3021
|
+
$input.after($autocomplete);
|
3022
|
+
}
|
3023
|
+
|
3024
|
+
var highlight = function(string, $el) {
|
3025
|
+
var img = $el.find('img');
|
3026
|
+
var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
|
3027
|
+
matchEnd = matchStart + string.length - 1,
|
3028
|
+
beforeMatch = $el.text().slice(0, matchStart),
|
3029
|
+
matchText = $el.text().slice(matchStart, matchEnd + 1),
|
3030
|
+
afterMatch = $el.text().slice(matchEnd + 1);
|
3031
|
+
$el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
|
3032
|
+
if (img.length) {
|
3033
|
+
$el.prepend(img);
|
3034
|
+
}
|
3035
|
+
};
|
3036
|
+
|
3037
|
+
// Perform search
|
3038
|
+
$input.on('keyup', function (e) {
|
3039
|
+
// Capture Enter
|
3040
|
+
if (e.which === 13) {
|
3041
|
+
$autocomplete.find('li').first().click();
|
3042
|
+
return;
|
3043
|
+
}
|
3044
|
+
|
3045
|
+
var val = $input.val().toLowerCase();
|
3046
|
+
$autocomplete.empty();
|
3047
|
+
|
3048
|
+
// Check if the input isn't empty
|
3049
|
+
if (val !== '') {
|
3050
|
+
for(var key in data) {
|
3051
|
+
if (data.hasOwnProperty(key) &&
|
3052
|
+
key.toLowerCase().indexOf(val) !== -1 &&
|
3053
|
+
key.toLowerCase() !== val) {
|
3054
|
+
var autocompleteOption = $('<li></li>');
|
3055
|
+
if(!!data[key]) {
|
3056
|
+
autocompleteOption.append('<img src="'+ data[key] +'" class="right circle"><span>'+ key +'</span>');
|
3057
|
+
} else {
|
3058
|
+
autocompleteOption.append('<span>'+ key +'</span>');
|
3059
|
+
}
|
3060
|
+
$autocomplete.append(autocompleteOption);
|
3061
|
+
|
3062
|
+
highlight(val, autocompleteOption);
|
3063
|
+
}
|
3064
|
+
}
|
3065
|
+
}
|
3066
|
+
});
|
3067
|
+
|
3068
|
+
// Set input value
|
3069
|
+
$autocomplete.on('click', 'li', function () {
|
3070
|
+
$input.val($(this).text().trim());
|
3071
|
+
$autocomplete.empty();
|
3072
|
+
});
|
3073
|
+
}
|
3074
|
+
});
|
3075
|
+
};
|
3076
|
+
|
2916
3077
|
}); // End of $(document).ready
|
2917
3078
|
|
2918
3079
|
/*******************
|
@@ -3255,7 +3416,7 @@ $(document).ready(function(){
|
|
3255
3416
|
// which slide is active and its associated content
|
3256
3417
|
var $this = $(this);
|
3257
3418
|
var $slider = $this.find('ul.slides').first();
|
3258
|
-
var $slides = $slider.find('li');
|
3419
|
+
var $slides = $slider.find('> li');
|
3259
3420
|
var $active_index = $slider.find('.active').index();
|
3260
3421
|
var $active, $indicators, $interval;
|
3261
3422
|
if ($active_index != -1) { $active = $slides.eq($active_index); }
|
@@ -3579,30 +3740,298 @@ $(document).ready(function(){
|
|
3579
3740
|
$(this).find('.card-reveal').css({ display: 'block'}).velocity("stop", false).velocity({translateY: '-100%'}, {duration: 300, queue: false, easing: 'easeInOutQuad'});
|
3580
3741
|
}
|
3581
3742
|
}
|
3582
|
-
|
3583
|
-
$('.card-reveal').closest('.card').css('overflow', 'hidden');
|
3584
|
-
|
3585
3743
|
});
|
3586
3744
|
|
3587
3745
|
});
|
3588
3746
|
}( jQuery ));;(function ($) {
|
3589
|
-
|
3747
|
+
var chipsHandleEvents = false;
|
3748
|
+
var materialChipsDefaults = {
|
3749
|
+
data: [],
|
3750
|
+
placeholder: '',
|
3751
|
+
secondaryPlaceholder: '',
|
3752
|
+
};
|
3590
3753
|
|
3591
|
-
|
3592
|
-
|
3754
|
+
$(document).ready(function(){
|
3755
|
+
// Handle removal of static chips.
|
3756
|
+
$(document).on('click', '.chip .close', function(e){
|
3757
|
+
var $chips = $(this).closest('.chips');
|
3758
|
+
if ($chips.data('initialized')) {
|
3759
|
+
return;
|
3760
|
+
}
|
3761
|
+
$(this).closest('.chip').remove();
|
3593
3762
|
});
|
3594
|
-
|
3595
3763
|
});
|
3764
|
+
|
3765
|
+
$.fn.material_chip = function (options) {
|
3766
|
+
var self = this;
|
3767
|
+
this.$el = $(this);
|
3768
|
+
this.$document = $(document);
|
3769
|
+
this.SELS = {
|
3770
|
+
CHIPS: '.chips',
|
3771
|
+
CHIP: '.chip',
|
3772
|
+
INPUT: 'input',
|
3773
|
+
DELETE: '.material-icons',
|
3774
|
+
SELECTED_CHIP: '.selected',
|
3775
|
+
};
|
3776
|
+
|
3777
|
+
if ('data' === options) {
|
3778
|
+
return this.$el.data('chips');
|
3779
|
+
}
|
3780
|
+
|
3781
|
+
if ('options' === options) {
|
3782
|
+
return this.$el.data('options');
|
3783
|
+
}
|
3784
|
+
|
3785
|
+
this.$el.data('options', $.extend({}, materialChipsDefaults, options));
|
3786
|
+
|
3787
|
+
// Initialize
|
3788
|
+
this.init = function() {
|
3789
|
+
var i = 0;
|
3790
|
+
var chips;
|
3791
|
+
self.$el.each(function(){
|
3792
|
+
var $chips = $(this);
|
3793
|
+
if ($chips.data('initialized')) {
|
3794
|
+
// Prevent double initialization.
|
3795
|
+
return;
|
3796
|
+
}
|
3797
|
+
var options = $chips.data('options');
|
3798
|
+
if (!options.data || !options.data instanceof Array) {
|
3799
|
+
options.data = [];
|
3800
|
+
}
|
3801
|
+
$chips.data('chips', options.data);
|
3802
|
+
$chips.data('index', i);
|
3803
|
+
$chips.data('initialized', true);
|
3804
|
+
|
3805
|
+
if (!$chips.hasClass(self.SELS.CHIPS)) {
|
3806
|
+
$chips.addClass('chips');
|
3807
|
+
}
|
3808
|
+
|
3809
|
+
self.chips($chips);
|
3810
|
+
i++;
|
3811
|
+
});
|
3812
|
+
};
|
3813
|
+
|
3814
|
+
this.handleEvents = function(){
|
3815
|
+
var SELS = self.SELS;
|
3816
|
+
|
3817
|
+
self.$document.on('click', SELS.CHIPS, function(e){
|
3818
|
+
$(e.target).find(SELS.INPUT).focus();
|
3819
|
+
});
|
3820
|
+
|
3821
|
+
self.$document.on('click', SELS.CHIP, function(e){
|
3822
|
+
$(SELS.CHIP).removeClass('selected');
|
3823
|
+
$(this).toggleClass('selected');
|
3824
|
+
});
|
3825
|
+
|
3826
|
+
self.$document.on('keydown', function(e){
|
3827
|
+
if ($(e.target).is('input, textarea')) {
|
3828
|
+
return;
|
3829
|
+
}
|
3830
|
+
|
3831
|
+
// delete
|
3832
|
+
var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
|
3833
|
+
var $chips = $chip.closest(SELS.CHIPS);
|
3834
|
+
var length = $chip.siblings(SELS.CHIP).length;
|
3835
|
+
var index;
|
3836
|
+
|
3837
|
+
if (!$chip.length) {
|
3838
|
+
return;
|
3839
|
+
}
|
3840
|
+
|
3841
|
+
if (e.which === 8 || e.which === 46) {
|
3842
|
+
e.preventDefault();
|
3843
|
+
var chipsIndex = $chips.data('index');
|
3844
|
+
|
3845
|
+
index = $chip.index();
|
3846
|
+
self.deleteChip(chipsIndex, index, $chips);
|
3847
|
+
|
3848
|
+
var selectIndex = null;
|
3849
|
+
if ((index + 1) < length) {
|
3850
|
+
selectIndex = index;
|
3851
|
+
} else if (index === length || (index + 1) === length) {
|
3852
|
+
selectIndex = length - 1;
|
3853
|
+
}
|
3854
|
+
|
3855
|
+
if (selectIndex < 0) selectIndex = null;
|
3856
|
+
|
3857
|
+
if (null !== selectIndex) {
|
3858
|
+
self.selectChip(chipsIndex, selectIndex, $chips);
|
3859
|
+
}
|
3860
|
+
if (!length) $chips.find('input').focus();
|
3861
|
+
|
3862
|
+
// left
|
3863
|
+
} else if (e.which === 37) {
|
3864
|
+
index = $chip.index() - 1;
|
3865
|
+
if (index < 0) {
|
3866
|
+
return;
|
3867
|
+
}
|
3868
|
+
$(SELS.CHIP).removeClass('selected');
|
3869
|
+
self.selectChip($chips.data('index'), index, $chips);
|
3870
|
+
|
3871
|
+
// right
|
3872
|
+
} else if (e.which === 39) {
|
3873
|
+
index = $chip.index() + 1;
|
3874
|
+
$(SELS.CHIP).removeClass('selected');
|
3875
|
+
if (index > length) {
|
3876
|
+
$chips.find('input').focus();
|
3877
|
+
return;
|
3878
|
+
}
|
3879
|
+
self.selectChip($chips.data('index'), index, $chips);
|
3880
|
+
}
|
3881
|
+
});
|
3882
|
+
|
3883
|
+
self.$document.on('focusin', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
|
3884
|
+
$(e.target).closest(SELS.CHIPS).addClass('focus');
|
3885
|
+
$(SELS.CHIP).removeClass('selected');
|
3886
|
+
});
|
3887
|
+
|
3888
|
+
self.$document.on('focusout', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
|
3889
|
+
$(e.target).closest(SELS.CHIPS).removeClass('focus');
|
3890
|
+
});
|
3891
|
+
|
3892
|
+
self.$document.on('keydown', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
|
3893
|
+
var $target = $(e.target);
|
3894
|
+
var $chips = $target.closest(SELS.CHIPS);
|
3895
|
+
var chipsIndex = $chips.data('index');
|
3896
|
+
var chipsLength = $chips.children(SELS.CHIP).length;
|
3897
|
+
|
3898
|
+
// enter
|
3899
|
+
if (13 === e.which) {
|
3900
|
+
e.preventDefault();
|
3901
|
+
self.addChip(chipsIndex, {tag: $target.val()}, $chips);
|
3902
|
+
$target.val('');
|
3903
|
+
return;
|
3904
|
+
}
|
3905
|
+
|
3906
|
+
// delete or left
|
3907
|
+
if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
|
3908
|
+
self.selectChip(chipsIndex, chipsLength - 1, $chips);
|
3909
|
+
$target.blur();
|
3910
|
+
return;
|
3911
|
+
}
|
3912
|
+
});
|
3913
|
+
|
3914
|
+
self.$document.on('click', SELS.CHIPS + ' ' + SELS.DELETE, function(e) {
|
3915
|
+
var $target = $(e.target);
|
3916
|
+
var $chips = $target.closest(SELS.CHIPS);
|
3917
|
+
var $chip = $target.closest(SELS.CHIP);
|
3918
|
+
e.stopPropagation();
|
3919
|
+
self.deleteChip(
|
3920
|
+
$chips.data('index'),
|
3921
|
+
$chip.index(),
|
3922
|
+
$chips
|
3923
|
+
);
|
3924
|
+
$chips.find('input').focus();
|
3925
|
+
});
|
3926
|
+
};
|
3927
|
+
|
3928
|
+
this.chips = function($chips) {
|
3929
|
+
var html = '';
|
3930
|
+
var options = $chips.data('options');
|
3931
|
+
$chips.data('chips').forEach(function(elem){
|
3932
|
+
html += self.renderChip(elem);
|
3933
|
+
});
|
3934
|
+
html += '<input class="input" placeholder="">';
|
3935
|
+
$chips.html(html);
|
3936
|
+
self.setPlaceholder($chips);
|
3937
|
+
};
|
3938
|
+
|
3939
|
+
this.renderChip = function(elem) {
|
3940
|
+
if (!elem.tag) return;
|
3941
|
+
|
3942
|
+
var html = '<div class="chip">' + elem.tag;
|
3943
|
+
if (elem.image) {
|
3944
|
+
html += ' <img src="' + elem.image + '"> ';
|
3945
|
+
}
|
3946
|
+
html += '<i class="material-icons close">close</i>';
|
3947
|
+
html += '</div>';
|
3948
|
+
return html;
|
3949
|
+
};
|
3950
|
+
|
3951
|
+
this.setPlaceholder = function($chips) {
|
3952
|
+
var options = $chips.data('options');
|
3953
|
+
if ($chips.data('chips').length && options.placeholder) {
|
3954
|
+
$chips.find('input').prop('placeholder', options.placeholder);
|
3955
|
+
} else if (!$chips.data('chips').length && options.secondaryPlaceholder) {
|
3956
|
+
$chips.find('input').prop('placeholder', options.secondaryPlaceholder);
|
3957
|
+
}
|
3958
|
+
};
|
3959
|
+
|
3960
|
+
this.isValid = function($chips, elem) {
|
3961
|
+
var chips = $chips.data('chips');
|
3962
|
+
var exists = false;
|
3963
|
+
for (var i=0; i < chips.length; i++) {
|
3964
|
+
if (chips[i].tag === elem.tag) {
|
3965
|
+
exists = true;
|
3966
|
+
return;
|
3967
|
+
}
|
3968
|
+
}
|
3969
|
+
return '' !== elem.tag && !exists;
|
3970
|
+
};
|
3971
|
+
|
3972
|
+
this.addChip = function(chipsIndex, elem, $chips) {
|
3973
|
+
if (!self.isValid($chips, elem)) {
|
3974
|
+
return;
|
3975
|
+
}
|
3976
|
+
var options = $chips.data('options');
|
3977
|
+
var chipHtml = self.renderChip(elem);
|
3978
|
+
$chips.data('chips').push(elem);
|
3979
|
+
$(chipHtml).insertBefore($chips.find('input'));
|
3980
|
+
$chips.trigger('chip.add', elem);
|
3981
|
+
self.setPlaceholder($chips);
|
3982
|
+
};
|
3983
|
+
|
3984
|
+
this.deleteChip = function(chipsIndex, chipIndex, $chips) {
|
3985
|
+
var chip = $chips.data('chips')[chipIndex];
|
3986
|
+
$chips.find('.chip').eq(chipIndex).remove();
|
3987
|
+
$chips.data('chips').splice(chipIndex, 1);
|
3988
|
+
$chips.trigger('chip.delete', chip);
|
3989
|
+
self.setPlaceholder($chips);
|
3990
|
+
};
|
3991
|
+
|
3992
|
+
this.selectChip = function(chipsIndex, chipIndex, $chips) {
|
3993
|
+
var $chip = $chips.find('.chip').eq(chipIndex);
|
3994
|
+
if ($chip && false === $chip.hasClass('selected')) {
|
3995
|
+
$chip.addClass('selected');
|
3996
|
+
$chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
|
3997
|
+
}
|
3998
|
+
};
|
3999
|
+
|
4000
|
+
this.getChipsElement = function(index, $chips) {
|
4001
|
+
return $chips.eq(index);
|
4002
|
+
};
|
4003
|
+
|
4004
|
+
// init
|
4005
|
+
this.init();
|
4006
|
+
|
4007
|
+
if (!chipsHandleEvents) {
|
4008
|
+
this.handleEvents();
|
4009
|
+
chipsHandleEvents = true;
|
4010
|
+
}
|
4011
|
+
};
|
3596
4012
|
}( jQuery ));;(function ($) {
|
3597
4013
|
$.fn.pushpin = function (options) {
|
3598
|
-
|
4014
|
+
// Defaults
|
3599
4015
|
var defaults = {
|
3600
4016
|
top: 0,
|
3601
4017
|
bottom: Infinity,
|
3602
4018
|
offset: 0
|
3603
4019
|
};
|
4020
|
+
|
4021
|
+
// Remove pushpin event and classes
|
4022
|
+
if (options === "remove") {
|
4023
|
+
this.each(function () {
|
4024
|
+
if (id = $(this).data('pushpin-id')) {
|
4025
|
+
$(window).off('scroll.' + id);
|
4026
|
+
$(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
|
4027
|
+
}
|
4028
|
+
});
|
4029
|
+
return false;
|
4030
|
+
}
|
4031
|
+
|
3604
4032
|
options = $.extend(defaults, options);
|
3605
4033
|
|
4034
|
+
|
3606
4035
|
$index = 0;
|
3607
4036
|
return this.each(function() {
|
3608
4037
|
var $uniqueId = Materialize.guid(),
|
@@ -3640,6 +4069,7 @@ $(document).ready(function(){
|
|
3640
4069
|
});
|
3641
4070
|
}
|
3642
4071
|
|
4072
|
+
$(this).data('pushpin-id', $uniqueId);
|
3643
4073
|
updateElements($this, $(window).scrollTop());
|
3644
4074
|
$(window).on('scroll.' + $uniqueId, function () {
|
3645
4075
|
var $scrolled = $(window).scrollTop() + options.offset;
|
@@ -3742,8 +4172,15 @@ $(document).ready(function(){
|
|
3742
4172
|
}( jQuery ));
|
3743
4173
|
;(function ($) {
|
3744
4174
|
// Image transition function
|
3745
|
-
Materialize.fadeInImage = function(
|
3746
|
-
var element
|
4175
|
+
Materialize.fadeInImage = function(selectorOrEl) {
|
4176
|
+
var element;
|
4177
|
+
if (typeof(selectorOrEl) === 'string') {
|
4178
|
+
element = $(selectorOrEl);
|
4179
|
+
} else if (typeof(selectorOrEl) === 'object') {
|
4180
|
+
element = selectorOrEl;
|
4181
|
+
} else {
|
4182
|
+
return;
|
4183
|
+
}
|
3747
4184
|
element.css({opacity: 0});
|
3748
4185
|
$(element).velocity({opacity: 1}, {
|
3749
4186
|
duration: 650,
|
@@ -3773,13 +4210,21 @@ $(document).ready(function(){
|
|
3773
4210
|
};
|
3774
4211
|
|
3775
4212
|
// Horizontal staggered list
|
3776
|
-
Materialize.showStaggeredList = function(
|
4213
|
+
Materialize.showStaggeredList = function(selectorOrEl) {
|
4214
|
+
var element;
|
4215
|
+
if (typeof(selectorOrEl) === 'string') {
|
4216
|
+
element = $(selectorOrEl);
|
4217
|
+
} else if (typeof(selectorOrEl) === 'object') {
|
4218
|
+
element = selectorOrEl;
|
4219
|
+
} else {
|
4220
|
+
return;
|
4221
|
+
}
|
3777
4222
|
var time = 0;
|
3778
|
-
|
4223
|
+
element.find('li').velocity(
|
3779
4224
|
{ translateX: "-100px"},
|
3780
4225
|
{ duration: 0 });
|
3781
4226
|
|
3782
|
-
|
4227
|
+
element.find('li').each(function() {
|
3783
4228
|
$(this).velocity(
|
3784
4229
|
{ opacity: "1", translateX: "0"},
|
3785
4230
|
{ duration: 800, delay: time, easing: [60, 10] });
|
@@ -3927,10 +4372,10 @@ $(document).ready(function(){
|
|
3927
4372
|
if (windowScroll > (elementOffset + offset)) {
|
3928
4373
|
if (value.done !== true) {
|
3929
4374
|
if (typeof(callback) === 'function') {
|
3930
|
-
callback.call(this);
|
4375
|
+
callback.call(this, currentElement);
|
3931
4376
|
} else if (typeof(callback) === 'string') {
|
3932
4377
|
var callbackFunc = new Function(callback);
|
3933
|
-
callbackFunc();
|
4378
|
+
callbackFunc(currentElement);
|
3934
4379
|
}
|
3935
4380
|
value.done = true;
|
3936
4381
|
}
|
@@ -6577,7 +7022,9 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6577
7022
|
dist: -100, // zoom scale TODO: make this more intuitive as an option
|
6578
7023
|
shift: 0, // spacing for center image
|
6579
7024
|
padding: 0, // Padding between non center items
|
6580
|
-
full_width: false // Change to full width styles
|
7025
|
+
full_width: false, // Change to full width styles
|
7026
|
+
indicators: false, // Toggle indicators
|
7027
|
+
no_wrap: false // Don't wrap around and cycle through items.
|
6581
7028
|
};
|
6582
7029
|
options = $.extend(defaults, options);
|
6583
7030
|
|
@@ -6586,22 +7033,41 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6586
7033
|
var images, offset, center, pressed, dim, count,
|
6587
7034
|
reference, referenceY, amplitude, target, velocity,
|
6588
7035
|
xform, frame, timestamp, ticker, dragged, vertical_dragged;
|
7036
|
+
var $indicators = $('<ul class="indicators"></ul>');
|
7037
|
+
|
6589
7038
|
|
6590
7039
|
// Initialize
|
6591
7040
|
var view = $(this);
|
7041
|
+
var showIndicators = view.attr('data-indicators') || options.indicators;
|
7042
|
+
|
6592
7043
|
// Don't double initialize.
|
6593
7044
|
if (view.hasClass('initialized')) {
|
7045
|
+
// Redraw carousel.
|
7046
|
+
$(this).trigger('carouselNext', [0.000001]);
|
6594
7047
|
return true;
|
6595
7048
|
}
|
6596
7049
|
|
7050
|
+
|
6597
7051
|
// Options
|
6598
7052
|
if (options.full_width) {
|
6599
7053
|
options.dist = 0;
|
6600
|
-
|
6601
|
-
|
6602
|
-
|
7054
|
+
var firstImage = view.find('.carousel-item img').first();
|
7055
|
+
if (firstImage.length) {
|
7056
|
+
imageHeight = firstImage.load(function(){
|
7057
|
+
view.css('height', $(this).height());
|
7058
|
+
});
|
7059
|
+
} else {
|
7060
|
+
imageHeight = view.find('.carousel-item').first().height();
|
7061
|
+
view.css('height', imageHeight);
|
7062
|
+
}
|
7063
|
+
|
7064
|
+
// Offset fixed items when indicators.
|
7065
|
+
if (showIndicators) {
|
7066
|
+
view.find('.carousel-fixed-item').addClass('with-indicators');
|
7067
|
+
}
|
6603
7068
|
}
|
6604
7069
|
|
7070
|
+
|
6605
7071
|
view.addClass('initialized');
|
6606
7072
|
pressed = false;
|
6607
7073
|
offset = target = 0;
|
@@ -6609,10 +7075,28 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6609
7075
|
item_width = view.find('.carousel-item').first().innerWidth();
|
6610
7076
|
dim = item_width * 2 + options.padding;
|
6611
7077
|
|
6612
|
-
view.find('.carousel-item').each(function () {
|
7078
|
+
view.find('.carousel-item').each(function (i) {
|
6613
7079
|
images.push($(this)[0]);
|
7080
|
+
if (showIndicators) {
|
7081
|
+
var $indicator = $('<li class="indicator-item"></li>');
|
7082
|
+
|
7083
|
+
// Add active to first by default.
|
7084
|
+
if (i === 0) {
|
7085
|
+
$indicator.addClass('active');
|
7086
|
+
}
|
7087
|
+
|
7088
|
+
// Handle clicks on indicators.
|
7089
|
+
$indicator.click(function () {
|
7090
|
+
var index = $(this).index();
|
7091
|
+
cycleTo(index);
|
7092
|
+
});
|
7093
|
+
$indicators.append($indicator);
|
7094
|
+
}
|
6614
7095
|
});
|
6615
7096
|
|
7097
|
+
if (showIndicators) {
|
7098
|
+
view.append($indicators);
|
7099
|
+
}
|
6616
7100
|
count = images.length;
|
6617
7101
|
|
6618
7102
|
|
@@ -6625,6 +7109,7 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6625
7109
|
view[0].addEventListener('mousedown', tap);
|
6626
7110
|
view[0].addEventListener('mousemove', drag);
|
6627
7111
|
view[0].addEventListener('mouseup', release);
|
7112
|
+
view[0].addEventListener('mouseleave', release);
|
6628
7113
|
view[0].addEventListener('click', click);
|
6629
7114
|
}
|
6630
7115
|
|
@@ -6660,6 +7145,7 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6660
7145
|
delta = offset - center * dim;
|
6661
7146
|
dir = (delta < 0) ? 1 : -1;
|
6662
7147
|
tween = -dir * delta * 2 / dim;
|
7148
|
+
half = count >> 1;
|
6663
7149
|
|
6664
7150
|
if (!options.full_width) {
|
6665
7151
|
alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
|
@@ -6668,17 +7154,30 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6668
7154
|
alignment = 'translateX(0)';
|
6669
7155
|
}
|
6670
7156
|
|
7157
|
+
// Set indicator active
|
7158
|
+
if (showIndicators) {
|
7159
|
+
var diff = (center % count);
|
7160
|
+
var activeIndicator = $indicators.find('.indicator-item.active');
|
7161
|
+
if (activeIndicator.index() !== diff) {
|
7162
|
+
activeIndicator.removeClass('active');
|
7163
|
+
$indicators.find('.indicator-item').eq(diff).addClass('active');
|
7164
|
+
}
|
7165
|
+
}
|
7166
|
+
|
6671
7167
|
// center
|
6672
|
-
|
6673
|
-
|
6674
|
-
|
6675
|
-
|
6676
|
-
|
6677
|
-
|
6678
|
-
|
6679
|
-
|
6680
|
-
|
6681
|
-
|
7168
|
+
// Don't show wrapped items.
|
7169
|
+
if (!options.no_wrap || (center >= 0 && center < count)) {
|
7170
|
+
el = images[wrap(center)];
|
7171
|
+
el.style[xform] = alignment +
|
7172
|
+
' translateX(' + (-delta / 2) + 'px)' +
|
7173
|
+
' translateX(' + (dir * options.shift * tween * i) + 'px)' +
|
7174
|
+
' translateZ(' + (options.dist * tween) + 'px)';
|
7175
|
+
el.style.zIndex = 0;
|
7176
|
+
if (options.full_width) { tweenedOpacity = 1; }
|
7177
|
+
else { tweenedOpacity = 1 - 0.2 * tween; }
|
7178
|
+
el.style.opacity = tweenedOpacity;
|
7179
|
+
el.style.display = 'block';
|
7180
|
+
}
|
6682
7181
|
|
6683
7182
|
for (i = 1; i <= half; ++i) {
|
6684
7183
|
// right side
|
@@ -6689,12 +7188,16 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6689
7188
|
zTranslation = options.dist * (i * 2 + tween * dir);
|
6690
7189
|
tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
|
6691
7190
|
}
|
6692
|
-
|
6693
|
-
|
6694
|
-
|
6695
|
-
|
6696
|
-
|
6697
|
-
|
7191
|
+
// Don't show wrapped items.
|
7192
|
+
if (!options.no_wrap || center + i < count) {
|
7193
|
+
el = images[wrap(center + i)];
|
7194
|
+
el.style[xform] = alignment +
|
7195
|
+
' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' +
|
7196
|
+
' translateZ(' + zTranslation + 'px)';
|
7197
|
+
el.style.zIndex = -i;
|
7198
|
+
el.style.opacity = tweenedOpacity;
|
7199
|
+
el.style.display = 'block';
|
7200
|
+
}
|
6698
7201
|
|
6699
7202
|
|
6700
7203
|
// left side
|
@@ -6705,24 +7208,32 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6705
7208
|
zTranslation = options.dist * (i * 2 - tween * dir);
|
6706
7209
|
tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
|
6707
7210
|
}
|
6708
|
-
|
6709
|
-
|
6710
|
-
|
6711
|
-
|
6712
|
-
|
6713
|
-
|
7211
|
+
// Don't show wrapped items.
|
7212
|
+
if (!options.no_wrap || center - i >= 0) {
|
7213
|
+
el = images[wrap(center - i)];
|
7214
|
+
el.style[xform] = alignment +
|
7215
|
+
' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' +
|
7216
|
+
' translateZ(' + zTranslation + 'px)';
|
7217
|
+
el.style.zIndex = -i;
|
7218
|
+
el.style.opacity = tweenedOpacity;
|
7219
|
+
el.style.display = 'block';
|
7220
|
+
}
|
6714
7221
|
}
|
6715
7222
|
|
6716
7223
|
// center
|
6717
|
-
|
6718
|
-
|
6719
|
-
|
6720
|
-
|
6721
|
-
|
6722
|
-
|
6723
|
-
|
6724
|
-
|
6725
|
-
|
7224
|
+
// Don't show wrapped items.
|
7225
|
+
if (!options.no_wrap || (center >= 0 && center < count)) {
|
7226
|
+
el = images[wrap(center)];
|
7227
|
+
el.style[xform] = alignment +
|
7228
|
+
' translateX(' + (-delta / 2) + 'px)' +
|
7229
|
+
' translateX(' + (dir * options.shift * tween) + 'px)' +
|
7230
|
+
' translateZ(' + (options.dist * tween) + 'px)';
|
7231
|
+
el.style.zIndex = 0;
|
7232
|
+
if (options.full_width) { tweenedOpacity = 1; }
|
7233
|
+
else { tweenedOpacity = 1 - 0.2 * tween; }
|
7234
|
+
el.style.opacity = tweenedOpacity;
|
7235
|
+
el.style.display = 'block';
|
7236
|
+
}
|
6726
7237
|
}
|
6727
7238
|
|
6728
7239
|
function track() {
|
@@ -6764,21 +7275,34 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6764
7275
|
var clickedIndex = $(e.target).closest('.carousel-item').index();
|
6765
7276
|
var diff = (center % count) - clickedIndex;
|
6766
7277
|
|
6767
|
-
//
|
7278
|
+
// Disable clicks if carousel was shifted by click
|
7279
|
+
if (diff !== 0) {
|
7280
|
+
e.preventDefault();
|
7281
|
+
e.stopPropagation();
|
7282
|
+
}
|
7283
|
+
cycleTo(clickedIndex);
|
7284
|
+
}
|
7285
|
+
}
|
7286
|
+
|
7287
|
+
function cycleTo(n) {
|
7288
|
+
var diff = (center % count) - n;
|
7289
|
+
|
7290
|
+
// Account for wraparound.
|
7291
|
+
if (!options.no_wrap) {
|
6768
7292
|
if (diff < 0) {
|
6769
7293
|
if (Math.abs(diff + count) < Math.abs(diff)) { diff += count; }
|
6770
7294
|
|
6771
7295
|
} else if (diff > 0) {
|
6772
7296
|
if (Math.abs(diff - count) < diff) { diff -= count; }
|
6773
7297
|
}
|
7298
|
+
}
|
6774
7299
|
|
6775
|
-
|
6776
|
-
|
6777
|
-
|
7300
|
+
// Call prev or next accordingly.
|
7301
|
+
if (diff < 0) {
|
7302
|
+
view.trigger('carouselNext', [Math.abs(diff)]);
|
6778
7303
|
|
6779
|
-
|
6780
|
-
|
6781
|
-
}
|
7304
|
+
} else if (diff > 0) {
|
7305
|
+
view.trigger('carouselPrev', [diff]);
|
6782
7306
|
}
|
6783
7307
|
}
|
6784
7308
|
|
@@ -6833,7 +7357,11 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6833
7357
|
}
|
6834
7358
|
|
6835
7359
|
function release(e) {
|
6836
|
-
pressed
|
7360
|
+
if (pressed) {
|
7361
|
+
pressed = false;
|
7362
|
+
} else {
|
7363
|
+
return;
|
7364
|
+
}
|
6837
7365
|
|
6838
7366
|
clearInterval(ticker);
|
6839
7367
|
target = offset;
|
@@ -6842,12 +7370,23 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6842
7370
|
target = offset + amplitude;
|
6843
7371
|
}
|
6844
7372
|
target = Math.round(target / dim) * dim;
|
7373
|
+
|
7374
|
+
// No wrap of items.
|
7375
|
+
if (options.no_wrap) {
|
7376
|
+
if (target >= dim * (count - 1)) {
|
7377
|
+
target = dim * (count - 1);
|
7378
|
+
} else if (target < 0) {
|
7379
|
+
target = 0;
|
7380
|
+
}
|
7381
|
+
}
|
6845
7382
|
amplitude = target - offset;
|
6846
7383
|
timestamp = Date.now();
|
6847
7384
|
requestAnimationFrame(autoScroll);
|
6848
7385
|
|
6849
|
-
|
6850
|
-
|
7386
|
+
if (dragged) {
|
7387
|
+
e.preventDefault();
|
7388
|
+
e.stopPropagation();
|
7389
|
+
}
|
6851
7390
|
return false;
|
6852
7391
|
}
|
6853
7392
|
|
@@ -6892,6 +7431,13 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6892
7431
|
}
|
6893
7432
|
});
|
6894
7433
|
|
7434
|
+
$(this).on('carouselSet', function(e, n) {
|
7435
|
+
if (n === undefined) {
|
7436
|
+
n = 0;
|
7437
|
+
}
|
7438
|
+
cycleTo(n);
|
7439
|
+
});
|
7440
|
+
|
6895
7441
|
});
|
6896
7442
|
|
6897
7443
|
|
@@ -6903,6 +7449,9 @@ Picker.extend( 'pickadate', DatePicker )
|
|
6903
7449
|
prev : function(n) {
|
6904
7450
|
$(this).trigger('carouselPrev', [n]);
|
6905
7451
|
},
|
7452
|
+
set : function(n) {
|
7453
|
+
$(this).trigger('carouselSet', [n]);
|
7454
|
+
}
|
6906
7455
|
};
|
6907
7456
|
|
6908
7457
|
|