nunta/js/jqBootstrapValidation.min.js

7 lines
15 KiB
JavaScript
Raw Normal View History

2018-05-03 07:38:23 +02:00
/*!
* Start Bootstrap - Agency v5.0.0 (https://startbootstrap.com/template-overviews/agency)
2018-05-03 07:38:23 +02:00
* Copyright 2013-2018 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-agency/blob/master/LICENSE)
*/
!function(m){var u=[],t={options:{prependExistingHelpBlock:!1,sniffHtml:!0,preventSubmit:!0,submitError:!1,submitSuccess:!1,semanticallyStrict:!1,autoAdd:{helpBlocks:!0},filter:function(){return!0}},methods:{init:function(a){var v=m.extend(!0,{},t);v.options=m.extend(!0,v.options,a);var e=m.unique(this.map(function(){return m(this).parents("form")[0]}).toArray());return m(e).bind("submit",function(a){var e=m(this),i=0,t=e.find("input,textarea,select").not("[type=submit],[type=image]").filter(v.options.filter);t.trigger("submit.validation").trigger("validationLostFocus.validation"),t.each(function(a,e){var t=m(e).parents(".form-group").first();t.hasClass("warning")&&(t.removeClass("warning").addClass("error"),i++)}),t.trigger("validationLostFocus.validation"),i?(v.options.preventSubmit&&a.preventDefault(),e.addClass("error"),m.isFunction(v.options.submitError)&&v.options.submitError(e,a,t.jqBootstrapValidation("collectErrors",!0))):(e.removeClass("error"),m.isFunction(v.options.submitSuccess)&&v.options.submitSuccess(e,a))}),this.each(function(){var l=m(this),t=l.parents(".form-group").first(),i=t.find(".help-block").first(),r=l.parents("form").first(),n=[];if(!i.length&&v.options.autoAdd&&v.options.autoAdd.helpBlocks&&(i=m('<div class="help-block" />'),t.find(".controls").append(i),u.push(i[0])),v.options.sniffHtml){var a="";if(void 0!==l.attr("pattern")&&(a="Not in the expected format\x3c!-- data-validation-pattern-message to override --\x3e",l.data("validationPatternMessage")&&(a=l.data("validationPatternMessage")),l.data("validationPatternMessage",a),l.data("validationPatternRegex",l.attr("pattern"))),void 0!==l.attr("max")||void 0!==l.attr("aria-valuemax")){var e=void 0!==l.attr("max")?l.attr("max"):l.attr("aria-valuemax");a="Too high: Maximum of '"+e+"'\x3c!-- data-validation-max-message to override --\x3e",l.data("validationMaxMessage")&&(a=l.data("validationMaxMessage")),l.data("validationMaxMessage",a),l.data("validationMaxMax",e)}if(void 0!==l.attr("min")||void 0!==l.attr("aria-valuemin")){var o=void 0!==l.attr("min")?l.attr("min"):l.attr("aria-valuemin");a="Too low: Minimum of '"+o+"'\x3c!-- data-validation-min-message to override --\x3e",l.data("validationMinMessage")&&(a=l.data("validationMinMessage")),l.data("validationMinMessage",a),l.data("validationMinMin",o)}void 0!==l.attr("maxlength")&&(a="Too long: Maximum of '"+l.attr("maxlength")+"' characters\x3c!-- data-validation-maxlength-message to override --\x3e",l.data("validationMaxlengthMessage")&&(a=l.data("validationMaxlengthMessage")),l.data("validationMaxlengthMessage",a),l.data("validationMaxlengthMaxlength",l.attr("maxlength"))),void 0!==l.attr("minlength")&&(a="Too short: Minimum of '"+l.attr("minlength")+"' characters\x3c!-- data-validation-minlength-message to override --\x3e",l.data("validationMinlengthMessage")&&(a=l.data("validationMinlengthMessage")),l.data("validationMinlengthMessage",a),l.data("validationMinlengthMinlength",l.attr("minlength"))),void 0===l.attr("required")&&void 0===l.attr("aria-required")||(a=v.builtInValidators.required.message,l.data("validationRequiredMessage")&&(a=l.data("validationRequiredMessage")),l.data("validationRequiredMessage",a)),void 0!==l.attr("type")&&"number"===l.attr("type").toLowerCase()&&(a=v.builtInValidators.number.message,l.data("validationNumberMessage")&&(a=l.data("validationNumberMessage")),l.data("validationNumberMessage",a)),void 0!==l.attr("type")&&"email"===l.attr("type").toLowerCase()&&(a="Not a valid email address\x3c!-- data-validator-validemail-message to override --\x3e",l.data("validationValidemailMessage")?a=l.data("validationValidemailMessage"):l.data("validationEmailMessage")&&(a=l.data("validationEmailMessage")),l.data("validationValidemailMessage",a)),void 0!==l.attr("minchecked")&&(a="Not enough options checked; Minimum of '"+l.attr("minchecked")+"' required\x3c!-- data-validation-minchecked-message to override --\x3e",l.data("validationMincheckedMessage")&&(a=l.data("validationMincheckedMessage")),l.data("validationMincheckedMessage",a),l.data("validationMincheckedMinchecked",l.at