").append(st.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,a||[e.responseText,t,e])}),this},st.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){st.fn[t]=function(e){return this.on(t,e)}}),st.each(["get","post"],function(e,n){st[n]=function(e,r,i,o){return st.isFunction(r)&&(o=o||i,i=r,r=t),st.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),st.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Dn,type:"GET",isLocal:Fn.test(jn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":In,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":st.parseJSON,"text xml":st.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?H(H(e,st.ajaxSettings),t):H(st.ajaxSettings,e)},ajaxPrefilter:D(Wn),ajaxTransport:D($n),ajax:function(e,n){function r(e,n,r,s){var l,f,v,b,T,N=n;2!==x&&(x=2,u&&clearTimeout(u),i=t,a=s||"",w.readyState=e>0?4:0,r&&(b=M(p,w,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=w.getResponseHeader("Last-Modified"),T&&(st.lastModified[o]=T),T=w.getResponseHeader("etag"),T&&(st.etag[o]=T)),304===e?(l=!0,N="notmodified"):(l=q(p,b),N=l.state,f=l.data,v=l.error,l=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),w.status=e,w.statusText=(n||N)+"",l?g.resolveWith(d,[f,N,w]):g.rejectWith(d,[w,N,v]),w.statusCode(y),y=t,c&&h.trigger(l?"ajaxSuccess":"ajaxError",[w,p,l?f:v]),m.fireWith(d,[w,N]),c&&(h.trigger("ajaxComplete",[w,p]),--st.active||st.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var i,o,a,s,u,l,c,f,p=st.ajaxSetup({},n),d=p.context||p,h=p.context&&(d.nodeType||d.jquery)?st(d):st.event,g=st.Deferred(),m=st.Callbacks("once memory"),y=p.statusCode||{},v={},b={},x=0,T="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=_n.exec(a);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=b[n]=b[n]||e,v[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)y[t]=[y[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||T;return i&&i.abort(t),r(0,t),this}};if(g.promise(w).complete=m.add,w.success=w.done,w.error=w.fail,p.url=((e||p.url||Dn)+"").replace(Mn,"").replace(Bn,jn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=st.trim(p.dataType||"*").toLowerCase().match(lt)||[""],null==p.crossDomain&&(l=Pn.exec(p.url.toLowerCase()),p.crossDomain=!(!l||l[1]===jn[1]&&l[2]===jn[2]&&(l[3]||("http:"===l[1]?80:443))==(jn[3]||("http:"===jn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=st.param(p.data,p.traditional)),L(Wn,p,n,w),2===x)return w;c=p.global,c&&0===st.active++&&st.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!On.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(Hn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=qn.test(o)?o.replace(qn,"$1_="+Ln++):o+(Hn.test(o)?"&":"?")+"_="+Ln++)),p.ifModified&&(st.lastModified[o]&&w.setRequestHeader("If-Modified-Since",st.lastModified[o]),st.etag[o]&&w.setRequestHeader("If-None-Match",st.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&w.setRequestHeader("Content-Type",p.contentType),w.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+In+"; q=0.01":""):p.accepts["*"]);for(f in p.headers)w.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(p.beforeSend.call(d,w,p)===!1||2===x))return w.abort();T="abort";for(f in{success:1,error:1,complete:1})w[f](p[f]);if(i=L($n,p,n,w)){w.readyState=1,c&&h.trigger("ajaxSend",[w,p]),p.async&&p.timeout>0&&(u=setTimeout(function(){w.abort("timeout")},p.timeout));try{x=1,i.send(v,r)}catch(N){if(!(2>x))throw N;r(-1,N)}}else r(-1,"No Transport");return w},getScript:function(e,n){return st.get(e,t,n,"script")},getJSON:function(e,t,n){return st.get(e,t,n,"json")}}),st.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return st.globalEval(e),e}}}),st.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),st.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=V.head||st("head")[0]||V.documentElement;return{send:function(t,i){n=V.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Xn=[],Un=/(=)\?(?=&|$)|\?\?/;st.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xn.pop()||st.expando+"_"+Ln++;return this[e]=!0,e}}),st.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Un.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Un.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=st.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Un,"$1"+o):n.jsonp!==!1&&(n.url+=(Hn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||st.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Xn.push(o)),s&&st.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Vn,Yn,Jn=0,Gn=e.ActiveXObject&&function(){var e;for(e in Vn)Vn[e](t,!0)};st.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&_()||F()}:_,Yn=st.ajaxSettings.xhr(),st.support.cors=!!Yn&&"withCredentials"in Yn,Yn=st.support.ajax=!!Yn,Yn&&st.ajaxTransport(function(n){if(!n.crossDomain||st.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,f,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=st.noop,Gn&&delete Vn[a]),i)4!==u.readyState&&u.abort();else{f={},s=u.status,p=u.responseXML,c=u.getAllResponseHeaders(),p&&p.documentElement&&(f.xml=p),"string"==typeof u.responseText&&(f.text=u.responseText);try{l=u.statusText}catch(d){l=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=f.text?200:404}}catch(h){i||o(-1,h)}f&&o(s,l,f,c)},n.async?4===u.readyState?setTimeout(r):(a=++Jn,Gn&&(Vn||(Vn={},st(e).unload(Gn)),Vn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Qn,Kn,Zn=/^(?:toggle|show|hide)$/,er=RegExp("^(?:([+-])=|)("+ut+")([a-z%]*)$","i"),tr=/queueHooks$/,nr=[W],rr={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=er.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(st.cssNumber[e]?"":"px"),"px"!==r&&s){s=st.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,st.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};st.Animation=st.extend(P,{tweener:function(e,t){st.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;i>r;r++)n=e[r],rr[n]=rr[n]||[],rr[n].unshift(t)},prefilter:function(e,t){t?nr.unshift(e):nr.push(e)}}),st.Tween=$,$.prototype={constructor:$,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(st.cssNumber[n]?"":"px")},cur:function(){var e=$.propHooks[this.prop];return e&&e.get?e.get(this):$.propHooks._default.get(this)},run:function(e){var t,n=$.propHooks[this.prop];return this.pos=t=this.options.duration?st.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):$.propHooks._default.set(this),this}},$.prototype.init.prototype=$.prototype,$.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=st.css(e.elem,e.prop,"auto"),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){st.fx.step[e.prop]?st.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[st.cssProps[e.prop]]||st.cssHooks[e.prop])?st.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},$.propHooks.scrollTop=$.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},st.each(["toggle","show","hide"],function(e,t){var n=st.fn[t];st.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(I(t,!0),e,r,i)}}),st.fn.extend({fadeTo:function(e,t,n,r){return this.filter(w).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=st.isEmptyObject(e),o=st.speed(t,n,r),a=function(){var t=P(this,st.extend({},e),o);a.finish=function(){t.stop(!0)},(i||st._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=st.timers,a=st._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&tr.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&st.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=st._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=st.timers,a=r?r.length:0;for(n.finish=!0,st.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),st.each({slideDown:I("show"),slideUp:I("hide"),slideToggle:I("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){st.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),st.speed=function(e,t,n){var r=e&&"object"==typeof e?st.extend({},e):{complete:n||!n&&t||st.isFunction(e)&&e,duration:e,easing:n&&t||t&&!st.isFunction(t)&&t};return r.duration=st.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in st.fx.speeds?st.fx.speeds[r.duration]:st.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){st.isFunction(r.old)&&r.old.call(this),r.queue&&st.dequeue(this,r.queue)},r},st.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},st.timers=[],st.fx=$.prototype.init,st.fx.tick=function(){var e,n=st.timers,r=0;for(Qn=st.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||st.fx.stop(),Qn=t},st.fx.timer=function(e){e()&&st.timers.push(e)&&st.fx.start()},st.fx.interval=13,st.fx.start=function(){Kn||(Kn=setInterval(st.fx.tick,st.fx.interval))},st.fx.stop=function(){clearInterval(Kn),Kn=null},st.fx.speeds={slow:600,fast:200,_default:400},st.fx.step={},st.expr&&st.expr.filters&&(st.expr.filters.animated=function(e){return st.grep(st.timers,function(t){return e===t.elem}).length}),st.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){st.offset.setOffset(this,e,t)});var n,r,i={top:0,left:0},o=this[0],a=o&&o.ownerDocument;if(a)return n=a.documentElement,st.contains(n,o)?(o.getBoundingClientRect!==t&&(i=o.getBoundingClientRect()),r=z(a),{top:i.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:i.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):i},st.offset={setOffset:function(e,t,n){var r=st.css(e,"position");"static"===r&&(e.style.position="relative");var i,o,a=st(e),s=a.offset(),u=st.css(e,"top"),l=st.css(e,"left"),c=("absolute"===r||"fixed"===r)&&st.inArray("auto",[u,l])>-1,f={},p={};c?(p=a.position(),i=p.top,o=p.left):(i=parseFloat(u)||0,o=parseFloat(l)||0),st.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(f.top=t.top-s.top+i),null!=t.left&&(f.left=t.left-s.left+o),"using"in t?t.using.call(e,f):a.css(f)}},st.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===st.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),st.nodeName(e[0],"html")||(n=e.offset()),n.top+=st.css(e[0],"borderTopWidth",!0),n.left+=st.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-st.css(r,"marginTop",!0),left:t.left-n.left-st.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||V.documentElement;e&&!st.nodeName(e,"html")&&"static"===st.css(e,"position");)e=e.offsetParent;return e||V.documentElement})}}),st.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);st.fn[e]=function(i){return st.access(this,function(e,i,o){var a=z(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?st(a).scrollLeft():o,r?o:st(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}}),st.each({Height:"height",Width:"width"},function(e,n){st.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){st.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return st.access(this,function(n,r,i){var o;return st.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?st.css(n,r,s):st.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=st,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return st})})(window);
-//@ sourceMappingURL=jquery.min.map
\ No newline at end of file
diff --git a/jquery-validate.js b/jquery-validate.js
deleted file mode 100644
index 57e5825..0000000
--- a/jquery-validate.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/* http://plugins.jquery.com/validate */
-;(function(defaults, $, window, undefined) {
-
- var
-
- type = ['input:not([type]),input[type="color"],input[type="date"],input[type="datetime"],input[type="datetime-local"],input[type="email"],input[type="file"],input[type="hidden"],input[type="month"],input[type="number"],input[type="password"],input[type="range"],input[type="search"],input[type="tel"],input[type="text"],input[type="time"],input[type="url"],input[type="week"],textarea', 'select', 'input[type="checkbox"],input[type="radio"]'],
-
- // All field types
- allTypes = type.join(','),
-
- extend = {},
-
- // Method to validate each fields
- validateField = function(event, options) {
-
- var
-
- // Field status
- status = {
- pattern : true,
- conditional : true,
- required : true
- },
-
- // Current field
- field = $(this),
-
- // Current field value
- fieldValue = field.val() || '',
-
- // An index of extend
- fieldValidate = field.data('validate'),
-
- // A validation object (jQuery.fn.validateExtend)
- validation = fieldValidate !== undefined ? extend[fieldValidate] : {},
-
- // One index or more separated for spaces to prepare the field value
- fieldPrepare = field.data('prepare') || validation.prepare,
-
- // A regular expression to validate field value
- fieldPattern = (field.data('pattern') || ($.type(validation.pattern) == 'regexp' ? validation.pattern : /(?:)/)),
-
- // Is case sensitive? (Boolean)
- fieldIgnoreCase = field.attr('data-ignore-case') || field.data('ignoreCase') || validation.ignoreCase,
-
- // A field mask
- fieldMask = field.data('mask') || validation.mask,
-
- // A index in the conditional object containing a function to validate the field value
- fieldConditional = field.data('conditional') || validation.conditional,
-
- // Is required?
- fieldRequired = field.data('required'),
-
- // The description element id
- fieldDescribedby = field.data('describedby') || validation.describedby,
-
- // An index of description object
- fieldDescription = field.data('description') || validation.description,
-
- // Trim spaces?
- fieldTrim = field.data('trim'),
-
- reTrue = /^(true|)$/i,
-
- reFalse = /^false$/i,
-
- // The description object
- fieldDescription = $.isPlainObject(fieldDescription) ? fieldDescription : (options.description[fieldDescription] || {}),
-
- name = 'validate';
-
- fieldRequired = fieldRequired != '' ? (fieldRequired || !!validation.required) : true;
-
- fieldTrim = fieldTrim != '' ? (fieldTrim || !!validation.trim) : true;
-
- // Trim spaces?
- if(reTrue.test(fieldTrim)) {
-
- fieldValue = $.trim(fieldValue);
- }
-
- // The fieldPrepare is a function?
- if($.isFunction(fieldPrepare)) {
-
- // Updates the fieldValue variable
- fieldValue = String(fieldPrepare.call(field, fieldValue));
- } else {
-
- // Is a function?
- if($.isFunction(options.prepare[fieldPrepare])) {
-
- // Updates the fieldValue variable
- fieldValue = String(options.prepare[fieldPrepare].call(field, fieldValue));
- }
- }
-
- // Is not RegExp?
- if($.type(fieldPattern) != 'regexp') {
-
- fieldIgnoreCase = !reFalse.test(fieldIgnoreCase);
-
- // Converts to RegExp
- fieldPattern = fieldIgnoreCase ? RegExp(fieldPattern, 'i') : RegExp(fieldPattern);
- }
-
- // The conditional exists?
- if(fieldConditional != undefined) {
-
- // The fieldConditional is a function?
- if($.isFunction(fieldConditional)) {
-
- status.conditional = !!fieldConditional.call(field, fieldValue, options);
- } else {
-
- var
-
- // Splits the conditionals in an array
- conditionals = fieldConditional.split(/[\s\t]+/);
-
- // Each conditional
- for(var counter = 0, len = conditionals.length; counter < len; counter++) {
-
- if(options.conditional.hasOwnProperty(conditionals[counter]) && !options.conditional[conditionals[counter]].call(field, fieldValue, options)) {
-
- status.conditional = false;
- }
- }
- }
- }
-
- fieldRequired = reTrue.test(fieldRequired);
-
- // Is required?
- if(fieldRequired) {
-
- // Verifies the field type
- if(field.is(type[0] + ',' + type[1])) {
-
- // Is empty?
- if(!fieldValue.length > 0) {
-
- status.required = false;
- }
- } else if(field.is(type[2])) {
-
- if(field.is('[name]')) {
-
- // Is checked?
- if($('[name="' + field.prop('name') + '"]:checked').length == 0) {
-
- status.required = false;
- }
- } else {
-
- status.required = field.is(':checked');
- }
- }
- }
-
- // Verifies the field type
- if(field.is(type[0])) {
-
- // Test the field value pattern
- if(fieldPattern.test(fieldValue)) {
-
- // If the event type is not equals to keyup
- if(event.type != 'keyup' && fieldMask !== undefined) {
-
- var matches = fieldValue.match(fieldPattern);
-
- // Each characters group
- for(var i = 0, len = matches.length; i < len; i++) {
-
- // Replace the groups
- fieldMask = fieldMask.replace(RegExp('\\$\\{' + i + '(?::`([^`]*)`)?\\}', 'g'), (matches[i] !== undefined ? matches[i] : '$1'));
- }
-
- fieldMask = fieldMask.replace(/\$\{\d+(?::`([^`]*)`)?\}/g, '$1');
-
- // Test the field value pattern
- if(fieldPattern.test(fieldMask)) {
-
- // Update the field value
- field.val(fieldMask);
- }
- }
- } else {
-
- // If the field is required
- if(fieldRequired) {
-
- status.pattern = false;
- } else {
-
- if(fieldValue.length > 0) {
-
- status.pattern = false;
- }
- }
- }
- }
-
- var
-
- describedby = $('[id="' + fieldDescribedby +'"]'),
-
- log = fieldDescription.valid;
-
- if(describedby.length > 0 && event.type != 'keyup') {
-
- if(!status.required) {
-
- log = fieldDescription.required;
- } else if(!status.pattern) {
-
- log = fieldDescription.pattern;
- } else if(!status.conditional) {
-
- log = fieldDescription.conditional;
- }
-
- describedby.html(log || '');
- }
-
- if(typeof(validation.each) == 'function') {
-
- validation.each.call(field, event, status, options);
- }
-
- // Call the eachField callback
- options.eachField.call(field, event, status, options);
-
- // If the field is valid
- if(status.required && status.pattern && status.conditional) {
-
- // If WAI-ARIA is enabled
- if(!!options.waiAria) {
-
- field.prop('aria-invalid', false);
- }
-
- if(typeof(validation.valid) == 'function') {
-
- validation.valid.call(field, event, status, options);
- }
-
- // Call the eachValidField callback
- options.eachValidField.call(field, event, status, options);
- } else {
-
- // If WAI-ARIA is enabled
- if(!!options.waiAria) {
-
- field.prop('aria-invalid', true);
- }
-
- if(typeof(validation.invalid) == 'function') {
-
- validation.invalid.call(field, event, status, options);
- }
-
- // Call the eachInvalidField callback
- options.eachInvalidField.call(field, event, status, options);
- }
-
- // Returns the field status
- return status;
- };
-
- $.extend({
-
- // Method to extends validations
- validateExtend : function(options) {
-
- return $.extend(extend, options);
- },
-
- // Method to change the default properties of jQuery.fn.validate method
- validateSetup : function(options) {
-
- return $.extend(defaults, options);
- }
- }).fn.extend({
-
- // Method to validate forms
- validate : function(options) {
-
- options = $.extend({}, defaults, options);
-
- return $(this).validateDestroy().each(function() {
-
- var form = $(this);
-
- // This is a form?
- if(form.is('form')) {
-
- form.data(name, {
- options : options
- });
-
- var
-
- fields = form.find(allTypes),
-
- // Events namespace
- namespace = options.namespace;
-
- if(form.is('[id]')) {
-
- fields = fields.add('[form="' + form.prop('id') + '"]').filter(allTypes);
- }
-
- fields = fields.filter(options.filter);
-
- // If onKeyup is enabled
- if(!!options.onKeyup) {
-
- fields.filter(type[0]).on('keyup.' + namespace, function(event) {
-
- validateField.call(this, event, options);
- });
- }
-
- // If onBlur is enabled
- if(!!options.onBlur) {
-
- fields.on('blur.' + namespace, function(event) {
-
- validateField.call(this, event, options);
- });
- }
-
- // If onChange is enabled
- if(!!options.onChange) {
-
- fields.on('change.' + namespace, function(event) {
-
- validateField.call(this, event, options);
- });
- }
-
- // If onSubmit is enabled
- if(!!options.onSubmit) {
-
- form.on('submit.' + namespace, function(event) {
-
- var formValid = true;
-
- fields.each(function() {
-
- var status = validateField.call(this, event, options);
-
- if(!status.pattern || !status.conditional || !status.required) {
-
- formValid = false;
- }
- });
-
- // If form is valid
- if(formValid) {
-
- // Send form?
- if(!options.sendForm) {
-
- event.preventDefault();
- }
-
- // Is a function?
- if($.isFunction(options.valid)) {
-
- options.valid.call(form, event, options);
- }
- } else {
-
- event.preventDefault();
-
- // Is a function?
- if($.isFunction(options.invalid)) {
-
- options.invalid.call(form, event, options);
- }
- }
- });
- }
- }
- });
- },
-
- // Method to destroy validations
- validateDestroy : function() {
-
- var
-
- form = $(this),
-
- dataValidate = form.data(name);
-
- // If this is a form
- if(form.is('form') && $.isPlainObject(dataValidate) && typeof(dataValidate.options.nameSpace) == 'string') {
-
- var fields = form.removeData(name).find(allTypes).add(form);
-
- if(form.is('[id]')) {
-
- fields = fields.add($('[form="' + form.prop('id') + '"]').filter(allTypes));
- }
-
- fields.off('.' + dataValidate.options.nameSpace);
- }
-
- return form;
- }
- });
-})({
-
- // Send form if is valid?
- sendForm : true,
-
- // Use WAI-ARIA properties
- waiAria : true,
-
- // Validate on submit?
- onSubmit : true,
-
- // Validate on onKeyup?
- onKeyup : false,
-
- // Validate on onBlur?
- onBlur : false,
-
- // Validate on onChange?
- onChange : false,
-
- // Default namespace
- nameSpace : 'validate',
-
- // Conditional functions
- conditional : {},
-
- // Prepare functions
- prepare : {},
-
- // Fields descriptions
- description : {},
-
- // Callback
- eachField : $.noop,
-
- // Callback
- eachInvalidField : $.noop,
-
- // Callback
- eachValidField : $.noop,
-
- // Callback
- invalid : $.noop,
-
- // Callback
- valid : $.noop,
-
- // A fielter to the fields
- filter : '*'
-}, jQuery, window);
\ No newline at end of file
diff --git a/jquery-validate.min.js b/jquery-validate.min.js
deleted file mode 100644
index bfa843d..0000000
--- a/jquery-validate.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/* http://plugins.jquery.com/validate */
-;(function(a,b,c,d){var e=['input:not([type]),input[type="color"],input[type="date"],input[type="datetime"],input[type="datetime-local"],input[type="email"],input[type="file"],input[type="hidden"],input[type="month"],input[type="number"],input[type="password"],input[type="range"],input[type="search"],input[type="tel"],input[type="text"],input[type="time"],input[type="url"],input[type="week"],textarea',"select",'input[type="checkbox"],input[type="radio"]'],f=e.join(","),g={},h=function(a,c){var f={pattern:!0,conditional:!0,required:!0},h=b(this),i=h.val()||"",j=h.data("validate"),k=j!==d?g[j]:{},l=h.data("prepare")||k.prepare,m=h.data("pattern")||("regexp"==b.type(k.pattern)?k.pattern:/(?:)/),n=h.attr("data-ignore-case")||h.data("ignoreCase")||k.ignoreCase,o=h.data("mask")||k.mask,p=h.data("conditional")||k.conditional,q=h.data("required"),r=h.data("describedby")||k.describedby,s=h.data("description")||k.description,t=h.data("trim"),u=/^(true|)$/i,v=/^false$/i,s=b.isPlainObject(s)?s:c.description[s]||{};if(q=""!=q?q||!!k.required:!0,t=""!=t?t||!!k.trim:!0,u.test(t)&&(i=b.trim(i)),b.isFunction(l)?i=l.call(h,i)+"":b.isFunction(c.prepare[l])&&(i=c.prepare[l].call(h,i)+""),"regexp"!=b.type(m)&&(n=!v.test(n),m=n?RegExp(m,"i"):RegExp(m)),p!=d)if(b.isFunction(p))f.conditional=!!p.call(h,i,c);else for(var x=p.split(/[\s\t]+/),y=0,z=x.length;z>y;y++)c.conditional.hasOwnProperty(x[y])&&!c.conditional[x[y]].call(h,i,c)&&(f.conditional=!1);if(q=u.test(q),q&&(h.is(e[0]+","+e[1])?!i.length>0&&(f.required=!1):h.is(e[2])&&(h.is("[name]")?0==b('[name="'+h.prop("name")+'"]:checked').length&&(f.required=!1):f.required=h.is(":checked"))),h.is(e[0]))if(m.test(i)){if("keyup"!=a.type&&o!==d){for(var A=i.match(m),B=0,z=A.length;z>B;B++)o=o.replace(RegExp("\\$\\{"+B+"(?::`([^`]*)`)?\\}","g"),A[B]!==d?A[B]:"$1");o=o.replace(/\$\{\d+(?::`([^`]*)`)?\}/g,"$1"),m.test(o)&&h.val(o)}}else q?f.pattern=!1:i.length>0&&(f.pattern=!1);var C=b('[id="'+r+'"]'),D=s.valid;return C.length>0&&"keyup"!=a.type&&(f.required?f.pattern?f.conditional||(D=s.conditional):D=s.pattern:D=s.required,C.html(D||"")),"function"==typeof k.each&&k.each.call(h,a,f,c),c.eachField.call(h,a,f,c),f.required&&f.pattern&&f.conditional?(c.waiAria&&h.prop("aria-invalid",!1),"function"==typeof k.valid&&k.valid.call(h,a,f,c),c.eachValidField.call(h,a,f,c)):(c.waiAria&&h.prop("aria-invalid",!0),"function"==typeof k.invalid&&k.invalid.call(h,a,f,c),c.eachInvalidField.call(h,a,f,c)),f};b.extend({validateExtend:function(a){return b.extend(g,a)},validateSetup:function(c){return b.extend(a,c)}}).fn.extend({validate:function(c){return c=b.extend({},a,c),b(this).validateDestroy().each(function(){var a=b(this);if(a.is("form")){a.data(name,{options:c});var d=a.find(f),g=c.namespace;a.is("[id]")&&(d=d.add('[form="'+a.prop("id")+'"]').filter(f)),d=d.filter(c.filter),c.onKeyup&&d.filter(e[0]).on("keyup."+g,function(a){h.call(this,a,c)}),c.onBlur&&d.on("blur."+g,function(a){h.call(this,a,c)}),c.onChange&&d.on("change."+g,function(a){h.call(this,a,c)}),c.onSubmit&&a.on("submit."+g,function(e){var f=!0;d.each(function(){var a=h.call(this,e,c);a.pattern&&a.conditional&&a.required||(f=!1)}),f?(c.sendForm||e.preventDefault(),b.isFunction(c.valid)&&c.valid.call(a,e,c)):(e.preventDefault(),b.isFunction(c.invalid)&&c.invalid.call(a,e,c))})}})},validateDestroy:function(){var a=b(this),c=a.data(name);if(a.is("form")&&b.isPlainObject(c)&&"string"==typeof c.options.nameSpace){var d=a.removeData(name).find(f).add(a);a.is("[id]")&&(d=d.add(b('[form="'+a.prop("id")+'"]').filter(f))),d.off("."+c.options.nameSpace)}return a}})})({sendForm:!0,waiAria:!0,onSubmit:!0,onKeyup:!1,onBlur:!1,onChange:!1,nameSpace:"validate",conditional:{},prepare:{},description:{},eachField:$.noop,eachInvalidField:$.noop,eachValidField:$.noop,invalid:$.noop,valid:$.noop,filter:"*"},jQuery,window);
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100755
index 0000000..e102b99
--- /dev/null
+++ b/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "validate",
+ "version": "2.0.0",
+ "title": "jQuery Validate",
+ "dependencies": {
+ "grunt": "~0.4.0",
+ "grunt-contrib-uglify": "~0.1.2",
+ "grunt-contrib-watch": "~0.3.1"
+ },
+ "engines": {
+ "node": "0.8.x"
+ },
+ "devDependencies": {
+ "grunt": "~0.4.1",
+ "grunt-contrib-jshint": "~0.4.0",
+ "grunt-contrib-qunit": "~0.2.2"
+ }
+}
diff --git a/validate.jquery.json b/validate.jquery.json
old mode 100644
new mode 100755
index 5076e0a..ff806cd
--- a/validate.jquery.json
+++ b/validate.jquery.json
@@ -1,43 +1,31 @@
{
- "name": "validate",
- "title": "jQuery Validate",
- "description": "The jQuery Validate is an advanced plugin for an easily and quickly form validation.",
- "keywords": [
- "jquery",
- "validate",
- "validation",
- "form",
- "data",
- "input",
- "field",
- "mask",
- "pattern",
- "required",
- "conditional"
- ],
- "version": "1.1.2",
- "author": {
- "name": "Diego Lopes Lima",
+ "name" : "validate",
+ "title" : "jQuery Validate",
+ "description" : "The jQuery Validate is an advanced plugin for an easily and quickly form validation using data attributes.",
+ "keywords" : ["jquery", "form", "input", "validate", "validation", "data", "attributes", "mask"],
+ "version" : "2.0.0",
+ "author" : {
+ "name" : "Diego Lopes Lima",
"email" : "contact.diego.lima@gmail.com",
- "url": "https://github.com/DiegoLopesLima"
+ "url" : "https://github.com/DiegoLopesLima"
},
- "maintainers": [
+ "maintainers" : [
{
- "name": "Diego Lopes Lima",
- "email": "contact.diego.lima@gmail.com",
- "url": "https://github.com/DiegoLopesLima"
+ "name" : "Diego Lopes Lima",
+ "email" : "contact.diego.lima@gmail.com",
+ "url" : "https://github.com/DiegoLopesLima"
}
],
"licenses": [
{
- "type": "MIT",
- "url": "http://www.opensource.org/licenses/mit-license.php"
+ "type" : "CC BY 3.0",
+ "url" : "http://creativecommons.org/licenses/by/3.0/"
}
],
- "bugs": "https://github.com/DiegoLopesLima/Validate/issues",
- "docs": "https://github.com/DiegoLopesLima/Validate#readme",
- "download": "https://www.dropbox.com/s/p5xhpb52572xy5b/jQuery%20Validate%201.1.2.zip",
- "dependencies": {
- "jquery": ">=1.7"
+ "bugs" : "https://github.com/DiegoLopesLima/Validate/issues",
+ "docs" : "https://github.com/DiegoLopesLima/Validate#readme",
+ "download" : "https://github.com/DiegoLopesLima/Validate/archive/master.zip",
+ "dependencies" : {
+ "jquery" : ">=1.7"
}
-}
\ No newline at end of file
+}
diff --git a/validate.js b/validate.js
new file mode 100755
index 0000000..61aa909
--- /dev/null
+++ b/validate.js
@@ -0,0 +1,598 @@
+(function($, undefined) {
+
+ 'use strict';
+
+ var
+
+ // Plugin name.
+ name = 'validate',
+
+ // Writable fields.
+ writable = 'input[type=color],input[type=date],input[type=datetime],input[type=datetime-local],input[type=email],input[type=file],input[type=hidden],input[type=month],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],textarea,select,input:not([type])',
+
+ // Checkable fields.
+ checkable = 'input[type=checkbox],input[type=radio]',
+
+ // All field types.
+ fieldTypes = checkable + ',' + writable,
+
+ errorIsNotAForm = 'This is not a form.',
+
+ emptyArray = [],
+
+ isFunction = $.isFunction,
+
+ // Default properties.
+ defaults = {
+ events : emptyArray,
+ filter : '*',
+ ajax : false,
+ send : true,
+ selectInvalid : true,
+ scroll : true,
+ clearInvalid : false,
+ conditional : {},
+ prepare : {},
+ description : {}
+ },
+
+ // A function to get a boolean value.
+ getBoolean = function(value) {
+
+ return (/^(true|)$/).test(value);
+
+ },
+
+ // A function to get an array.
+ getArray = function(value) {
+
+ return typeof value == 'string' ? value.split(/[\s\uFEFF\xA0]+/) : ($.isArray(value) ? value : []);
+
+ },
+
+ // Default validations.
+ validate = {},
+
+ // Attribute hooks.
+ attributes = {
+ chars : function(value) {
+
+ return typeof value == 'string' ? new RegExp('[' + value.replace(/([\[\]])/g, '\\$1') + ']') : /./;
+
+ },
+ conditional : function(value) {
+
+ return isFunction(value) ? value : getArray(value);
+
+ },
+ confirm : function(value) {
+
+ return typeof value == 'string' ? $(fieldTypes).filter('#' + value).val() || '' : undefined;
+
+ },
+ ignorecase : function(value) {
+
+ return getBoolean(value) ? 'i' : undefined;
+
+ },
+ mask : function(value) {
+
+ return typeof value == 'string' ? value : undefined;
+
+ },
+ maxlength : function(value) {
+
+ return Math.round(value) || Infinity;
+
+ },
+ minlength : function(value) {
+
+ return Math.round(value) || 0;
+
+ },
+ pattern : function(value) {
+
+ return (/^(regexp|string)$/).test($.type(value)) ? value : /(?:)/;
+
+ },
+ prepare : function(value) {
+
+ return isFunction(value) ? value : getArray(value);
+
+ }
+ },
+
+ // A function to get an attribute.
+ getFieldAttribute = function(target, attribute) {
+
+ target = $(target);
+
+ var
+
+ response = target.data(attribute);
+
+ if(response === undefined && /^(trim|required|m(in|ax)length|prepare|conditional|ignorecase|validate|description|chars)$/.test(attribute)) {
+
+ var
+
+ parent = target.parents('*').filter(function() {
+
+ return $(this).data(attribute) !== undefined;
+
+ }).filter(':first');
+
+ if(parent.length > 0) response = parent.data(attribute);
+
+ }
+
+ if(response === undefined && typeof target.data('validate') == 'string') response = (validate[target.data('validate')] || {})[attribute];
+
+ if(isFunction(attributes[attribute])) return attributes[attribute].call(target, response);
+
+ return response;
+
+ },
+
+ // A function to return events with namespaces.
+ namespace = function(events) {
+
+ return events.replace(/(\s|$)/g, '.' + name + '$1');
+
+ },
+
+ // A function to validate a field.
+ validateField = function(event, bool) {
+
+ var
+
+ field = $(this),
+
+ form = $(field.prop('form')),
+
+ options = form.data(name),
+
+ response = {
+ valid : true,
+ status : {
+ required : true,
+ minlength : true,
+ maxlength : true,
+ pattern : true,
+ confirm : true,
+ conditional : true
+ }
+ },
+
+ minlength = getFieldAttribute(field, 'minlength'),
+
+ maxlength = getFieldAttribute(field, 'maxlength'),
+
+ pattern = getFieldAttribute(field, 'pattern'),
+
+ prepare = getFieldAttribute(field, 'prepare'),
+
+ conditional = getFieldAttribute(field, 'conditional'),
+
+ mask = getFieldAttribute(field, 'mask'),
+
+ value = field.val() || '',
+
+ filled = false;
+
+ if(getBoolean(getFieldAttribute(field, 'trim'))) value = $.trim(value);
+
+ if(isFunction(options.prepareAll)) value = String(options.prepareAll.call(field, value));
+
+ if(isFunction(prepare)) {
+
+ value = String(prepare.call(field, value));
+
+ } else if(prepare.length > 0) for(var currentPrepare = 0, prepareLength = prepare.length; currentPrepare < prepareLength; currentPrepare++) if(isFunction(options.prepare[prepare[currentPrepare]])) value = String(options.prepare[prepare[currentPrepare]].call(field, value));
+
+ pattern = new RegExp($.type(pattern) == 'regexp' ? pattern.source : pattern, getFieldAttribute(field, 'ignorecase'));
+
+ if(field.is(writable)) {
+
+ filled = value.length > 0;
+
+ response.status.minlength = value.length >= minlength;
+
+ response.status.maxlength = value.length <= maxlength;
+
+ } else if(field.prop('name')) {
+
+ var
+
+ checked = $('[name="' + field.prop('name') + '"]:checked');
+
+ filled = checked.length > 0;
+
+ response.status.minlength = checked.length >= minlength;
+
+ response.status.maxlength = checked.length <= maxlength;
+
+ }
+
+ if(getBoolean(getFieldAttribute(field, 'required'))) {
+
+ response.status.required = filled;
+
+ response.status.pattern = pattern.test(value);
+
+ } else if(filled) response.status.pattern = pattern.test(value);
+
+ if(!bool && event && event.type != 'keyup' && response.status.pattern && mask !== undefined) {
+
+ var
+
+ parts = value.match(pattern) || emptyArray,
+
+ newValue = mask;
+
+ for(var currentPart = 0, partLength = parts.length; currentPart < partLength; currentPart++) newValue = newValue.replace(new RegExp('(^|[^\\\\])\\$\\{' + currentPart + '(?::`([^`]*)`)?\\}'), parts[currentPart] ? '$1' + parts[currentPart].replace(/\$/g, '$$') : '$1$2');
+
+ newValue = newValue.replace(/(?:^|[^\\])\$\{\d+(?::`([^`]*)`)?\}/g, '$1');
+
+ if(pattern.test(newValue)) field.val(newValue);
+
+ }
+
+ if(isFunction(conditional)) {
+
+ response.status.conditional = !!conditional.call(field, value);
+
+ } else if(conditional.length > 0) {
+
+ for(var currentConditional = 0, conditionalLength = conditional.length; currentConditional < conditionalLength; currentConditional++) {
+
+ var
+
+ conditionalName = conditional[currentConditional];
+
+ if(isFunction(options.conditional[conditionalName])) response.status.conditional = !!options.conditional[conditionalName].call(field, value);
+
+ }
+
+ }
+
+ if(getFieldAttribute(field, 'confirm') !== undefined) response.status.confirm = getFieldAttribute(field, 'confirm') === value;
+
+ for(var currentStatus in response.status) {
+
+ if(!response.status[currentStatus]) {
+
+ response.valid = false;
+
+ break;
+
+ }
+
+ }
+
+ var
+
+ target = field.prop('id').length > 0 ? $('[data-describe="' + field.prop('id') + '"]') : emptyArray,
+
+ description = options.description || {},
+
+ custom = description.custom || {};
+
+ if(target.length) {
+
+ $.extend(description, custom[getFieldAttribute(field, 'description')]);
+
+ status.message = description[currentStatus];
+
+ status.message = String(isFunction(status.message) ? status.message.call(field, value) : status.message);
+
+ target.html(status.message);
+
+ }
+
+ if(!bool) {
+
+ field.attr('aria-invalid', !response.valid);
+
+ if(response.valid) {
+
+ if(isFunction(options.eachValid)) options.eachValid.call(field, value, response);
+
+ field.triggerHandler('valid');
+
+ } else {
+
+ if(options.clearInvalid) field.val('');
+
+ if(isFunction(options.eachInvalid)) options.eachInvalid.call(field, value, response);
+
+ field.triggerHandler('invalid');
+
+ }
+
+ if(isFunction(options.eachField)) options.eachField.call(field, value, response);
+
+ field.triggerHandler('validated');
+
+ return response;
+
+ } else return response.valid;
+
+ },
+
+ // A function to validate a form.
+ validateForm = function(event, bool) {
+
+ if(!event) event = new Event('validate');
+
+ var
+
+ form = $(this),
+
+ options = form.data(name),
+
+ fields = form.find(fieldTypes),
+
+ valid = true,
+
+ first = true;
+
+ if(form.prop('id').length > 0) fields = fields.add($(fieldTypes).filter('[form="' + form.prop('id') + '"]'));
+
+ fields.filter(options.filter).each(function() {
+
+ if(!(bool ? validateField.call(this, event, bool) : validateField.call(this, event).valid)) {
+
+ valid = false;
+
+ var
+
+ field = $(this);
+
+ if(first) {
+
+ if(!bool) {
+
+ if(options.selectInvalid) field.trigger('select');
+
+ if(options.scroll && field.is(':visible')) {
+
+ var
+
+ top = Math.floor((field.offset().top + (field.height() / 2)) - ($(window).height() / 2));
+
+ top = top < 0 ? 0 : top;
+
+ if($(window).scrollTop() !== top) {
+
+ $('body,html').animate({
+ scrollTop : top
+ }, $.extend({}, options.scroll));
+
+ }
+
+ }
+
+ }
+
+ first = false;
+
+ }
+
+ }
+
+ });
+
+ if(bool) return valid;
+
+ if(valid) {
+
+ if(!options.send || options.ajax) event.preventDefault();
+
+ var
+
+ ajaxResponse = options.ajax ? $.ajax($.extend({
+ url : form.prop('action'),
+ type : form.prop('method'),
+ data : form.serialize()
+ }, options.ajax)) : undefined;
+
+ if(isFunction(options.valid)) options.valid.call(form, ajaxResponse);
+
+ form.triggerHandler('valid', [ajaxResponse]);
+
+ } else {
+
+ event.preventDefault();
+
+ event.stopImmediatePropagation();
+
+ if(isFunction(options.invalid)) options.invalid.call(form);
+
+ form.triggerHandler('invalid');
+
+ }
+
+ if(isFunction(options.validated)) options.validated.call(form);
+
+ form.triggerHandler('validated');
+
+ },
+
+ // A function to extend an object.
+ extend = function(target, index, value) {
+
+ if(typeof index == 'string') {
+
+ if(value !== undefined) {
+
+ target[index] = value;
+
+ } else return target[index];
+
+ } else if($.isPlainObject(index)) return $.extend(target, index);
+
+ return target;
+
+ },
+
+ plugin = {
+ init : function() {
+
+ var
+
+ element = $(this);
+
+ if(element.is('form')) {
+
+ var
+
+ options = element.data(name),
+
+ fields = element.find(fieldTypes);
+
+ if(element.prop('id').length > 0) fields = fields.add($(fieldTypes).filter('[form="' + element.prop('id') + '"]'));
+
+ element.on(namespace('submit'), function(event) {
+
+ validateForm.call(this, event);
+
+ });
+
+ fields.filter(options.filter).on(namespace('keyup blur change'), function(event) {
+
+ if($.inArray(event.type, getArray(options.events)) > -1) validateField.call(this, event);
+
+ }).on(namespace('keypress'), function(event) {
+
+ var
+
+ keyCodeChar = String.fromCharCode(event.keyCode);
+
+ if(!getFieldAttribute(this, 'chars').test(keyCodeChar) && keyCodeChar !== '') {
+
+ event.preventDefault();
+
+ event.stopImmediatePropagation();
+
+ }
+
+ });
+
+ } else $.error(errorIsNotAForm);
+
+ },
+ destroy : function() {
+
+ var
+
+ form = $(this);
+
+ if(form.is('form')) {
+
+ var
+
+ fields = form.find(fieldTypes);
+
+ if(form.prop('id').length > 0) fields = fields.add($(fieldTypes).filter('[form="' + form.prop('id') + '"]'));
+
+ form.add(fields).off('.' + name).removeData(name);
+
+ return form;
+
+ } else $.error(errorIsNotAForm);
+
+ },
+ isvalid : function() {
+
+ var
+
+ valid = true;
+
+ $(this).each(function() {
+
+ var
+
+ element = $(this);
+
+ if(element.is('form')) {
+
+ if(!validateForm.call(element, null, true)) {
+
+ valid = false;
+
+ return false;
+
+ }
+
+ } else if(element.is(fieldTypes)) {
+
+ if(!validateField.call(element, null, true)) {
+
+ valid = false;
+
+ return false;
+
+ }
+
+ }
+
+ });
+
+ return valid;
+
+ },
+ trigger : function() {
+
+ return $(this).each(function() {
+
+ if($(this).is('form')) {
+
+ validateForm.call(this, null);
+
+ } else if($(this).is(fieldTypes)) validateField.call(this, null);
+
+ });
+
+ },
+ option : function(index, value) {
+
+ var
+
+ data = $(this).data(name),
+
+ response = extend(data, index, value);
+
+ return value !== undefined ? $(this).data(name, data) : response;
+
+ }
+ };
+
+ $.fn[name] = function(options) {
+
+ return isFunction(plugin[options]) ? plugin[options].apply(this, emptyArray.slice.call(arguments, 1)) : $(this).each(function() {
+
+ plugin.init.call(plugin.destroy.call(this).data(name, $.extend({}, defaults, options)));
+
+ });
+
+ };
+
+ $[name] = $.extend(function(index, value) {
+
+ return extend(defaults, index, value);
+
+ }, {
+ add : function(index, value) {
+
+ return extend(validate, index, value);
+
+ },
+ extend : function(index, value) {
+
+ return extend(plugin, index, value);
+
+ },
+ version : '2.0.0'
+ });
+
+})(jQuery);
diff --git a/validate.min.js b/validate.min.js
new file mode 100755
index 0000000..5f68fc2
--- /dev/null
+++ b/validate.min.js
@@ -0,0 +1,2 @@
+/*! jQuery Validate 2.0.0 | http://plugins.jquery.com/validate/2.0.0 */
+;(function(t,e){"use strict";var i="validate",n="input[type=color],input[type=date],input[type=datetime],input[type=datetime-local],input[type=email],input[type=file],input[type=hidden],input[type=month],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],textarea,select,input:not([type])",a="input[type=checkbox],input[type=radio]",r=a+","+n,l="This is not a form.",s=[],o=t.isFunction,p={events:s,filter:"*",ajax:!1,send:!0,selectInvalid:!0,scroll:!0,clearInvalid:!1,conditional:{},prepare:{},description:{}},u=function(t){return/^(true|)$/.test(t)},d=function(e){return"string"==typeof e?e.split(/[\s\uFEFF\xA0]+/):t.isArray(e)?e:[]},c={},f={chars:function(t){return"string"==typeof t?RegExp("["+t.replace(/([\[\]])/g,"\\$1")+"]"):/./},conditional:function(t){return o(t)?t:d(t)},confirm:function(i){return"string"==typeof i?t(r).filter("#"+i).val()||"":e},ignorecase:function(t){return u(t)?"i":e},mask:function(t){return"string"==typeof t?t:e},maxlength:function(t){return Math.round(t)||1/0},minlength:function(t){return Math.round(t)||0},pattern:function(e){return/^(regexp|string)$/.test(t.type(e))?e:/(?:)/},prepare:function(t){return o(t)?t:d(t)}},h=function(i,n){i=t(i);var a=i.data(n);if(a===e&&/^(trim|required|m(in|ax)length|prepare|conditional|ignorecase|validate|description|chars)$/.test(n)){var r=i.parents("*").filter(function(){return t(this).data(n)!==e}).filter(":first");r.length>0&&(a=r.data(n))}return a===e&&"string"==typeof i.data("validate")&&(a=(c[i.data("validate")]||{})[n]),o(f[n])?f[n].call(i,a):a},g=function(t){return t.replace(/(\s|$)/g,"."+i+"$1")},v=function(a,r){var l=t(this),p=t(l.prop("form")),d=p.data(i),c={valid:!0,status:{required:!0,minlength:!0,maxlength:!0,pattern:!0,confirm:!0,conditional:!0}},f=h(l,"minlength"),g=h(l,"maxlength"),v=h(l,"pattern"),m=h(l,"prepare"),y=h(l,"conditional"),x=h(l,"mask"),$=l.val()||"",k=!1;if(u(h(l,"trim"))&&($=t.trim($)),o(d.prepareAll)&&($=d.prepareAll.call(l,$)+""),o(m))$=m.call(l,$)+"";else if(m.length>0)for(var b=0,I=m.length;I>b;b++)o(d.prepare[m[b]])&&($=d.prepare[m[b]].call(l,$)+"");if(v=RegExp("regexp"==t.type(v)?v.source:v,h(l,"ignorecase")),l.is(n))k=$.length>0,c.status.minlength=$.length>=f,c.status.maxlength=g>=$.length;else if(l.prop("name")){var j=t('[name="'+l.prop("name")+'"]:checked');k=j.length>0,c.status.minlength=j.length>=f,c.status.maxlength=g>=j.length}if(u(h(l,"required"))?(c.status.required=k,c.status.pattern=v.test($)):k&&(c.status.pattern=v.test($)),!r&&a&&"keyup"!=a.type&&c.status.pattern&&x!==e){for(var w=$.match(v)||s,F=x,H=0,A=w.length;A>H;H++)F=F.replace(RegExp("(^|[^\\\\])\\$\\{"+H+"(?::`([^`]*)`)?\\}"),w[H]?"$1"+w[H].replace(/\$/g,"$$"):"$1$2");F=F.replace(/(?:^|[^\\])\$\{\d+(?::`([^`]*)`)?\}/g,"$1"),v.test(F)&&l.val(F)}if(o(y))c.status.conditional=!!y.call(l,$);else if(y.length>0)for(var E=0,q=y.length;q>E;E++){var D=y[E];o(d.conditional[D])&&(c.status.conditional=!!d.conditional[D].call(l,$))}h(l,"confirm")!==e&&(c.status.confirm=h(l,"confirm")===$);for(var C in c.status)if(!c.status[C]){c.valid=!1;break}var M=l.prop("id").length>0?t('[data-describe="'+l.prop("id")+'"]'):s,P=d.description||{},R=P.custom||{};return M.length&&(t.extend(P,R[h(l,"description")]),status.message=P[C],status.message=(o(status.message)?status.message.call(l,$):status.message)+"",M.html(status.message)),r?c.valid:(l.attr("aria-invalid",!c.valid),c.valid?(o(d.eachValid)&&d.eachValid.call(l,$,c),l.triggerHandler("valid")):(d.clearInvalid&&l.val(""),o(d.eachInvalid)&&d.eachInvalid.call(l,$,c),l.triggerHandler("invalid")),o(d.eachField)&&d.eachField.call(l,$,c),l.triggerHandler("validated"),c)},m=function(n,a){n||(n=new Event("validate"));var l=t(this),s=l.data(i),p=l.find(r),u=!0,d=!0;if(l.prop("id").length>0&&(p=p.add(t(r).filter('[form="'+l.prop("id")+'"]'))),p.filter(s.filter).each(function(){if(!(a?v.call(this,n,a):v.call(this,n).valid)){u=!1;var e=t(this);if(d){if(!a&&(s.selectInvalid&&e.trigger("select"),s.scroll&&e.is(":visible"))){var i=Math.floor(e.offset().top+e.height()/2-t(window).height()/2);i=0>i?0:i,t(window).scrollTop()!==i&&t("body,html").animate({scrollTop:i},t.extend({},s.scroll))}d=!1}}}),a)return u;if(u){(!s.send||s.ajax)&&n.preventDefault();var c=s.ajax?t.ajax(t.extend({url:l.prop("action"),type:l.prop("method"),data:l.serialize()},s.ajax)):e;o(s.valid)&&s.valid.call(l,c),l.triggerHandler("valid",[c])}else n.preventDefault(),n.stopImmediatePropagation(),o(s.invalid)&&s.invalid.call(l),l.triggerHandler("invalid");o(s.validated)&&s.validated.call(l),l.triggerHandler("validated")},y=function(i,n,a){if("string"==typeof n){if(a===e)return i[n];i[n]=a}else if(t.isPlainObject(n))return t.extend(i,n);return i},x={init:function(){var e=t(this);if(e.is("form")){var n=e.data(i),a=e.find(r);e.prop("id").length>0&&(a=a.add(t(r).filter('[form="'+e.prop("id")+'"]'))),e.on(g("submit"),function(t){m.call(this,t)}),a.filter(n.filter).on(g("keyup blur change"),function(e){t.inArray(e.type,d(n.events))>-1&&v.call(this,e)}).on(g("keypress"),function(t){var e=String.fromCharCode(t.keyCode);h(this,"chars").test(e)||""===e||(t.preventDefault(),t.stopImmediatePropagation())})}else t.error(l)},destroy:function(){var e=t(this);if(e.is("form")){var n=e.find(r);return e.prop("id").length>0&&(n=n.add(t(r).filter('[form="'+e.prop("id")+'"]'))),e.add(n).off("."+i).removeData(i),e}t.error(l)},isvalid:function(){var e=!0;return t(this).each(function(){var i=t(this);if(i.is("form")){if(!m.call(i,null,!0))return e=!1,!1}else if(i.is(r)&&!v.call(i,null,!0))return e=!1,!1}),e},trigger:function(){return t(this).each(function(){t(this).is("form")?m.call(this,null):t(this).is(r)&&v.call(this,null)})},option:function(n,a){var r=t(this).data(i),l=y(r,n,a);return a!==e?t(this).data(i,r):l}};t.fn[i]=function(e){return o(x[e])?x[e].apply(this,s.slice.call(arguments,1)):t(this).each(function(){x.init.call(x.destroy.call(this).data(i,t.extend({},p,e)))})},t[i]=t.extend(function(t,e){return y(p,t,e)},{add:function(t,e){return y(c,t,e)},extend:function(t,e){return y(x,t,e)},version:"2.0.0"})})(jQuery);
\ No newline at end of file
diff --git a/validate.sublime-snippet b/validate.sublime-snippet
new file mode 100644
index 0000000..bb921a8
--- /dev/null
+++ b/validate.sublime-snippet
@@ -0,0 +1,24 @@
+
+
+
+
+
+ vl
+
+ source.js
+
+ jQuery Validate
+
diff --git a/validate.test.html b/validate.test.html
new file mode 100755
index 0000000..447413b
--- /dev/null
+++ b/validate.test.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
Validate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/validate.test.js b/validate.test.js
new file mode 100755
index 0000000..9c55d5b
--- /dev/null
+++ b/validate.test.js
@@ -0,0 +1,31 @@
+(function(window, undefined) {
+
+ 'use strict';
+
+ var
+
+ document = window.document,
+
+ name = 'validate',
+
+ form = $('