Files
Last update 2 months 4 days
by
Arnaud-Apu-Fanovard
jquery.validate.unobtrusive-3.2.11.js.téléchargement/*! * * Hons: Newer Plugin not available.Manually updated this version and deleted /Scripts/jquery/jquery.validate.unobtrusive.min-3.2.11.js * * fix for warnings * JQMIGRATE: jQuery.parseJSON is deprecated; use JSON.parse * jQuery.isFunction() has been deprecated.In most cases, its use can be replaced by typeof x === "function" * * */(function(e){typeof define=="function"&&define.amd?define("jquery.validate.unobtrusive",["jquery-validation"],e):typeof module=="object"&&module.exports?module.exports=e(require("jquery-validation")):jQuery.validator.unobtrusive=e(jQuery)})(function(e){var t,s=e.validator,o="unobtrusiveValidation";function n(e,t,n){e.rules[t]=n,e.message&&(e.messages[t]=e.message)}function l(e){return e.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function i(e){return e.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function a(e){return e.substr(0,e.lastIndexOf(".")+1)}function r(e,t){return e.indexOf("*.")===0&&(e=e.replace("*.",t)),e}function d(t,n){var s=e(this).find("[data-valmsg-for='"+i(n[0].name)+"']"),o=s.attr("data-valmsg-replace"),a=o?JSON.parse(o)!==!1:null;s.removeClass("field-validation-valid").addClass("field-validation-error"),t.data("unobtrusiveContainer",s),a?(s.empty(),t.removeClass("input-validation-error").appendTo(s)):t.hide()}function u(t,n){var o=e(this).find("[data-valmsg-summary=true]"),s=o.find("ul");s&&s.length&&n.errorList.length&&(s.empty(),o.addClass("validation-summary-errors").removeClass("validation-summary-valid"),e.each(n.errorList,function(){e("<li />").html(this.message).appendTo(s)}))}function h(e){if(t=e.data("unobtrusiveContainer"),t){var t,n=t.attr("data-valmsg-replace"),s=n?JSON.parse(n):null;t.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),s&&t.empty()}}function m(){var n=e(this),s="__jquery_unobtrusive_validation_form_reset";if(n.data(s))return;n.data(s,!0);try{n.data("validator").resetForm()}finally{n.removeData(s)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function c(t){var n=e(t),i=n.data(o),c=e.proxy(m,t),a=s.unobtrusive.options||{},r=function(e,n){var s=a[e];s&&typeof s=="function"&&s.apply(t,n)};return i||(i={options:{errorClass:a.errorClass||"input-validation-error",errorElement:a.errorElement||"span",errorPlacement:function(){d.apply(t,arguments),r("errorPlacement",arguments)},invalidHandler:function(){u.apply(t,arguments),r("invalidHandler",arguments)},messages:{},rules:{},success:function(){h.apply(t,arguments),r("success",arguments)}},attachValidation:function(){n.off("reset."+o,c).on("reset."+o,c).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(o,i)),i}return s.unobtrusive={adapters:[],parseElement:function(t,n){var s,a,r,o=e(t),i=o.parents("form")[0];if(!i)return;s=c(i),s.options.rules[t.name]=a={},s.options.messages[t.name]=r={},e.each(this.adapters,function(){var n="data-val-"+this.name,s=o.attr(n),c={};s!==void 0&&(n+="-",e.each(this.params,function(){c[this]=o.attr(n+this)}),this.adapt({element:t,form:i,message:s,params:c,rules:a,messages:r}))}),e.extend(a,{__dummy__:!0}),n||s.attachValidation()},parse:function(t){var n=e(t),o=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){s.unobtrusive.parseElement(this,!0)}),o.each(function(){var e=c(this);e&&e.attachValidation()})}},t=s.unobtrusive.adapters,t.add=function(e,t,n){return n||(n=t,t=[]),this.push({name:e,params:t,adapt:n}),this},t.addBool=function(e,t){return this.add(e,function(s){n(s,t||e,!0)})},t.addMinMax=function(e,t,s,o,i,a){return this.add(e,[i||"min",a||"max"],function(e){var i=e.params.min,a=e.params.max;i&&a?n(e,o,[i,a]):i?n(e,t,i):a&&n(e,s,a)})},t.addSingleVal=function(e,t,s){return this.add(e,[t||"val"],function(o){n(o,s||e,o.params[t])})},s.addMethod("__dummy__",function(){return!0}),s.addMethod("regex",function(e,t,n){var s;return!!this.optional(t)||(s=new RegExp(n).exec(e),s&&s.index===0&&s[0].length===e.length)}),s.addMethod("nonalphamin",function(e,t,n){var s;return n&&(s=e.match(/\W/g),s=s&&s.length>=n),s}),s.methods.extension?(t.addSingleVal("accept","mimtype"),t.addSingleVal("extension","extension")):t.addSingleVal("extension","extension","accept"),t.addSingleVal("regex","pattern"),t.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),t.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),t.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),t.add("equalto",["other"],function(t){var s=a(t.element.name),o=t.params.other,c=r(o,s),l=e(t.form).find(":input").filter("[name='"+i(c)+"']")[0];n(t,"equalTo",l)}),t.add("required",function(e){(e.element.tagName.toUpperCase()!=="INPUT"||e.element.type.toUpperCase()!=="CHECKBOX")&&n(e,"required",!0)}),t.add("remote",["url","type","additionalfields"],function(t){var s={url:t.params.url,type:t.params.type||"GET",data:{}},o=a(t.element.name);e.each(l(t.params.additionalfields||t.element.name),function(n,a){var c=r(a,o);s.data[c]=function(){var n=e(t.form).find(":input").filter("[name='"+i(c)+"']");return n.is(":checkbox")?n.filter(":checked").val()||n.filter(":hidden").val()||"":n.is(":radio")?n.filter(":checked").val()||"":n.val()}}),n(t,"remote",s)}),t.add("password",["min","nonalphamin","regex"],function(e){e.params.min&&n(e,"minlength",e.params.min),e.params.nonalphamin&&n(e,"nonalphamin",e.params.nonalphamin),e.params.regex&&n(e,"regex",e.params.regex)}),t.add("fileextensions",["extensions"],function(e){n(e,"extension",e.params.extensions)}),e(function(){s.unobtrusive.parse(document)}),s.unobtrusive})