2014-08-25 15:00:49 +04:00
|
|
|
/* globals ripples */
|
|
|
|
|
2014-08-18 18:25:33 +04:00
|
|
|
$(function (){
|
|
|
|
|
2014-08-25 15:00:49 +04:00
|
|
|
ripples.init(".btn:not(.btn-link), .navbar a, .nav-tabs a, .withripple");
|
2014-08-18 18:25:33 +04:00
|
|
|
|
|
|
|
// Add fake-checkbox to material checkboxes
|
2014-09-17 12:56:21 +04:00
|
|
|
$(".checkbox > label > input").after("<span class=check></span>");
|
2014-08-18 18:25:33 +04:00
|
|
|
|
|
|
|
// Add fake-radio to material radios
|
2014-09-11 14:37:13 +04:00
|
|
|
$(".radio > label > input").after("<span class=ripple></span><span class=circle></span><span class=check></span>");
|
2014-08-18 18:25:33 +04:00
|
|
|
|
|
|
|
// Add elements for material inputs
|
2014-08-19 12:11:29 +04:00
|
|
|
$("input.form-control, textarea.form-control, select.form-control").each( function() {
|
2014-08-18 18:25:33 +04:00
|
|
|
$(this).wrap("<div class=form-control-wrapper></div>");
|
|
|
|
$(this).after("<span class=material-input></span>");
|
|
|
|
if ($(this).hasClass("floating-label")) {
|
|
|
|
var placeholder = $(this).attr("placeholder");
|
|
|
|
$(this).attr("placeholder", null).removeClass("floating-label");
|
|
|
|
$(this).after("<div class=floating-label>" + placeholder + "</div>");
|
|
|
|
}
|
|
|
|
if ($(this).val() === "") {
|
|
|
|
$(this).addClass("empty");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-09-08 11:39:40 +04:00
|
|
|
$(document).on("keyup change", ".form-control", function() {
|
2014-08-18 18:25:33 +04:00
|
|
|
if ($(this).val() !== "") {
|
|
|
|
$(this).removeClass("empty");
|
|
|
|
} else {
|
|
|
|
$(this).addClass("empty");
|
|
|
|
}
|
|
|
|
});
|
2014-09-08 11:39:40 +04:00
|
|
|
$(document).on("keydown", ".form-control", function() {
|
|
|
|
$(this).removeClass("empty");
|
|
|
|
});
|
2014-08-18 18:25:33 +04:00
|
|
|
});
|
|
|
|
|