blog.hugopoi.net/www/.content.EZtzwPjb/html/1c9a7710693bf2ae87b502ac1df00fa87c93c178.00000781.js

1 line
21 KiB
JavaScript
Raw Normal View History

jQuery(document).ready(function(r){function n(t){var e=r(t);e.prop("disabled")||e.closest(".form-group").addClass("is-focused")}function e(t){var o=!1;(t.is(r.material.options.checkboxElements)||t.is(r.material.options.radioElements))&&(o=!0),t.closest("label").hover(function(){var t,e,a=r(this).find("input"),i=a.prop("disabled");o&&(t=r(this),e=i,(t.hasClass("checkbox-inline")||t.hasClass("radio-inline")?t:t.closest(".checkbox").length?t.closest(".checkbox"):t.closest(".radio")).toggleClass("disabled",e)),i||n(a)},function(){a(r(this).find("input"))})}function a(t){r(t).closest(".form-group").removeClass("is-focused")}r.expr[":"].notmdproc=function(t){return!r(t).data("mdproc")},r.material={options:{validate:!0,input:!0,ripples:!0,checkbox:!0,togglebutton:!0,radio:!0,arrive:!0,autofill:!1,withRipples:[".btn:not(.btn-link)",".card-image",".navbar a:not(.withoutripple)",".dropdown-menu a",".nav-tabs a:not(.withoutripple)",".withripple",".pagination li:not(.active):not(.disabled) a:not(.withoutripple)"].join(","),inputElements:"input.form-control, textarea.form-control, select.form-control",checkboxElements:".checkbox > label > input[type=checkbox], label.checkbox-inline > input[type=checkbox]",togglebuttonElements:".togglebutton > label > input[type=checkbox]",radioElements:".radio > label > input[type=radio], label.radio-inline > input[type=radio]"},checkbox:function(t){e(r(t||this.options.checkboxElements).filter(":notmdproc").data("mdproc",!0).after('<span class="checkbox-material"><span class="check"></span></span>'))},togglebutton:function(t){e(r(t||this.options.togglebuttonElements).filter(":notmdproc").data("mdproc",!0).after('<span class="toggle"></span>'))},radio:function(t){e(r(t||this.options.radioElements).filter(":notmdproc").data("mdproc",!0).after('<span class="circle"></span><span class="check"></span>'))},input:function(t){r(t||this.options.inputElements).filter(":notmdproc").data("mdproc",!0).each(function(){var a=r(this),i=a.closest(".form-group");if(0!==i.length||"hidden"===a.attr("type")||a.attr("hidden")||a.parents(".pirate_forms").length||(a.wrap('<div class="form-group"></div>'),i=a.closest(".form-group")),0===i.length&&"hidden"!==a.attr("type")&&!a.attr("hidden")&&a.parents(".pirate_forms").length){var t=a.prev();"checkbox"===a.attr("type")&&(t=a.next()),a.add(t).wrapAll('<div class="form-group label-floating"></div>'),i=a.closest(".form-group")}a.attr("data-hint")&&(a.after('<p class="help-block">'+a.attr("data-hint")+"</p>"),a.removeAttr("data-hint"));if(r.each({"input-lg":"form-group-lg","input-sm":"form-group-sm"},function(t,e){a.hasClass(t)&&(a.removeClass(t),i.addClass(e))}),a.hasClass("floating-label")){var e=a.attr("placeholder");a.attr("placeholder",null).removeClass("floating-label");var o=a.attr("id"),n="";o&&(n='for="'+o+'"'),i.addClass("label-floating"),a.after("<label "+n+'class="control-label">'+e+"</label>")}null!==a.val()&&"undefined"!==a.val()&&""!==a.val()||i.addClass("is-empty"),0<i.find("input[type=file]").length&&i.addClass("is-fileinput")})},attachInputEventHandlers:function(){var i=this.options.validate;r(document).on("keydown paste",".form-control",function(t){var e;(void 0===(e=t).which||"number"==typeof e.which&&0<e.which&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&8!==e.which&&9!==e.which&&13!==e.which&&16!==e.which&&17!==e.which&&20!==e.which&&27!==e.which)&&r(this).closest(".form-group").removeClass("is-empty")}).on("keyup change",".form-control",function(){var t=r(this),e=t.closest(".form-group"),a=void 0===t[0].checkValidity||t[0].checkValidity();""===t.val()?e.addClass("is-empty"):e.removeClass("is-empty"),i&&(a?e.removeClass("has-error"):e.addClass("has-error"))}).on("focus",".form-control, .form-group.is-fileinput",function(){n(this)}).on("blur",".form-control, .form-group.is-fileinput",function(){a(this)}).on("change",".form-group input",function(){var t=r(this);if("file"!==t.attr("type")){var e=t.closest(".form-group");t.val()?e.removeClass("is-empty"):e.addClass("is-empty")}}).on("change",'.form-group.is-fileinput input[type="file"]',function(){var t=r(this).closest(