mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-16 08:15:55 +10:00
Create parsley.extend.min.js
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
/* Parsley dist/parsley.extend.min.js build version 1.2.1 http://parsleyjs.org */
|
||||
window.ParsleyConfig=window.ParsleyConfig||{};
|
||||
(function(d){window.ParsleyConfig=d.extend(!0,{},window.ParsleyConfig,{validators:{minwords:function(){return{validate:function(a,b){a=a.replace(/(^\s*)|(\s*$)/gi,"");a=a.replace(/[ ]{2,}/gi," ");a=a.replace(/\n /,"\n");a=a.split(" ").length;return a>=b},priority:32}},maxwords:function(){return{validate:function(a,b){a=a.replace(/(^\s*)|(\s*$)/gi,"");a=a.replace(/[ ]{2,}/gi," ");a=a.replace(/\n /,"\n");a=a.split(" ").length;return a<=b},priority:32}},rangewords:function(){var a=this;return{validate:function(b,
|
||||
c){return a.minwords().validate(b,c[0])&&a.maxwords().validate(b,c[1])},priority:32}},greaterthan:function(){return{validate:function(a,b,c){c.options.validateIfUnchanged=!0;return new Number(a)>new Number(d(b).val())},priority:32}},lessthan:function(){return{validate:function(a,b,c){c.options.validateIfUnchanged=!0;return new Number(a)<new Number(d(b).val())},priority:32}},beforedate:function(){return{validate:function(a,b,c){return Date.parse(a)<Date.parse(d(b).val())},priority:32}},afterdate:function(){return{validate:function(a,
|
||||
b,c){return Date.parse(d(b).val())<Date.parse(a)},priority:32}},inlist:function(){return{validate:function(a,b,c){return-1!==(b+"").split(RegExp("\\s*\\"+(c.options.inlistDelimiter||",")+"\\s*")).indexOf(a.trim())},priority:32}},luhn:function(){return{validate:function(a,b,c){a=a.replace(/[ -]/g,"");var e,d,f;b=0;f=a.split("").reverse();c=e=0;for(d=f.length;e<d;c=++e)a=f[c],a=+a,c%2?(a*=2,b=10>a?b+a:b+(a-9)):b+=a;return 0===b%10},priority:32}},americandate:function(){return{validate:function(a,b,
|
||||
c){if(!/^([01]?[0-9])[\.\/-]([0-3]?[0-9])[\.\/-]([0-9]{4}|[0-9]{2})$/.test(a))return!1;c=a.split(/[.\/-]+/);a=parseInt(c[1],10);b=parseInt(c[0],10);c=parseInt(c[2],10);if(0==c||0==b||12<b)return!1;var d=[31,28,31,30,31,30,31,31,30,31,30,31];if(0==c%400||0!=c%100&&0==c%4)d[1]=29;return 0<a&&a<=d[b-1]},priority:32}}},messages:{minwords:"This value should have %s words at least.",maxwords:"This value should have %s words maximum.",rangewords:"This value should have between %s and %s words.",greaterthan:"This value should be greater than %s.",
|
||||
lessthan:"This value should be less than %s.",beforedate:"This date should be before %s.",afterdate:"This date should be after %s.",luhn:"This value should pass the luhn test.",americandate:"This value should be a valid date (MM/DD/YYYY)."}})})(window.jQuery||window.Zepto);
|
||||
Reference in New Issue
Block a user