jquery-validation
Advanced tools
Comparing version 1.17.0 to 1.18.0
@@ -0,1 +1,43 @@ | ||
1.17.0 / 2017-07-20 | ||
================== | ||
## Core | ||
* Pass on the value of the used submit button for scripted submits (#2019) | ||
* Removed aria-required attribute (#2012) | ||
* Assign rules to contenteditable via `.validate()` and `.rules()` (#1947) | ||
* Count invalid fields with empty message in `numberOfInvalids()` (#1942) | ||
* Added support for button elements with descendants (#1901) | ||
* Add support for defining a global normalizer (#1905) | ||
## Additional | ||
* Add localized number validation to methods_nl.js (#2014) | ||
* Remove unreachable return from `cifES.js` (#1994) | ||
* Add optional support to cifES, nifES and nieES (#1966) | ||
* Add netmask validation method (#1955) | ||
* Add Polish tax id validation method (#1850) | ||
* Fixed validation for specific case for Spanish NIFs (#1914) | ||
## Localization | ||
* Added Step Range Validation to messages_ja (#1936) | ||
* Add hungarian step message (#1888) | ||
* Add Sindhi locale (#1900) | ||
* Added norsk step translation (#1918) | ||
* Add missing french step translation (#1928) | ||
* Added nl- translation for "step" property (#1902) | ||
* Add French translation for notEqualTo method (#2033) | ||
## Readme | ||
* Add note about trimming whitespaces inside required method (#2028) | ||
## Tests | ||
* Pass on the value of the used submit button for scripted submits (#2019) | ||
* Use assert#pushResult instead of assert#push (#2018) | ||
## All | ||
* Fix links after move to organization | ||
* Use https | ||
## Build | ||
* Upgrade QUnit to 2.3.3 (#2018) | ||
1.16.0 / 2016-12-01 | ||
@@ -2,0 +44,0 @@ ================== |
/*! | ||
* jQuery Validation Plugin v1.17.0 | ||
* jQuery Validation Plugin v1.18.0 | ||
* | ||
* https://jqueryvalidation.org/ | ||
* | ||
* Copyright (c) 2017 Jörn Zaefferer | ||
* Copyright (c) 2018 Jörn Zaefferer | ||
* Released under the MIT license | ||
@@ -340,3 +340,3 @@ */ | ||
// Basing min and max length on | ||
// https://developer.ean.com/general_info/Valid_Credit_Card_Types | ||
// https://dev.ean.com/general-info/valid-card-types/ | ||
if ( value.length < 13 || value.length > 19 ) { | ||
@@ -402,3 +402,3 @@ return false; | ||
} | ||
if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard | ||
if ( validTypes & 0x0001 && ( /^(5[12345])/.test( value ) || /^(2[234567])/.test( value ) ) ) { // Mastercard | ||
return value.length === 16; | ||
@@ -536,2 +536,26 @@ } | ||
$.validator.addMethod( "greaterThan", function( value, element, param ) { | ||
var target = $( param ); | ||
if ( this.settings.onfocusout && target.not( ".validate-greaterThan-blur" ).length ) { | ||
target.addClass( "validate-greaterThan-blur" ).on( "blur.validate-greaterThan", function() { | ||
$( element ).valid(); | ||
} ); | ||
} | ||
return value > target.val(); | ||
}, "Please enter a greater value." ); | ||
$.validator.addMethod( "greaterThanEqual", function( value, element, param ) { | ||
var target = $( param ); | ||
if ( this.settings.onfocusout && target.not( ".validate-greaterThanEqual-blur" ).length ) { | ||
target.addClass( "validate-greaterThanEqual-blur" ).on( "blur.validate-greaterThanEqual", function() { | ||
$( element ).valid(); | ||
} ); | ||
} | ||
return value >= target.val(); | ||
}, "Please enter a greater value." ); | ||
/** | ||
@@ -686,2 +710,26 @@ * IBAN is the international bank account number. | ||
$.validator.addMethod( "lessThan", function( value, element, param ) { | ||
var target = $( param ); | ||
if ( this.settings.onfocusout && target.not( ".validate-lessThan-blur" ).length ) { | ||
target.addClass( "validate-lessThan-blur" ).on( "blur.validate-lessThan", function() { | ||
$( element ).valid(); | ||
} ); | ||
} | ||
return value < target.val(); | ||
}, "Please enter a lesser value." ); | ||
$.validator.addMethod( "lessThanEqual", function( value, element, param ) { | ||
var target = $( param ); | ||
if ( this.settings.onfocusout && target.not( ".validate-lessThanEqual-blur" ).length ) { | ||
target.addClass( "validate-lessThanEqual-blur" ).on( "blur.validate-lessThanEqual", function() { | ||
$( element ).valid(); | ||
} ); | ||
} | ||
return value <= target.val(); | ||
}, "Please enter a lesser value." ); | ||
$.validator.addMethod( "lettersonly", function( value, element ) { | ||
@@ -695,2 +743,59 @@ return this.optional( element ) || /^[a-z]+$/i.test( value ); | ||
// Limit the number of files in a FileList. | ||
$.validator.addMethod( "maxfiles", function( value, element, param ) { | ||
if ( this.optional( element ) ) { | ||
return true; | ||
} | ||
if ( $( element ).attr( "type" ) === "file" ) { | ||
if ( element.files && element.files.length > param ) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}, $.validator.format( "Please select no more than {0} files." ) ); | ||
// Limit the size of each individual file in a FileList. | ||
$.validator.addMethod( "maxsize", function( value, element, param ) { | ||
if ( this.optional( element ) ) { | ||
return true; | ||
} | ||
if ( $( element ).attr( "type" ) === "file" ) { | ||
if ( element.files && element.files.length ) { | ||
for ( var i = 0; i < element.files.length; i++ ) { | ||
if ( element.files[ i ].size > param ) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
}, $.validator.format( "File size must not exceed {0} bytes each." ) ); | ||
// Limit the size of all files in a FileList. | ||
$.validator.addMethod( "maxsizetotal", function( value, element, param ) { | ||
if ( this.optional( element ) ) { | ||
return true; | ||
} | ||
if ( $( element ).attr( "type" ) === "file" ) { | ||
if ( element.files && element.files.length ) { | ||
var totalSize = 0; | ||
for ( var i = 0; i < element.files.length; i++ ) { | ||
totalSize += element.files[ i ].size; | ||
if ( totalSize > param ) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
}, $.validator.format( "Total size of all files must not exceed {0} bytes." ) ); | ||
$.validator.addMethod( "mobileNL", function( value, element ) { | ||
@@ -812,2 +917,60 @@ return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); | ||
/** | ||
* Created for project jquery-validation. | ||
* @Description Brazillian PIS or NIS number (Número de Identificação Social Pis ou Pasep) is the equivalent of a | ||
* Brazilian tax registration number NIS of PIS numbers have 11 digits in total: 10 numbers followed by 1 check numbers | ||
* that are being used for validation. | ||
* @copyright (c) 21/08/2018 13:14, Cleiton da Silva Mendonça | ||
* @author Cleiton da Silva Mendonça <cleiton.mendonca@gmail.com> | ||
* @link http://gitlab.com/csmendonca Gitlab of Cleiton da Silva Mendonça | ||
* @link http://github.com/csmendonca Github of Cleiton da Silva Mendonça | ||
*/ | ||
$.validator.addMethod( "nisBR", function( value ) { | ||
var number; | ||
var cn; | ||
var sum = 0; | ||
var dv; | ||
var count; | ||
var multiplier; | ||
// Removing special characters from value | ||
value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); | ||
// Checking value to have 11 digits only | ||
if ( value.length !== 11 ) { | ||
return false; | ||
} | ||
//Get check number of value | ||
cn = parseInt( value.substring( 10, 11 ), 10 ); | ||
//Get number with 10 digits of the value | ||
number = parseInt( value.substring( 0, 10 ), 10 ); | ||
for ( count = 2; count < 12; count++ ) { | ||
multiplier = count; | ||
if ( count === 10 ) { | ||
multiplier = 2; | ||
} | ||
if ( count === 11 ) { | ||
multiplier = 3; | ||
} | ||
sum += ( ( number % 10 ) * multiplier ); | ||
number = parseInt( number / 10, 10 ); | ||
} | ||
dv = ( sum % 11 ); | ||
if ( dv > 1 ) { | ||
dv = ( 11 - dv ); | ||
} else { | ||
dv = 0; | ||
} | ||
if ( cn === dv ) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}, "Please specify a valid NIS/PIS number" ); | ||
$.validator.addMethod( "notEqualTo", function( value, element, param ) { | ||
@@ -851,2 +1014,26 @@ return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); | ||
/** | ||
* Polish telephone numbers have 9 digits. | ||
* | ||
* Mobile phone numbers starts with following digits: | ||
* 45, 50, 51, 53, 57, 60, 66, 69, 72, 73, 78, 79, 88. | ||
* | ||
* Fixed-line numbers starts with area codes: | ||
* 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 29, 32, 33, | ||
* 34, 41, 42, 43, 44, 46, 48, 52, 54, 55, 56, 58, 59, 61, | ||
* 62, 63, 65, 67, 68, 71, 74, 75, 76, 77, 81, 82, 83, 84, | ||
* 85, 86, 87, 89, 91, 94, 95. | ||
* | ||
* Ministry of National Defence numbers and VoIP numbers starts with 26 and 39. | ||
* | ||
* Excludes intelligent networks (premium rate, shared cost, free phone numbers). | ||
* | ||
* Poland National Numbering Plan http://www.itu.int/oth/T02020000A8/en | ||
*/ | ||
$.validator.addMethod( "phonePL", function( phone_number, element ) { | ||
phone_number = phone_number.replace( /\s+/g, "" ); | ||
var regexp = /^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/; | ||
return this.optional( element ) || regexp.test( phone_number ); | ||
}, "Please specify a valid phone number" ); | ||
/* For UK phone functions, do the following server side processing: | ||
@@ -901,3 +1088,3 @@ * Compare original input with this RegEx pattern: | ||
return this.optional( element ) || phone_number.length > 9 && | ||
phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); | ||
phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/ ); | ||
}, "Please specify a valid phone number" ); | ||
@@ -904,0 +1091,0 @@ |
/*! | ||
* jQuery Validation Plugin v1.17.0 | ||
* jQuery Validation Plugin v1.18.0 | ||
* | ||
* https://jqueryvalidation.org/ | ||
* | ||
* Copyright (c) 2017 Jörn Zaefferer | ||
* Copyright (c) 2018 Jörn Zaefferer | ||
* Released under the MIT license | ||
@@ -70,2 +70,3 @@ */ | ||
} | ||
function handle() { | ||
@@ -86,3 +87,3 @@ var hidden, result; | ||
if ( validator.settings.submitHandler ) { | ||
if ( validator.settings.submitHandler && !validator.settings.debug ) { | ||
result = validator.settings.submitHandler.call( validator, validator.currentForm, event ); | ||
@@ -154,3 +155,3 @@ if ( hidden ) { | ||
if ( !element.form && element.hasAttribute( "contenteditable" ) ) { | ||
if ( !element.form && element.isContentEditable ) { | ||
element.form = this.closest( "form" )[ 0 ]; | ||
@@ -399,3 +400,4 @@ element.name = this.attr( "name" ); | ||
var groups = ( this.groups = {} ), | ||
var currentForm = this.currentForm, | ||
groups = ( this.groups = {} ), | ||
rules; | ||
@@ -418,3 +420,3 @@ $.each( this.settings.groups, function( key, value ) { | ||
// Set form expando on contenteditable | ||
if ( !this.form && this.hasAttribute( "contenteditable" ) ) { | ||
if ( !this.form && this.isContentEditable ) { | ||
this.form = $( this ).closest( "form" )[ 0 ]; | ||
@@ -424,2 +426,8 @@ this.name = $( this ).attr( "name" ); | ||
// Ignore the element if it belongs to another form. This will happen mainly | ||
// when setting the `form` attribute of an input to the id of another form. | ||
if ( currentForm !== this.form ) { | ||
return; | ||
} | ||
var validator = $.data( this.form, "validator" ), | ||
@@ -653,3 +661,3 @@ eventType = "on" + event.type.replace( /^validate/, "" ), | ||
// Set form expando on contenteditable | ||
if ( this.hasAttribute( "contenteditable" ) ) { | ||
if ( this.isContentEditable ) { | ||
this.form = $( this ).closest( "form" )[ 0 ]; | ||
@@ -659,2 +667,7 @@ this.name = name; | ||
// Ignore elements that belong to other/nested forms | ||
if ( this.form !== validator.currentForm ) { | ||
return false; | ||
} | ||
// Select only the first element for each name, and only those with rules specified | ||
@@ -713,3 +726,3 @@ if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) { | ||
if ( element.hasAttribute( "contenteditable" ) ) { | ||
if ( element.isContentEditable ) { | ||
val = $element.text(); | ||
@@ -775,6 +788,2 @@ } else { | ||
if ( typeof val !== "string" ) { | ||
throw new TypeError( "The normalizer should return a string value." ); | ||
} | ||
// Delete the normalizer from rules to avoid treating it as a pre-defined method. | ||
@@ -1155,3 +1164,15 @@ delete rules.normalizer; | ||
.off( ".validate-equalTo" ) | ||
.removeClass( "validate-equalTo-blur" ); | ||
.removeClass( "validate-equalTo-blur" ) | ||
.find( ".validate-lessThan-blur" ) | ||
.off( ".validate-lessThan" ) | ||
.removeClass( "validate-lessThan-blur" ) | ||
.find( ".validate-lessThanEqual-blur" ) | ||
.off( ".validate-lessThanEqual" ) | ||
.removeClass( "validate-lessThanEqual-blur" ) | ||
.find( ".validate-greaterThanEqual-blur" ) | ||
.off( ".validate-greaterThanEqual" ) | ||
.removeClass( "validate-greaterThanEqual-blur" ) | ||
.find( ".validate-greaterThan-blur" ) | ||
.off( ".validate-greaterThan" ) | ||
.removeClass( "validate-greaterThan-blur" ); | ||
} | ||
@@ -1260,2 +1281,8 @@ | ||
value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() ); | ||
// Cast empty attributes like `data-rule-required` to `true` | ||
if ( value === "" ) { | ||
value = true; | ||
} | ||
this.normalizeAttributeRule( rules, type, method, value ); | ||
@@ -1386,3 +1413,3 @@ } | ||
} | ||
return value.length > 0; | ||
return value !== undefined && value !== null && value.length > 0; | ||
}, | ||
@@ -1411,6 +1438,23 @@ | ||
// https://jqueryvalidation.org/date-method/ | ||
date: function( value, element ) { | ||
return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() ); | ||
}, | ||
date: ( function() { | ||
var called = false; | ||
return function( value, element ) { | ||
if ( !called ) { | ||
called = true; | ||
if ( this.settings.debug && window.console ) { | ||
console.warn( | ||
"The `date` method is deprecated and will be removed in version '2.0.0'.\n" + | ||
"Please don't use it, since it relies on the Date constructor, which\n" + | ||
"behaves very differently across browsers and locales. Use `dateISO`\n" + | ||
"instead or one of the locale specific methods in `localizations/`\n" + | ||
"and `additional-methods.js`." | ||
); | ||
} | ||
} | ||
return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() ); | ||
}; | ||
}() ), | ||
// https://jqueryvalidation.org/dateISO-method/ | ||
@@ -1417,0 +1461,0 @@ dateISO: function( value, element ) { |
@@ -1,4 +0,4 @@ | ||
/*! jQuery Validation Plugin - v1.17.0 - 7/29/2017 | ||
/*! jQuery Validation Plugin - v1.18.0 - 9/9/2018 | ||
* https://jqueryvalidation.org/ | ||
* Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */ | ||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!c.settings.submitHandler||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(null!=j&&(!j.form&&j.hasAttribute("contenteditable")&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){!this.form&&this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name"));var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=d),!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.hasAttribute("contenteditable")?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);if("function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f){if(j=f.call(b,j),"string"!=typeof j)throw new TypeError("The normalizer should return a string value.");delete g.normalizer}for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a}); | ||
* Copyright (c) 2018 Jörn Zaefferer; Licensed MIT */ | ||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(null!=j&&(!j.form&&j.isContentEditable&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){if(!this.form&&this.isContentEditable&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var c=a.data(this.form,"validator"),e="on"+b.type.replace(/^validate/,""),f=c.settings;f[e]&&!a(this).is(f.ignore)&&f[e].call(c,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.isContentEditable&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.isContentEditable?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a}); |
@@ -27,3 +27,3 @@ (function( factory ) { | ||
extension: "Моля, въведете стойност с валидно разширение.", | ||
maxlength: $.validator.format( "Моля, въведете повече от {0} символа." ), | ||
maxlength: $.validator.format( "Моля, въведете не повече от {0} символа." ), | ||
minlength: $.validator.format( "Моля, въведете поне {0} символа." ), | ||
@@ -30,0 +30,0 @@ rangelength: $.validator.format( "Моля, въведете стойност с дължина между {0} и {1} символа." ), |
@@ -32,5 +32,6 @@ (function( factory ) { | ||
max: $.validator.format( "Prosím, zadejte hodnotu menší nebo rovnu {0}." ), | ||
min: $.validator.format( "Prosím, zadejte hodnotu větší nebo rovnu {0}." ) | ||
min: $.validator.format( "Prosím, zadejte hodnotu větší nebo rovnu {0}." ), | ||
step: $.validator.format( "Musí být násobkem čísla {0}." ) | ||
} ); | ||
return $; | ||
})); |
@@ -17,5 +17,3 @@ (function( factory ) { | ||
required: "Dette felt er påkrævet.", | ||
maxlength: $.validator.format( "Indtast højst {0} tegn." ), | ||
minlength: $.validator.format( "Indtast mindst {0} tegn." ), | ||
rangelength: $.validator.format( "Indtast mindst {0} og højst {1} tegn." ), | ||
remote: "Ret venligst dette felt", | ||
email: "Indtast en gyldig email-adresse.", | ||
@@ -26,9 +24,25 @@ url: "Indtast en gyldig URL.", | ||
digits: "Indtast kun cifre.", | ||
creditcard: "Indtast et gyldigt kreditkortnummer.", | ||
equalTo: "Indtast den samme værdi igen.", | ||
time: "Angiv en gyldig tid mellem kl. 00:00 og 23:59.", | ||
ipv4: "Angiv venligst en gyldig IPv4-adresse.", | ||
ipv6: "Angiv venligst en gyldig IPv6-adresse.", | ||
require_from_group: $.validator.format( "Angiv mindst {0} af disse felter." ), | ||
extension: "Indtast venligst en værdi med en gyldig endelse", | ||
pattern: "Ugyldigt format", | ||
lettersonly: "Angiv venligst kun bogstaver.", | ||
nowhitespace: "Må ikke indholde mellemrum", | ||
maxlength: $.validator.format( "Indtast højst {0} tegn." ), | ||
minlength: $.validator.format( "Indtast mindst {0} tegn." ), | ||
rangelength: $.validator.format( "Indtast mindst {0} og højst {1} tegn." ), | ||
range: $.validator.format( "Angiv en værdi mellem {0} og {1}." ), | ||
max: $.validator.format( "Angiv en værdi der højst er {0}." ), | ||
min: $.validator.format( "Angiv en værdi der mindst er {0}." ), | ||
creditcard: "Indtast et gyldigt kreditkortnummer." | ||
minWords: $.validator.format( "Indtast venligst mindst {0} ord" ), | ||
maxWords: $.validator.format( "Indtast venligst højst {0} ord" ), | ||
step: $.validator.format( "Angiv en værdi gange {0}." ), | ||
notEqualTo: "Angiv en anden værdi, værdierne må ikke være det samme.", | ||
integer: "Angiv et ikke-decimaltal, der er positivt eller negativt." | ||
} ); | ||
return $; | ||
})); |
@@ -20,14 +20,64 @@ (function( factory ) { | ||
rangelength: $.validator.format( "Geben Sie bitte mindestens {0} und maximal {1} Zeichen ein." ), | ||
email: "Geben Sie bitte eine gültige E-Mail Adresse ein.", | ||
email: "Geben Sie bitte eine gültige E-Mail-Adresse ein.", | ||
url: "Geben Sie bitte eine gültige URL ein.", | ||
date: "Bitte geben Sie ein gültiges Datum ein.", | ||
date: "Geben Sie bitte ein gültiges Datum ein.", | ||
number: "Geben Sie bitte eine Nummer ein.", | ||
digits: "Geben Sie bitte nur Ziffern ein.", | ||
equalTo: "Bitte denselben Wert wiederholen.", | ||
equalTo: "Wiederholen Sie bitte denselben Wert.", | ||
range: $.validator.format( "Geben Sie bitte einen Wert zwischen {0} und {1} ein." ), | ||
max: $.validator.format( "Geben Sie bitte einen Wert kleiner oder gleich {0} ein." ), | ||
min: $.validator.format( "Geben Sie bitte einen Wert größer oder gleich {0} ein." ), | ||
creditcard: "Geben Sie bitte eine gültige Kreditkarten-Nummer ein." | ||
creditcard: "Geben Sie bitte eine gültige Kreditkarten-Nummer ein.", | ||
remote: "Korrigieren Sie bitte dieses Feld.", | ||
dateISO: "Geben Sie bitte ein gültiges Datum ein (ISO-Format).", | ||
step: $.validator.format( "Geben Sie bitte ein Vielfaches von {0} ein." ), | ||
maxWords: $.validator.format( "Geben Sie bitte {0} Wörter oder weniger ein." ), | ||
minWords: $.validator.format( "Geben Sie bitte mindestens {0} Wörter ein." ), | ||
rangeWords: $.validator.format( "Geben Sie bitte zwischen {0} und {1} Wörtern ein." ), | ||
accept: "Geben Sie bitte einen Wert mit einem gültigen MIME-Typ ein.", | ||
alphanumeric: "Geben Sie bitte nur Buchstaben (keine Umlaute), Zahlen oder Unterstriche ein.", | ||
bankaccountNL: "Geben Sie bitte eine gültige Kontonummer ein.", | ||
bankorgiroaccountNL: "Geben Sie bitte eine gültige Bank- oder Girokontonummer ein.", | ||
bic: "Geben Sie bitte einen gültigen BIC-Code ein.", | ||
cifES: "Geben Sie bitte eine gültige CIF-Nummer ein.", | ||
cpfBR: "Geben Sie bitte eine gültige CPF-Nummer ein.", | ||
creditcardtypes: "Geben Sie bitte eine gültige Kreditkarten-Nummer ein.", | ||
currency: "Geben Sie bitte eine gültige Währung ein.", | ||
extension: "Geben Sie bitte einen Wert mit einer gültigen Erweiterung ein.", | ||
giroaccountNL: "Geben Sie bitte eine gültige Girokontonummer ein.", | ||
iban: "Geben Sie bitte eine gültige IBAN ein.", | ||
integer: "Geben Sie bitte eine positive oder negative Nicht-Dezimalzahl ein.", | ||
ipv4: "Geben Sie bitte eine gültige IPv4-Adresse ein.", | ||
ipv6: "Geben Sie bitte eine gültige IPv6-Adresse ein.", | ||
lettersonly: "Geben Sie bitte nur Buchstaben ein.", | ||
letterswithbasicpunc: "Geben Sie bitte nur Buchstaben oder Interpunktion ein.", | ||
mobileNL: "Geben Sie bitte eine gültige Handynummer ein.", | ||
mobileUK: "Geben Sie bitte eine gültige Handynummer ein.", | ||
netmask: "Geben Sie bitte eine gültige Netzmaske ein.", | ||
nieES: "Geben Sie bitte eine gültige NIE-Nummer ein.", | ||
nifES: "Geben Sie bitte eine gültige NIF-Nummer ein.", | ||
nipPL: "Geben Sie bitte eine gültige NIP-Nummer ein.", | ||
notEqualTo: "Geben Sie bitte einen anderen Wert ein. Die Werte dürfen nicht gleich sein.", | ||
nowhitespace: "Kein Leerzeichen bitte.", | ||
pattern: "Ungültiges Format.", | ||
phoneNL: "Geben Sie bitte eine gültige Telefonnummer ein.", | ||
phonesUK: "Geben Sie bitte eine gültige britische Telefonnummer ein.", | ||
phoneUK: "Geben Sie bitte eine gültige Telefonnummer ein.", | ||
phoneUS: "Geben Sie bitte eine gültige Telefonnummer ein.", | ||
postalcodeBR: "Geben Sie bitte eine gültige brasilianische Postleitzahl ein.", | ||
postalCodeCA: "Geben Sie bitte eine gültige kanadische Postleitzahl ein.", | ||
postalcodeIT: "Geben Sie bitte eine gültige italienische Postleitzahl ein.", | ||
postalcodeNL: "Geben Sie bitte eine gültige niederländische Postleitzahl ein.", | ||
postcodeUK: "Geben Sie bitte eine gültige britische Postleitzahl ein.", | ||
require_from_group: $.validator.format( "Füllen Sie bitte mindestens {0} dieser Felder aus." ), | ||
skip_or_fill_minimum: $.validator.format( "Überspringen Sie bitte diese Felder oder füllen Sie mindestens {0} von ihnen aus." ), | ||
stateUS: "Geben Sie bitte einen gültigen US-Bundesstaat ein.", | ||
strippedminlength: $.validator.format( "Geben Sie bitte mindestens {0} Zeichen ein." ), | ||
time: "Geben Sie bitte eine gültige Uhrzeit zwischen 00:00 und 23:59 ein.", | ||
time12h: "Geben Sie bitte eine gültige Uhrzeit im 12-Stunden-Format ein.", | ||
vinUS: "Die angegebene Fahrzeugidentifikationsnummer (VIN) ist ungültig.", | ||
zipcodeUS: "Die angegebene US-Postleitzahl ist ungültig.", | ||
ziprange: "Ihre Postleitzahl muss im Bereich 902xx-xxxx bis 905xx-xxxx liegen." | ||
} ); | ||
return $; | ||
})); |
@@ -18,12 +18,13 @@ (function( factory ) { | ||
remote: "لطفا این فیلد را تصحیح کنید.", | ||
email: ".لطفا یک ایمیل صحیح وارد کنید", | ||
email: "لطفا یک ایمیل صحیح وارد کنید.", | ||
url: "لطفا آدرس صحیح وارد کنید.", | ||
date: "لطفا یک تاریخ صحیح وارد کنید", | ||
dateFA: "لطفا یک تاریخ صحیح وارد کنید", | ||
date: "لطفا تاریخ صحیح وارد کنید.", | ||
dateFA: "لطفا یک تاریخ صحیح وارد کنید.", | ||
dateISO: "لطفا تاریخ صحیح وارد کنید (ISO).", | ||
number: "لطفا عدد صحیح وارد کنید.", | ||
digits: "لطفا تنها رقم وارد کنید", | ||
digits: "لطفا تنها رقم وارد کنید.", | ||
creditcard: "لطفا کریدیت کارت صحیح وارد کنید.", | ||
equalTo: "لطفا مقدار برابری وارد کنید", | ||
extension: "لطفا مقداری وارد کنید که ", | ||
equalTo: "لطفا مقدار برابری وارد کنید.", | ||
extension: "لطفا مقداری وارد کنید که", | ||
alphanumeric: "لطفا مقدار را عدد (انگلیسی) وارد کنید.", | ||
maxlength: $.validator.format( "لطفا بیشتر از {0} حرف وارد نکنید." ), | ||
@@ -30,0 +31,0 @@ minlength: $.validator.format( "لطفا کمتر از {0} حرف وارد نکنید." ), |
@@ -56,3 +56,3 @@ (function( factory ) { | ||
ipv6: "Veuillez fournir une adresse IP v6 valide.", | ||
require_from_group: "Veuillez fournir au moins {0} de ces champs.", | ||
require_from_group: $.validator.format( "Veuillez fournir au moins {0} de ces champs." ), | ||
nifES: "Veuillez fournir un numéro NIF valide.", | ||
@@ -59,0 +59,0 @@ nieES: "Veuillez fournir un numéro NIE valide.", |
@@ -16,15 +16,14 @@ (function( factory ) { | ||
$.extend( $.validator.messages, { | ||
required: "Dette feltet er obligatorisk.", | ||
maxlength: $.validator.format( "Maksimalt {0} tegn." ), | ||
minlength: $.validator.format( "Minimum {0} tegn." ), | ||
rangelength: $.validator.format( "Angi minimum {0} og maksimum {1} tegn." ), | ||
email: "Oppgi en gyldig epostadresse.", | ||
required: "Angi en verdi.", | ||
remote: "Ugyldig verdi.", | ||
email: "Angi en gyldig epostadresse.", | ||
url: "Angi en gyldig URL.", | ||
date: "Angi en gyldig dato.", | ||
dateISO: "Angi en gyldig dato (&ARING;&ARING;&ARING;&ARING;-MM-DD).", | ||
dateSE: "Angi en gyldig dato.", | ||
number: "Angi et gyldig nummer.", | ||
numberSE: "Angi et gyldig nummer.", | ||
number: "Angi et gyldig tall.", | ||
digits: "Skriv kun tall.", | ||
equalTo: "Skriv samme verdi igjen.", | ||
maxlength: $.validator.format( "Maksimalt {0} tegn." ), | ||
minlength: $.validator.format( "Minimum {0} tegn." ), | ||
rangelength: $.validator.format( "Angi minimum {0} og maksimum {1} tegn." ), | ||
range: $.validator.format( "Angi en verdi mellom {0} og {1}." ), | ||
@@ -31,0 +30,0 @@ max: $.validator.format( "Angi en verdi som er mindre eller lik {0}." ), |
@@ -28,2 +28,3 @@ (function( factory ) { | ||
nipPL: "Proszę o podanie prawidłowego numeru NIP.", | ||
phonePL: "Proszę o podanie prawidłowego numeru telefonu", | ||
maxlength: $.validator.format( "Proszę o podanie nie więcej niż {0} znaków." ), | ||
@@ -30,0 +31,0 @@ minlength: $.validator.format( "Proszę o podanie przynajmniej {0} znaków." ), |
@@ -35,3 +35,3 @@ (function( factory ) { | ||
min: $.validator.format( "Por favor, forneça um valor maior ou igual a {0}." ), | ||
step: $.validator.format( "Por favor, forneça um valor m´tiplo de {0}." ), | ||
step: $.validator.format( "Por favor, forneça um valor múltiplo de {0}." ), | ||
@@ -66,11 +66,11 @@ // Metodos Adicionais | ||
nowhitespace: "Por favor, não utilize espaços em branco.", | ||
pattern: "O formato fornenecido é inválido.", | ||
phoneNL: "Por favor, forneceça um número de telefone válido.", | ||
phoneUK: "Por favor, forneceça um número de telefone válido.", | ||
phoneUS: "Por favor, forneceça um número de telefone válido.", | ||
phonesUK: "Por favor, forneceça um número de telefone válido.", | ||
postalCodeCA: "Por favor, forneceça um número de código postal válido.", | ||
postalcodeIT: "Por favor, forneceça um número de código postal válido.", | ||
postalcodeNL: "Por favor, forneceça um número de código postal válido.", | ||
postcodeUK: "Por favor, forneceça um número de código postal válido.", | ||
pattern: "O formato fornecido é inválido.", | ||
phoneNL: "Por favor, forneça um número de telefone válido.", | ||
phoneUK: "Por favor, forneça um número de telefone válido.", | ||
phoneUS: "Por favor, forneça um número de telefone válido.", | ||
phonesUK: "Por favor, forneça um número de telefone válido.", | ||
postalCodeCA: "Por favor, forneça um número de código postal válido.", | ||
postalcodeIT: "Por favor, forneça um número de código postal válido.", | ||
postalcodeNL: "Por favor, forneça um número de código postal válido.", | ||
postcodeUK: "Por favor, forneça um número de código postal válido.", | ||
postalcodeBR: "Por favor, forneça um CEP válido.", | ||
@@ -81,11 +81,12 @@ require_from_group: $.validator.format( "Por favor, forneça pelo menos {0} destes campos." ), | ||
strippedminlength: $.validator.format( "Por favor, forneça pelo menos {0} caracteres." ), | ||
time: "Por favor, forneça um horário válido, no intervado de 00:00 e 23:59.", | ||
time12h: "Por favor, forneça um horário válido, no intervado de 01:00 e 12:59 am/pm.", | ||
url2: "Por favor, forneceça uma URL válida.", | ||
vinUS: "O número de identificação de veículo informada (VIN) é inválido.", | ||
zipcodeUS: "Por favor, forneceça um código postal americano válido.", | ||
time: "Por favor, forneça um horário válido, no intervado de 00:00 a 23:59.", | ||
time12h: "Por favor, forneça um horário válido, no intervado de 01:00 a 12:59 am/pm.", | ||
url2: "Por favor, forneça uma URL válida.", | ||
vinUS: "O número de identificação de veículo informado (VIN) é inválido.", | ||
zipcodeUS: "Por favor, forneça um código postal americano válido.", | ||
ziprange: "O código postal deve estar entre 902xx-xxxx e 905xx-xxxx", | ||
cpfBR: "Por favor, forneça um CPF válido." | ||
cpfBR: "Por favor, forneça um CPF válido.", | ||
nisBR: "Por favor, forneça um NIS/PIS válido" | ||
} ); | ||
return $; | ||
})); |
@@ -29,5 +29,6 @@ (function( factory ) { | ||
min: $.validator.format( "Nemôže byť menej ako {0}." ), | ||
creditcard: "Číslo platobnej karty musí byť platné." | ||
creditcard: "Číslo platobnej karty musí byť platné.", | ||
step: $.validator.format( "Musí byť násobkom čísla {0}." ) | ||
} ); | ||
return $; | ||
})); |
@@ -17,2 +17,3 @@ (function( factory ) { | ||
required: "Detta fält är obligatoriskt.", | ||
remote: "Var snäll och åtgärda detta fält.", | ||
maxlength: $.validator.format( "Du får ange högst {0} tecken." ), | ||
@@ -19,0 +20,0 @@ minlength: $.validator.format( "Du måste ange minst {0} tecken." ), |
@@ -33,5 +33,5 @@ (function( factory ) { | ||
min: $.validator.format( "Lütfen {0} değerine eşit ya da daha büyük bir değer giriniz." ), | ||
require_from_group: "Lütfen bu alanların en az {0} tanesini doldurunuz." | ||
require_from_group: $.validator.format( "Lütfen bu alanların en az {0} tanesini doldurunuz." ) | ||
} ); | ||
return $; | ||
})); |
@@ -32,5 +32,5 @@ (function( factory ) { | ||
max: $.validator.format( "Hãy nhập từ {0} trở xuống." ), | ||
min: $.validator.format( "Hãy nhập từ {1} trở lên." ) | ||
min: $.validator.format( "Hãy nhập từ {0} trở lên." ) | ||
} ); | ||
return $; | ||
})); |
@@ -31,2 +31,3 @@ (function( factory ) { | ||
range: $.validator.format( "请输入范围在 {0} 到 {1} 之间的数值" ), | ||
step: $.validator.format( "请输入 {0} 的整数倍值" ), | ||
max: $.validator.format( "请输入不大于 {0} 的数值" ), | ||
@@ -33,0 +34,0 @@ min: $.validator.format( "请输入不小于 {0} 的数值" ) |
@@ -5,3 +5,3 @@ { | ||
"description": "Client-side form validation made easy", | ||
"version": "1.17.0", | ||
"version": "1.18.0", | ||
"homepage": "https://jqueryvalidation.org/", | ||
@@ -34,2 +34,3 @@ "license": "MIT", | ||
"dist/additional-methods.js", | ||
"dist/additional-methods.min.js", | ||
"dist/jquery.validate.js", | ||
@@ -53,2 +54,3 @@ "dist/jquery.validate.min.js" | ||
"grunt-jscs": "2.8.0", | ||
"grunt-sri": "0.2.0", | ||
"grunt-text-replace": "0.4.0", | ||
@@ -55,0 +57,0 @@ "qunitjs": "2.3.3" |
[jQuery Validation Plugin](https://jqueryvalidation.org/) - Form validation made easy | ||
================================ | ||
[![release](https://img.shields.io/github/release/jquery-validation/jquery-validation.svg)](https://github.com/jquery-validation/jquery-validation/releases/latest) | ||
[![Build Status](https://secure.travis-ci.org/jquery-validation/jquery-validation.svg)](https://travis-ci.org/jquery-validation/jquery-validation) | ||
[![devDependency Status](https://david-dm.org/jquery-validation/jquery-validation/dev-status.svg?theme=shields.io)](https://david-dm.org/jquery-validation/jquery-validation#info=devDependencies) | ||
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/jquery-validation/badge?style=rounded)](https://www.jsdelivr.com/package/npm/jquery-validation) | ||
@@ -34,3 +36,3 @@ The jQuery Validation Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy. | ||
<script> | ||
$("form").validate(); | ||
$("form").validate(); | ||
</script> | ||
@@ -37,0 +39,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 8 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
403437
132
4932
79
13
62