Fix by @mikenovikov for #129

This commit is contained in:
FezVrasta 2014-10-18 15:45:04 +02:00
parent b29141d953
commit 2a6e82f4b4
5 changed files with 222 additions and 68 deletions

148
dist/css/material.css vendored
View File

@ -2241,6 +2241,20 @@
.mdi-toggle-radio-button-on:before { .mdi-toggle-radio-button-on:before {
content: "\e8e4"; content: "\e8e4";
} }
@-webkit-keyframes input-highlight {
0% {
left: 20%;
width: 20%;
}
99% {
width: 0;
left: 0;
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes input-highlight { @keyframes input-highlight {
0% { 0% {
left: 20%; left: 20%;
@ -2632,6 +2646,7 @@ body .jumbotron-material-lightgrey,
text-transform: uppercase; text-transform: uppercase;
text-decoration: none; text-decoration: none;
color: rgba(255, 255, 255, 0.84); color: rgba(255, 255, 255, 0.84);
-webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
outline: none !important; outline: none !important;
} }
@ -2741,6 +2756,7 @@ body .jumbotron-material-lightgrey,
} }
.btn.btn-raised { .btn.btn-raised {
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
-webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
} }
.btn.btn-raised:active:not(.btn-link) { .btn.btn-raised:active:not(.btn-link) {
@ -2955,6 +2971,7 @@ body .jumbotron-material-lightgrey,
border-radius: 2px; border-radius: 2px;
margin: 10px 1px; margin: 10px 1px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
-webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
} }
.btn-group:active:not(.btn-link), .btn-group:active:not(.btn-link),
@ -2968,6 +2985,7 @@ body .jumbotron-material-lightgrey,
.btn-group.btn-group-raised, .btn-group.btn-group-raised,
.btn-group-vertical.btn-group-raised { .btn-group-vertical.btn-group-raised {
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
-webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
} }
.btn-group.btn-group-raised:active:not(.btn-link), .btn-group.btn-group-raised:active:not(.btn-link),
@ -3002,6 +3020,7 @@ body .jumbotron-material-lightgrey,
display: block; display: block;
position: absolute; position: absolute;
left: 0px; left: 0px;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s; transition-duration: 0.2s;
} }
.checkbox label .check { .checkbox label .check {
@ -3032,6 +3051,8 @@ body .jumbotron-material-lightgrey,
.checkbox label .check:before { .checkbox label .check:before {
position: absolute; position: absolute;
content: ""; content: "";
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg); transform: rotate(45deg);
display: block; display: block;
margin-top: -4px; margin-top: -4px;
@ -3045,6 +3066,7 @@ body .jumbotron-material-lightgrey,
0 0 0 0, 0 0 0 0,
0 0 0 0, 0 0 0 0,
0px 0px 0 0px inset; 0px 0px 0 0px inset;
-webkit-animation: checkbox-off 0.3s linear forwards;
animation: checkbox-off 0.3s linear forwards; animation: checkbox-off 0.3s linear forwards;
} }
.checkbox input[type=checkbox] { .checkbox input[type=checkbox] {
@ -3055,16 +3077,20 @@ body .jumbotron-material-lightgrey,
} }
.checkbox input[type=checkbox]:checked ~ .check:before { .checkbox input[type=checkbox]:checked ~ .check:before {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px;
-webkit-animation: checkbox-on 0.3s linear forwards;
animation: checkbox-on 0.3s linear forwards; animation: checkbox-on 0.3s linear forwards;
} }
.checkbox input[type=checkbox]:not(:checked) ~ .check:after { .checkbox input[type=checkbox]:not(:checked) ~ .check:after {
-webkit-animation: rippleOff 500ms linear forwards;
animation: rippleOff 500ms linear forwards; animation: rippleOff 500ms linear forwards;
} }
.checkbox input[type=checkbox]:checked ~ .check:after { .checkbox input[type=checkbox]:checked ~ .check:after {
-webkit-animation: rippleOn 500ms linear forwards;
animation: rippleOn 500ms linear forwards; animation: rippleOn 500ms linear forwards;
} }
.checkbox:not(:hover) input[type=checkbox] ~ .check:before, .checkbox:not(:hover) input[type=checkbox] ~ .check:before,
.checkbox:not(:hover) input[type=checkbox] ~ .check:after { .checkbox:not(:hover) input[type=checkbox] ~ .check:after {
-webkit-animation-duration: 1ms;
animation-duration: 1ms; animation-duration: 1ms;
} }
.checkbox input[type=checkbox][disabled]:not(:checked) ~ .check:before { .checkbox input[type=checkbox][disabled]:not(:checked) ~ .check:before {
@ -3072,6 +3098,8 @@ body .jumbotron-material-lightgrey,
} }
.checkbox input[type=checkbox][disabled] ~ .check:after { .checkbox input[type=checkbox][disabled] ~ .check:after {
background-color: rgba(0, 0, 0, 0.84); background-color: rgba(0, 0, 0, 0.84);
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg); transform: rotate(-45deg);
} }
.checkbox input[type=checkbox]:checked ~ .check:after, .checkbox input[type=checkbox]:checked ~ .check:after,
@ -3284,6 +3312,17 @@ body .jumbotron-material-lightgrey,
.checkbox-material-lightgrey input[type=checkbox]:checked ~ .check { .checkbox-material-lightgrey input[type=checkbox]:checked ~ .check {
color: #ececec; color: #ececec;
} }
@-webkit-keyframes checkbox-on {
0% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px;
}
50% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px 2px 0 11px;
}
100% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px;
}
}
@keyframes checkbox-on { @keyframes checkbox-on {
0% { 0% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px; box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px;
@ -3295,7 +3334,7 @@ body .jumbotron-material-lightgrey,
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px;
} }
} }
@keyframes checkbox-off { @-webkit-keyframes checkbox-off {
0% { 0% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset;
} }
@ -3303,6 +3342,7 @@ body .jumbotron-material-lightgrey,
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset;
} }
50% { 50% {
-webkit-transform: rotate(45deg);
transform: rotate(45deg); transform: rotate(45deg);
margin-top: -4px; margin-top: -4px;
margin-left: 6px; margin-left: 6px;
@ -3311,6 +3351,7 @@ body .jumbotron-material-lightgrey,
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset; box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset;
} }
51% { 51% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg); transform: rotate(0deg);
margin-top: -2px; margin-top: -2px;
margin-left: -2px; margin-left: -2px;
@ -3325,6 +3366,54 @@ body .jumbotron-material-lightgrey,
0px 0px 0 10px inset; 0px 0px 0 10px inset;
} }
100% { 100% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
margin-top: -2px;
margin-left: -2px;
width: 20px;
height: 20px;
box-shadow: 0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0px 0px 0 0px inset;
}
}
@keyframes checkbox-off {
0% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset;
}
25% {
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset;
}
50% {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
margin-top: -4px;
margin-left: 6px;
width: 0px;
height: 0px;
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0px 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset;
}
51% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
margin-top: -2px;
margin-left: -2px;
width: 20px;
height: 20px;
box-shadow: 0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0px 0px 0 10px inset;
}
100% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg); transform: rotate(0deg);
margin-top: -2px; margin-top: -2px;
margin-left: -2px; margin-left: -2px;
@ -3352,6 +3441,7 @@ body .jumbotron-material-lightgrey,
position: absolute; position: absolute;
left: 10px; left: 10px;
top: 2px; top: 2px;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s; transition-duration: 0.2s;
} }
.radio label .circle { .radio label .circle {
@ -3365,6 +3455,8 @@ body .jumbotron-material-lightgrey,
width: 15px; width: 15px;
border-radius: 100%; border-radius: 100%;
background-color: rgba(0, 0, 0, 0.84); background-color: rgba(0, 0, 0, 0.84);
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0); transform: scale(0);
} }
.radio label .check:after { .radio label .check:after {
@ -3380,12 +3472,16 @@ body .jumbotron-material-lightgrey,
z-index: 1; z-index: 1;
opacity: 0; opacity: 0;
margin: 0; margin: 0;
-webkit-transform: scale(1.5);
-ms-transform: scale(1.5);
transform: scale(1.5); transform: scale(1.5);
} }
.radio label input[type=radio]:not(:checked) ~ .check:after { .radio label input[type=radio]:not(:checked) ~ .check:after {
-webkit-animation: rippleOff 500ms;
animation: rippleOff 500ms; animation: rippleOff 500ms;
} }
.radio label input[type=radio]:checked ~ .check:after { .radio label input[type=radio]:checked ~ .check:after {
-webkit-animation: rippleOn 500ms;
animation: rippleOn 500ms; animation: rippleOn 500ms;
} }
.radio input[type=radio]:checked ~ .check, .radio input[type=radio]:checked ~ .check,
@ -3536,6 +3632,8 @@ body .jumbotron-material-lightgrey,
display: none; display: none;
} }
.radio input[type=radio]:checked ~ .check { .radio input[type=radio]:checked ~ .check {
-webkit-transform: scale(0.55);
-ms-transform: scale(0.55);
transform: scale(0.55); transform: scale(0.55);
} }
.radio input[type=radio][disabled] ~ .circle { .radio input[type=radio][disabled] ~ .circle {
@ -3544,6 +3642,17 @@ body .jumbotron-material-lightgrey,
.radio input[type=radio][disabled] ~ .check { .radio input[type=radio][disabled] ~ .check {
background-color: rgba(0, 0, 0, 0.84); background-color: rgba(0, 0, 0, 0.84);
} }
@-webkit-keyframes rippleOn {
0% {
opacity: 0;
}
50% {
opacity: 0.2;
}
100% {
opacity: 0;
}
}
@keyframes rippleOn { @keyframes rippleOn {
0% { 0% {
opacity: 0; opacity: 0;
@ -3555,6 +3664,17 @@ body .jumbotron-material-lightgrey,
opacity: 0; opacity: 0;
} }
} }
@-webkit-keyframes rippleOff {
0% {
opacity: 0;
}
50% {
opacity: 0.2;
}
100% {
opacity: 0;
}
}
@keyframes rippleOff { @keyframes rippleOff {
0% { 0% {
opacity: 0; opacity: 0;
@ -3628,6 +3748,7 @@ select[multiple].form-control.focus {
pointer-events: none; pointer-events: none;
left: 0px; left: 0px;
top: 5px; top: 5px;
-webkit-transition: 0.2s ease all;
transition: 0.2s ease all; transition: 0.2s ease all;
opacity: 0; opacity: 0;
} }
@ -3661,12 +3782,18 @@ select[multiple].form-control.focus {
height: 2px; height: 2px;
background-color: #5264ae; background-color: #5264ae;
bottom: -1px; bottom: -1px;
-webkit-transform: scaleX(0);
-ms-transform: scaleX(0);
transform: scaleX(0); transform: scaleX(0);
-webkit-transition: -webkit-transform 0s;
transition: transform 0s; transition: transform 0s;
} }
.form-control-wrapper .form-control:focus ~ .material-input:before, .form-control-wrapper .form-control:focus ~ .material-input:before,
.form-control-wrapper .form-control.focus ~ .material-input:before { .form-control-wrapper .form-control.focus ~ .material-input:before {
-webkit-transform: scaleX(1);
-ms-transform: scaleX(1);
transform: scaleX(1); transform: scaleX(1);
-webkit-transition: -webkit-transform 0.2s ease-out;
transition: transform 0.2s ease-out; transition: transform 0.2s ease-out;
} }
.form-control-wrapper .material-input:after { .form-control-wrapper .material-input:after {
@ -3679,6 +3806,8 @@ select[multiple].form-control.focus {
left: 0; left: 0;
pointer-events: none; pointer-events: none;
opacity: 0.9; opacity: 0.9;
-webkit-transform-origin: left;
-ms-transform-origin: left;
transform-origin: left; transform-origin: left;
} }
.form-control-wrapper .input-lg ~ .material-input:after { .form-control-wrapper .input-lg ~ .material-input:after {
@ -3692,7 +3821,9 @@ select[multiple].form-control.focus {
} }
.form-control-wrapper .form-control:focus ~ .material-input:after, .form-control-wrapper .form-control:focus ~ .material-input:after,
.form-control-wrapper .form-control.focus ~ .material-input:after { .form-control-wrapper .form-control.focus ~ .material-input:after {
-webkit-animation: input-highlight 0.3s ease;
animation: input-highlight 0.3s ease; animation: input-highlight 0.3s ease;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards; animation-fill-mode: forwards;
opacity: 0; opacity: 0;
} }
@ -4113,9 +4244,11 @@ select.form-control.focus {
@keyframes input-highlight { @keyframes input-highlight {
0% { 0% {
left: 20%; left: 20%;
-webkit-transform: scaleX(20%);
transform: scaleX(20%); transform: scaleX(20%);
} }
99% { 99% {
-webkit-transform: scaleX(0);
transform: scaleX(0); transform: scaleX(0);
left: 0; left: 0;
opacity: 1; opacity: 1;
@ -4988,14 +5121,20 @@ fieldset[disabled] .navbar .btn-link:focus {
border-radius: 2px; border-radius: 2px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
height: 0; height: 0;
-webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, padding 0 linear 0.2s, height 0 linear 0.2s;
transition: transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, padding 0 linear 0.2s, height 0 linear 0.2s; transition: transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, padding 0 linear 0.2s, height 0 linear 0.2s;
-webkit-transform: translateY(200%);
-ms-transform: translateY(200%);
transform: translateY(200%); transform: translateY(200%);
} }
.snackbar.snackbar-opened { .snackbar.snackbar-opened {
padding: 14px 15px; padding: 14px 15px;
margin-bottom: 20px; margin-bottom: 20px;
height: auto; height: auto;
-webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, height 0 linear 0.2s;
transition: transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, height 0 linear 0.2s; transition: transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, height 0 linear 0.2s;
-webkit-transform: none;
-ms-transform: none;
transform: none; transform: none;
} }
.snackbar.toast { .snackbar.toast {
@ -5005,6 +5144,9 @@ fieldset[disabled] .navbar .btn-link:focus {
.noUi-target * { .noUi-target * {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-ms-touch-action: none; -ms-touch-action: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none; user-select: none;
box-sizing: border-box; box-sizing: border-box;
} }
@ -5032,6 +5174,7 @@ fieldset[disabled] .navbar .btn-link:focus {
*z-index: -1; *z-index: -1;
} }
.noUi-state-tap .noUi-origin { .noUi-state-tap .noUi-origin {
-webkit-transition: left 0.3s, top 0.3s;
transition: left 0.3s, top 0.3s; transition: left 0.3s, top 0.3s;
} }
.noUi-state-drag * { .noUi-state-drag * {
@ -5076,6 +5219,7 @@ fieldset[disabled] .navbar .btn-link:focus {
.noUi-handle { .noUi-handle {
border-radius: 100%; border-radius: 100%;
cursor: default; cursor: default;
-webkit-transition: all 0.2s ease-out;
transition: all 0.2s ease-out; transition: all 0.2s ease-out;
border: 1px solid; border: 1px solid;
} }
@ -5084,6 +5228,8 @@ fieldset[disabled] .navbar .btn-link:focus {
margin: 15px 0; margin: 15px 0;
} }
.noUi-horizontal .noUi-handle.noUi-active { .noUi-horizontal .noUi-handle.noUi-active {
-webkit-transform: scale(2.5);
-ms-transform: scale(2.5);
transform: scale(2.5); transform: scale(2.5);
} }
[disabled].noUi-slider { [disabled].noUi-slider {

20
dist/js/material.js vendored
View File

@ -54,16 +54,20 @@ $(function (){
$(this).blur(); $(this).blur();
}); });
$(document).on("keyup change", ".form-control", function() { $(document).on("focus change", ".form-control", function() {
var self = $(this); var $this = $(this);
setTimeout(function() { if($this.val() === "") {
if (self.val() === "") { $this.removeClass("empty");
self.addClass("empty");
} else {
self.removeClass("empty");
} }
}, 1);
}); });
$(document).on("blur", ".form-control", function() {
var $this = $(this);
if($this.val() === "") {
$this.addClass("empty");
}
});
$(document) $(document)
.on("focus", ".form-control-wrapper.fileinput", function() { .on("focus", ".form-control-wrapper.fileinput", function() {
$(this).find("input").addClass("focus"); $(this).find("input").addClass("focus");

View File

@ -1 +1 @@
$(function(){"object"==typeof ripples&&ripples.init(".btn:not(.btn-link),.card-image,.navbar a:not(.withoutripple),.nav-tabs a:not(.withoutripple),.withripple");var a=function(){$(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("<span class=check></span>"),$(".radio > label > input").not(".bs-material").addClass("bs-material").after("<span class=circle></span><span class=check></span>"),$("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each(function(){if(!$(this).is(".bs-material")){if($(this).wrap("<div class=form-control-wrapper></div>"),$(this).after("<span class=material-input></span>"),$(this).hasClass("floating-label")){var a=$(this).attr("placeholder");$(this).attr("placeholder",null).removeClass("floating-label"),$(this).after("<div class=floating-label>"+a+"</div>")}if(($(this).is(":empty")||null===$(this).val()||"undefined"==$(this).val()||""===$(this).val())&&$(this).addClass("empty"),$(this).parent().next().is("[type=file]")){$(this).parent().addClass("fileinput");var b=$(this).parent().next().detach();$(this).after(b)}}})};a(),document.arrive&&document.arrive("input, textarea, select",function(){a()}),$(document).on("change",".checkbox input",function(){$(this).blur()}),$(document).on("keyup change",".form-control",function(){var a=$(this);setTimeout(function(){""===a.val()?a.addClass("empty"):a.removeClass("empty")},1)}),$(document).on("focus",".form-control-wrapper.fileinput",function(){$(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){$(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var a="";$.each($(this)[0].files,function(b,c){console.log(c),a+=c.name+", "}),a=a.substring(0,a.length-2),a?$(this).prev().removeClass("empty"):$(this).prev().addClass("empty"),$(this).prev().val(a)})}); $(function(){"object"==typeof ripples&&ripples.init(".btn:not(.btn-link),.card-image,.navbar a:not(.withoutripple),.nav-tabs a:not(.withoutripple),.withripple");var a=function(){$(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("<span class=check></span>"),$(".radio > label > input").not(".bs-material").addClass("bs-material").after("<span class=circle></span><span class=check></span>"),$("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each(function(){if(!$(this).is(".bs-material")){if($(this).wrap("<div class=form-control-wrapper></div>"),$(this).after("<span class=material-input></span>"),$(this).hasClass("floating-label")){var a=$(this).attr("placeholder");$(this).attr("placeholder",null).removeClass("floating-label"),$(this).after("<div class=floating-label>"+a+"</div>")}if(($(this).is(":empty")||null===$(this).val()||"undefined"==$(this).val()||""===$(this).val())&&$(this).addClass("empty"),$(this).parent().next().is("[type=file]")){$(this).parent().addClass("fileinput");var b=$(this).parent().next().detach();$(this).after(b)}}})};a(),document.arrive&&document.arrive("input, textarea, select",function(){a()}),$(document).on("change",".checkbox input",function(){$(this).blur()}),$(document).on("focus change",".form-control",function(){var a=$(this);""===a.val()&&a.removeClass("empty")}),$(document).on("blur",".form-control",function(){var a=$(this);""===a.val()&&a.addClass("empty")}),$(document).on("focus",".form-control-wrapper.fileinput",function(){$(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){$(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var a="";$.each($(this)[0].files,function(b,c){console.log(c),a+=c.name+", "}),a=a.substring(0,a.length-2),a?$(this).prev().removeClass("empty"):$(this).prev().addClass("empty"),$(this).prev().val(a)})});

View File

@ -54,16 +54,20 @@ $(function (){
$(this).blur(); $(this).blur();
}); });
$(document).on("keyup change", ".form-control", function() { $(document).on("focus change", ".form-control", function() {
var self = $(this); var $this = $(this);
setTimeout(function() { if($this.val() === "") {
if (self.val() === "") { $this.removeClass("empty");
self.addClass("empty");
} else {
self.removeClass("empty");
} }
}, 1);
}); });
$(document).on("blur", ".form-control", function() {
var $this = $(this);
if($this.val() === "") {
$this.addClass("empty");
}
});
$(document) $(document)
.on("focus", ".form-control-wrapper.fileinput", function() { .on("focus", ".form-control-wrapper.fileinput", function() {
$(this).find("input").addClass("focus"); $(this).find("input").addClass("focus");

View File

@ -1 +1 @@
$(function(){"object"==typeof ripples&&ripples.init(".btn:not(.btn-link),.card-image,.navbar a:not(.withoutripple),.nav-tabs a:not(.withoutripple),.withripple");var a=function(){$(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("<span class=check></span>"),$(".radio > label > input").not(".bs-material").addClass("bs-material").after("<span class=circle></span><span class=check></span>"),$("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each(function(){if(!$(this).is(".bs-material")){if($(this).wrap("<div class=form-control-wrapper></div>"),$(this).after("<span class=material-input></span>"),$(this).hasClass("floating-label")){var a=$(this).attr("placeholder");$(this).attr("placeholder",null).removeClass("floating-label"),$(this).after("<div class=floating-label>"+a+"</div>")}if(($(this).is(":empty")||null===$(this).val()||"undefined"==$(this).val()||""===$(this).val())&&$(this).addClass("empty"),$(this).parent().next().is("[type=file]")){$(this).parent().addClass("fileinput");var b=$(this).parent().next().detach();$(this).after(b)}}})};a(),document.arrive&&document.arrive("input, textarea, select",function(){a()}),$(document).on("change",".checkbox input",function(){$(this).blur()}),$(document).on("keyup change",".form-control",function(){var a=$(this);setTimeout(function(){""===a.val()?a.addClass("empty"):a.removeClass("empty")},1)}),$(document).on("focus",".form-control-wrapper.fileinput",function(){$(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){$(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var a="";$.each($(this)[0].files,function(b,c){console.log(c),a+=c.name+", "}),a=a.substring(0,a.length-2),a?$(this).prev().removeClass("empty"):$(this).prev().addClass("empty"),$(this).prev().val(a)})}); $(function(){"object"==typeof ripples&&ripples.init(".btn:not(.btn-link),.card-image,.navbar a:not(.withoutripple),.nav-tabs a:not(.withoutripple),.withripple");var a=function(){$(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("<span class=check></span>"),$(".radio > label > input").not(".bs-material").addClass("bs-material").after("<span class=circle></span><span class=check></span>"),$("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each(function(){if(!$(this).is(".bs-material")){if($(this).wrap("<div class=form-control-wrapper></div>"),$(this).after("<span class=material-input></span>"),$(this).hasClass("floating-label")){var a=$(this).attr("placeholder");$(this).attr("placeholder",null).removeClass("floating-label"),$(this).after("<div class=floating-label>"+a+"</div>")}if(($(this).is(":empty")||null===$(this).val()||"undefined"==$(this).val()||""===$(this).val())&&$(this).addClass("empty"),$(this).parent().next().is("[type=file]")){$(this).parent().addClass("fileinput");var b=$(this).parent().next().detach();$(this).after(b)}}})};a(),document.arrive&&document.arrive("input, textarea, select",function(){a()}),$(document).on("change",".checkbox input",function(){$(this).blur()}),$(document).on("focus change",".form-control",function(){var a=$(this);""===a.val()&&a.removeClass("empty")}),$(document).on("blur",".form-control",function(){var a=$(this);""===a.val()&&a.addClass("empty")}),$(document).on("focus",".form-control-wrapper.fileinput",function(){$(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){$(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var a="";$.each($(this)[0].files,function(b,c){console.log(c),a+=c.name+", "}),a=a.substring(0,a.length-2),a?$(this).prev().removeClass("empty"):$(this).prev().addClass("empty"),$(this).prev().val(a)})});