diff --git a/bower.json b/bower.json index 066c55a..928dde9 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "validetta", "description": "A tiny jquery plugin for validate your forms", - "version": "0.9.0", + "version": "1.0.0", "homepage": "http://lab.hasanaydogdu.com/validetta/", "author": { "name": "Hasan Aydoğdu", diff --git a/demo/ajax.json b/demo/files/ajax.json similarity index 100% rename from demo/ajax.json rename to demo/files/ajax.json diff --git a/demo/ajax.php b/demo/files/ajax.php similarity index 100% rename from demo/ajax.php rename to demo/files/ajax.php diff --git a/demo/jquery.js b/demo/files/jquery.js similarity index 100% rename from demo/jquery.js rename to demo/files/jquery.js diff --git a/demo/remote.php b/demo/files/remote.php similarity index 89% rename from demo/remote.php rename to demo/files/remote.php index bbe5a68..ae2b3f5 100644 --- a/demo/remote.php +++ b/demo/files/remote.php @@ -1,5 +1,4 @@ false, 'message' => 'Sorry, Something went wrong!'); if( isset($_POST['exm3-name']) ) { diff --git a/demo/index.html b/demo/index.html index 344eb37..a81e11f 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,10 +4,10 @@ Form Validator - Examples - + - - + + @@ -36,7 +36,7 @@ // this -> form object // this.form is form element $.ajax({ - url : 'ajax.json', + url : 'files/ajax.json', data : $(this.form).serialize(), dataType : 'json', beforeSend : function(){ @@ -66,7 +66,7 @@ remote : { check_username : { type : 'POST', - url : 'remote.php', + url : 'files/remote.php', datatype : 'json' } } diff --git a/dist/validetta.css b/dist/validetta.css index 250d831..a79c034 100644 --- a/dist/validetta.css +++ b/dist/validetta.css @@ -1,6 +1,6 @@ /*! * Validetta (http://lab.hasanaydogdu.com/validetta/) - * Version 0.9.0 ( 19-06-2014 ) + * Version 1.0.0 ( 09-07-2014 ) * Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE) * Copyright 2013-2014 Hasan Aydoğdu - http://www.hasanaydogdu.com */ diff --git a/dist/validetta.js b/dist/validetta.js index 4d7a2ef..9eb9939 100644 --- a/dist/validetta.js +++ b/dist/validetta.js @@ -1,6 +1,6 @@ /*! * Validetta (http://lab.hasanaydogdu.com/validetta/) - * Version 0.9.0 ( 19-06-2014 ) + * Version 1.0.0 ( 09-07-2014 ) * Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE) * Copyright 2013-2014 Hasan Aydoğdu - http://www.hasanaydogdu.com */ @@ -13,7 +13,7 @@ var Validetta = {}, // Plugin Class FIELDS = {}, // Current fields/fields // RegExp for input validate rules - RRULE = new RegExp( /^(minChecked|maxChecked|minSelected|maxSelected|minLength|maxLength|equalTo|customReg|remote)\[(\w{1,15})\]/i ), + RRULE = new RegExp( /^(minChecked|maxChecked|minSelected|maxSelected|minLength|maxLength|equalTo|custom|remote)\[(\w{1,15})\]/i ), // RegExp for mail control method // @from ( http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29 ) RMAIL = new RegExp( /^[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])?)*$/ ), @@ -50,7 +50,7 @@ realTime : false, // To enable real-time form control, set this option true. onValid : function(){}, // This function to be called when the user submits the form and there is no error. onError : function(){}, // This function to be called when the user submits the form and there are some errors - customReg : {}, // Costum reg method variable + custom : {}, // Costum reg method variable remote : {} }, @@ -162,9 +162,9 @@ return count === 1; }, // Custom reg check - customReg : function( tmp, self ) { - var _arg = self.options.customReg[ tmp.arg ], - _reg = new RegExp( _arg.method ); + custom : function( tmp, self ) { + var _arg = self.options.custom[ tmp.arg ], + _reg = new RegExp( _arg.pattern ); return _reg.test( tmp.val ) || _arg.errorMessage; }, remote : function( tmp ) { @@ -288,8 +288,6 @@ // Start to check fields // Validator : Fields Control Object for ( var j = methods.length - 1; j >= 0; j-- ) { - // prevent empty validation if method is not required - if ( val === '' && methods[ j ] !== 'required' ) continue; // Check Rule var rule = methods[ j ].match( RRULE ), method; @@ -300,6 +298,8 @@ // Set method name method = rule[1]; } else { method = methods[ j ]; } + // prevent empty validation if method is not required + if ( val === '' && method !== 'required' && method !== 'equalTo' ) continue; // Is there a methot in Validator ? if( Validator.hasOwnProperty( method ) ) { // Validator returns error message if method invalid @@ -319,6 +319,7 @@ } else { // Nice, there are no error if( typeof state !== 'undefined' ) this.addValidClass( this.tmp.parent ); else $( this.tmp.parent ).removeClass( this.options.errorClass +' '+ this.options.validClass ); + state = undefined; // Reset state variable } } }, @@ -447,15 +448,13 @@ errorObject.className = this.options.errorTemplateClass; // if error display is bubble, calculate to positions if( this.options.display === 'bubble' ) { - var pos, W, H, T; + var pos, W; // !! Here, JQuery functions are using to support the IE8 pos = $( el ).position(); - W = $( el ).width(); - H = $( el ).height(); - T= pos.top ; + W = $( el ).outerWidth(true); $( errorObject ).empty().css({ - 'left' : pos.left + W + 30 +'px', - 'top' : T +'px' + 'left' : pos.left + W + 15 +'px', + 'top' : pos.top +'px' }); } elParent.appendChild( errorObject ); diff --git a/dist/validetta.min.css b/dist/validetta.min.css index f91670b..23c26df 100644 --- a/dist/validetta.min.css +++ b/dist/validetta.min.css @@ -1,6 +1,6 @@ /*! * Validetta (http://lab.hasanaydogdu.com/validetta/) - * Version 0.9.0 ( 19-06-2014 ) + * Version 1.0.0 ( 09-07-2014 ) * Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE) * Copyright 2013-2014 Hasan Aydoğdu - http://www.hasanaydogdu.com */ diff --git a/dist/validetta.min.js b/dist/validetta.min.js index d849e29..9481321 100644 --- a/dist/validetta.min.js +++ b/dist/validetta.min.js @@ -1,7 +1,7 @@ /*! * Validetta (http://lab.hasanaydogdu.com/validetta/) - * Version 0.9.0 ( 19-06-2014 ) + * Version 1.0.0 ( 09-07-2014 ) * Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE) * Copyright 2013-2014 Hasan Aydoğdu - http://www.hasanaydogdu.com */ -!function(a){"use strict";var b={},c={},d=new RegExp(/^(minChecked|maxChecked|minSelected|maxSelected|minLength|maxLength|equalTo|customReg|remote)\[(\w{1,15})\]/i),e=new RegExp(/^[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])?)*$/),f=new RegExp(/^[\-\+]?(\d+|\d+\.?\d+)$/),g={required:"This field is required. Please be sure to check.",email:"Your E-mail address appears to be invalid. Please be sure to check.",number:"You can enter only numbers in this field.",maxLength:"Maximum {count} characters allowed!",minLength:"Minimum {count} characters allowed!",maxChecked:"Maximum {count} options allowed. Please be sure to check.",minChecked:"Please select minimum {count} options.",maxSelected:"Maximum {count} selection allowed. Please be sure to check.",minSelected:"Minimum {count} selection allowed. Please be sure to check.",notEqual:"Fields do not match. Please be sure to check.",creditCard:"Invalid credit card number. Please be sure to check."},h={display:"bubble",errorTemplateClass:"validetta-bubble",errorClass:"validetta-error",validClass:"validetta-valid",errorClose:!0,errorCloseClass:"validetta-bubbleClose",realTime:!1,onValid:function(){},onError:function(){},customReg:{},remote:{}},i=function(a){return"string"==typeof a?a.replace(/^\s+|\s+$/g,""):a},j={required:function(a,b){switch(a.el.type){case"checkbox":return a.el.checked||g.required;case"radio":return this.radio.call(b,a.el)||g.required;case"select-multiple":return null!==a.val||g.required;default:return""!==a.val||g.required}},email:function(a){return e.test(a.val)||g.email},number:function(a){return f.test(a.val)||g.number},minLength:function(a){var b=a.val.length;return 0===b||b>=a.arg||g.minLength.replace("{count}",a.arg)},maxLength:function(a){return a.val.length<=a.arg||g.maxLength.replace("{count}",a.arg)},equalTo:function(b,c){return a(c.form).find('input[name="'+b.arg+'"]').val()===b.val||g.notEqual},creditCard:function(a){if(""===a.val)return!0;var b,c,d,e,f,h,i,j=0;if(b=new RegExp(/[^0-9]+/g),c=a.val.replace(b,""),i=c.length,16>i)return g.creditCard;for(f=0;i>f;f++)d=i-f,e=parseInt(c.substring(d-1,d),10),f%2===1?(h=2*e,h>9&&(h=1+(h-10))):h=e,j+=h;return j>0&&j%10===0?!0:g.creditCard},maxChecked:function(b,c){var d=a(c.form.querySelectorAll('input[type=checkbox][name="'+b.el.name+'"]'));if(0===d.index(b.el)){var e=d.filter(":checked").length;if(0!==e)return e<=b.arg||g.maxChecked.replace("{count}",b.arg)}},minChecked:function(b,c){var d=a(c.form.querySelectorAll('input[type=checkbox][name="'+b.el.name+'"]'));if(0===d.index(b.el)){var e=d.filter(":checked").length;return e>=b.arg||g.minChecked.replace("{count}",b.arg)}},maxSelected:function(a){return null!==a.val?a.val.length<=a.arg||g.maxSelected.replace("{count}",a.arg):void 0},minSelected:function(a){return null!==a.val&&a.val.length>=a.arg||g.minSelected.replace("{count}",a.arg)},radio:function(b){var c=a(this.form.querySelectorAll('input[type=radio][name="'+b.name+'"]')).filter(":checked").length;return 1===c},customReg:function(a,b){var c=b.options.customReg[a.arg],d=new RegExp(c.method);return d.test(a.val)||c.errorMessage},remote:function(a){a.remote=a.arg}};b=function(b,c){this.handler=!1,this.options=a.extend(!0,{},h,c),this.form=b,this.xhr={},this.events()},b.prototype={constructor:b,events:function(){var b=this;a(this.form).submit(function(a){return c=this.querySelectorAll("[data-validetta]"),b.init(a)}),this.options.realTime===!0&&(a(this.form).find("[data-validetta]").not("[type=checkbox]").on("change",function(d){return c=a(this),b.init(d)}),a(this.form).find("[data-validetta][type=checkbox]").on("click",function(a){return c=b.form.querySelectorAll('[data-validetta][type=checkbox][name="'+this.name+'"]'),b.init(a)})),a(this.form).on("reset",function(){return a(b.form.querySelectorAll("."+b.options.errorClass+", ."+b.options.validClass)).removeClass(b.options.errorClass+" "+b.options.validClass),b.reset()}),this.options.errorClose&&a(this.form).on("click","."+this.options.errorCloseClass,function(){var a=this.parentNode;return a&&b.window.close.call(b,a),!1})},init:function(a){return this.reset(c),this.checkFields(a),"submit"!==a.type?void 0:"pending"===this.handler?!1:this.handler===!0?(this.options.onError.call(this,a),!1):this.options.onValid.call(this,a)},checkFields:function(b){for(var e=this,f=c.length-1;f>=0;f--){var g,h=c[f],k="",l=i(a(h).val()),m=h.getAttribute("data-validetta").split(",");this.tmp={},this.tmp={el:h,val:l,parent:h.parentNode};for(var n=m.length-1;n>=0;n--)if(""!==l||"required"===m[n]){var o,p=m[n].match(d);null!==p?("undefined"!=typeof p[2]&&(this.tmp.arg=p[2]),o=p[1]):o=m[n],j.hasOwnProperty(o)&&(g=j[o](e.tmp,e),"undefined"!=typeof g&&g!==!0&&(k+=g+"
"))}""!==k?(this.addErrorClass(this.tmp.parent),this.window.open.call(this,h,k)):"undefined"!=typeof this.tmp.remote?this.checkRemote(h,b):"undefined"!=typeof g?this.addValidClass(this.tmp.parent):a(this.tmp.parent).removeClass(this.options.errorClass+" "+this.options.validClass)}},checkRemote:function(b,c){var d={},e={},f=b.name||b.getAttribute("id");"undefined"==typeof this.remoteCache&&(this.remoteCache={}),e[f]=this.tmp.val,d=a.extend(!0,{},{data:e},this.options.remote[this.tmp.remote]||{});var g=a.param(d),h=this.remoteCache[g];if("undefined"!=typeof h)switch(h.state){case"pending":this.handler="pending",h.event=c.type;break;case"rejected":throw c.preventDefault(),new Error(h.result.message);case"resolved":h.result.valid===!1?(this.addErrorClass(this.tmp.parent),this.window.open.call(this,b,h.result.message)):this.addValidClass(this.tmp.parent)}else{var i=this.xhr[f];"undefined"!=typeof i&&"pending"===i.state()&&i.abort(),h=this.remoteCache[g]={state:"pending",event:c.type},this.remoteRequest(d,h,b,f)}},remoteRequest:function(b,c,d,e){var f=this;a(this.tmp.parent).addClass("validetta-pending"),this.xhr[e]=a.ajax(b).done(function(b){b=JSON.parse(b),c.state="resolved",c.result=b,"submit"===c.event?(f.handler=!1,a(f.form).trigger("submit")):b.valid===!1?(f.addErrorClass(f.tmp.parent),f.window.open.call(f,d,b.message)):f.addValidClass(f.tmp.parent)}).fail(function(a,b){if("abort"!==b){var d="Ajax request failed for field ("+e+") : "+a.status+" "+a.statusText;throw c.state="rejected",c.result={valid:!1,message:d},new Error(d)}}).always(function(){a(f.tmp.parent).removeClass("validetta-pending")}),this.handler="pending"},window:{open:function(b,c){var d=b.parentNode;if("undefined"==typeof d&&(d=b[0].parentNode),!a(d).find("."+this.options.errorTemplateClass).length){var e=document.createElement("span");if(e.className=this.options.errorTemplateClass,"bubble"===this.options.display){var f,g,h,i;f=a(b).position(),g=a(b).width(),h=a(b).height(),i=f.top,a(e).empty().css({left:f.left+g+30+"px",top:i+"px"})}if(d.appendChild(e),e.innerHTML=c,this.options.errorClose){var j=document.createElement("span");j.innerHTML="x",j.className=this.options.errorCloseClass,e.appendChild(j)}this.handler=!0}},close:function(a){a.parentNode.removeChild(a),this.handler=!1}},reset:function(b){var c={};c="undefined"==typeof b||b.length>1&&"checkbox"!==b[0].getAttribute("type")?a(this.form).find("."+this.options.errorTemplateClass):a(b[0].parentNode).find("."+this.options.errorTemplateClass);for(var d=c.length-1;d>=0;d--)this.window.close.call(this,c[d])},addErrorClass:function(b){a(b).removeClass(this.options.validClass).addClass(this.options.errorClass)},addValidClass:function(b){a(b).removeClass(this.options.errorClass).addClass(this.options.validClass)}},a.fn.validetta=function(c){return a.validettaLanguage&&(g=a.extend(!0,{},g,a.validettaLanguage.messages)),this.each(function(){new b(this,c)})}}(jQuery); \ No newline at end of file +!function(a){"use strict";var b={},c={},d=new RegExp(/^(minChecked|maxChecked|minSelected|maxSelected|minLength|maxLength|equalTo|custom|remote)\[(\w{1,15})\]/i),e=new RegExp(/^[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])?)*$/),f=new RegExp(/^[\-\+]?(\d+|\d+\.?\d+)$/),g={required:"This field is required. Please be sure to check.",email:"Your E-mail address appears to be invalid. Please be sure to check.",number:"You can enter only numbers in this field.",maxLength:"Maximum {count} characters allowed!",minLength:"Minimum {count} characters allowed!",maxChecked:"Maximum {count} options allowed. Please be sure to check.",minChecked:"Please select minimum {count} options.",maxSelected:"Maximum {count} selection allowed. Please be sure to check.",minSelected:"Minimum {count} selection allowed. Please be sure to check.",notEqual:"Fields do not match. Please be sure to check.",creditCard:"Invalid credit card number. Please be sure to check."},h={display:"bubble",errorTemplateClass:"validetta-bubble",errorClass:"validetta-error",validClass:"validetta-valid",errorClose:!0,errorCloseClass:"validetta-bubbleClose",realTime:!1,onValid:function(){},onError:function(){},custom:{},remote:{}},i=function(a){return"string"==typeof a?a.replace(/^\s+|\s+$/g,""):a},j={required:function(a,b){switch(a.el.type){case"checkbox":return a.el.checked||g.required;case"radio":return this.radio.call(b,a.el)||g.required;case"select-multiple":return null!==a.val||g.required;default:return""!==a.val||g.required}},email:function(a){return e.test(a.val)||g.email},number:function(a){return f.test(a.val)||g.number},minLength:function(a){var b=a.val.length;return 0===b||b>=a.arg||g.minLength.replace("{count}",a.arg)},maxLength:function(a){return a.val.length<=a.arg||g.maxLength.replace("{count}",a.arg)},equalTo:function(b,c){return a(c.form).find('input[name="'+b.arg+'"]').val()===b.val||g.notEqual},creditCard:function(a){if(""===a.val)return!0;var b,c,d,e,f,h,i,j=0;if(b=new RegExp(/[^0-9]+/g),c=a.val.replace(b,""),i=c.length,16>i)return g.creditCard;for(f=0;i>f;f++)d=i-f,e=parseInt(c.substring(d-1,d),10),f%2===1?(h=2*e,h>9&&(h=1+(h-10))):h=e,j+=h;return j>0&&j%10===0?!0:g.creditCard},maxChecked:function(b,c){var d=a(c.form.querySelectorAll('input[type=checkbox][name="'+b.el.name+'"]'));if(0===d.index(b.el)){var e=d.filter(":checked").length;if(0!==e)return e<=b.arg||g.maxChecked.replace("{count}",b.arg)}},minChecked:function(b,c){var d=a(c.form.querySelectorAll('input[type=checkbox][name="'+b.el.name+'"]'));if(0===d.index(b.el)){var e=d.filter(":checked").length;return e>=b.arg||g.minChecked.replace("{count}",b.arg)}},maxSelected:function(a){return null!==a.val?a.val.length<=a.arg||g.maxSelected.replace("{count}",a.arg):void 0},minSelected:function(a){return null!==a.val&&a.val.length>=a.arg||g.minSelected.replace("{count}",a.arg)},radio:function(b){var c=a(this.form.querySelectorAll('input[type=radio][name="'+b.name+'"]')).filter(":checked").length;return 1===c},custom:function(a,b){var c=b.options.custom[a.arg],d=new RegExp(c.pattern);return d.test(a.val)||c.errorMessage},remote:function(a){a.remote=a.arg}};b=function(b,c){this.handler=!1,this.options=a.extend(!0,{},h,c),this.form=b,this.xhr={},this.events()},b.prototype={constructor:b,events:function(){var b=this;a(this.form).submit(function(a){return c=this.querySelectorAll("[data-validetta]"),b.init(a)}),this.options.realTime===!0&&(a(this.form).find("[data-validetta]").not("[type=checkbox]").on("change",function(d){return c=a(this),b.init(d)}),a(this.form).find("[data-validetta][type=checkbox]").on("click",function(a){return c=b.form.querySelectorAll('[data-validetta][type=checkbox][name="'+this.name+'"]'),b.init(a)})),a(this.form).on("reset",function(){return a(b.form.querySelectorAll("."+b.options.errorClass+", ."+b.options.validClass)).removeClass(b.options.errorClass+" "+b.options.validClass),b.reset()}),this.options.errorClose&&a(this.form).on("click","."+this.options.errorCloseClass,function(){var a=this.parentNode;return a&&b.window.close.call(b,a),!1})},init:function(a){return this.reset(c),this.checkFields(a),"submit"!==a.type?void 0:"pending"===this.handler?!1:this.handler===!0?(this.options.onError.call(this,a),!1):this.options.onValid.call(this,a)},checkFields:function(b){for(var e=this,f=c.length-1;f>=0;f--){var g,h=c[f],k="",l=i(a(h).val()),m=h.getAttribute("data-validetta").split(",");this.tmp={},this.tmp={el:h,val:l,parent:h.parentNode};for(var n=m.length-1;n>=0;n--){var o,p=m[n].match(d);null!==p?("undefined"!=typeof p[2]&&(this.tmp.arg=p[2]),o=p[1]):o=m[n],(""!==l||"required"===o||"equalTo"===o)&&j.hasOwnProperty(o)&&(g=j[o](e.tmp,e),"undefined"!=typeof g&&g!==!0&&(k+=g+"
"))}""!==k?(this.addErrorClass(this.tmp.parent),this.window.open.call(this,h,k)):"undefined"!=typeof this.tmp.remote?this.checkRemote(h,b):("undefined"!=typeof g?this.addValidClass(this.tmp.parent):a(this.tmp.parent).removeClass(this.options.errorClass+" "+this.options.validClass),g=void 0)}},checkRemote:function(b,c){var d={},e={},f=b.name||b.getAttribute("id");"undefined"==typeof this.remoteCache&&(this.remoteCache={}),e[f]=this.tmp.val,d=a.extend(!0,{},{data:e},this.options.remote[this.tmp.remote]||{});var g=a.param(d),h=this.remoteCache[g];if("undefined"!=typeof h)switch(h.state){case"pending":this.handler="pending",h.event=c.type;break;case"rejected":throw c.preventDefault(),new Error(h.result.message);case"resolved":h.result.valid===!1?(this.addErrorClass(this.tmp.parent),this.window.open.call(this,b,h.result.message)):this.addValidClass(this.tmp.parent)}else{var i=this.xhr[f];"undefined"!=typeof i&&"pending"===i.state()&&i.abort(),h=this.remoteCache[g]={state:"pending",event:c.type},this.remoteRequest(d,h,b,f)}},remoteRequest:function(b,c,d,e){var f=this;a(this.tmp.parent).addClass("validetta-pending"),this.xhr[e]=a.ajax(b).done(function(b){b=JSON.parse(b),c.state="resolved",c.result=b,"submit"===c.event?(f.handler=!1,a(f.form).trigger("submit")):b.valid===!1?(f.addErrorClass(f.tmp.parent),f.window.open.call(f,d,b.message)):f.addValidClass(f.tmp.parent)}).fail(function(a,b){if("abort"!==b){var d="Ajax request failed for field ("+e+") : "+a.status+" "+a.statusText;throw c.state="rejected",c.result={valid:!1,message:d},new Error(d)}}).always(function(){a(f.tmp.parent).removeClass("validetta-pending")}),this.handler="pending"},window:{open:function(b,c){var d=b.parentNode;if("undefined"==typeof d&&(d=b[0].parentNode),!a(d).find("."+this.options.errorTemplateClass).length){var e=document.createElement("span");if(e.className=this.options.errorTemplateClass,"bubble"===this.options.display){var f,g;f=a(b).position(),g=a(b).outerWidth(!0),a(e).empty().css({left:f.left+g+15+"px",top:f.top+"px"})}if(d.appendChild(e),e.innerHTML=c,this.options.errorClose){var h=document.createElement("span");h.innerHTML="x",h.className=this.options.errorCloseClass,e.appendChild(h)}this.handler=!0}},close:function(a){a.parentNode.removeChild(a),this.handler=!1}},reset:function(b){var c={};c="undefined"==typeof b||b.length>1&&"checkbox"!==b[0].getAttribute("type")?a(this.form).find("."+this.options.errorTemplateClass):a(b[0].parentNode).find("."+this.options.errorTemplateClass);for(var d=c.length-1;d>=0;d--)this.window.close.call(this,c[d])},addErrorClass:function(b){a(b).removeClass(this.options.validClass).addClass(this.options.errorClass)},addValidClass:function(b){a(b).removeClass(this.options.errorClass).addClass(this.options.validClass)}},a.fn.validetta=function(c){return a.validettaLanguage&&(g=a.extend(!0,{},g,a.validettaLanguage.messages)),this.each(function(){new b(this,c)})}}(jQuery); \ No newline at end of file diff --git a/package.json b/package.json index ad1bac0..82902c4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "validetta", "description": "A tiny jquery plugin for validate your forms", - "version": "0.9.0", + "version": "1.0.0", "homepage": "http://lab.hasanaydogdu.com/validetta/", "author": { "name": "Hasan Aydoğdu", diff --git a/validetta.jquery.json b/validetta.jquery.json index 07b37e9..e50f36e 100644 --- a/validetta.jquery.json +++ b/validetta.jquery.json @@ -1,6 +1,6 @@ { "name" : "validetta", - "version" : "0.9.0", + "version" : "1.0.0", "title" : "Validetta - A tiny jquery plugin for validate your forms", "description" : "Validetta is a tiny jQuery plugin which you can do client-side validation of your forms. It aims to decrease your burden with easy usage and flexible structure.", "keywords": [ @@ -15,7 +15,7 @@ "docs" : "http://lab.hasanaydogdu.com/validetta/#documentation", "demo" : "http://lab.hasanaydogdu.com/validetta/#examples", "bugs" : "http://github.com/hsnayd/validetta/issues", - "download" : "http://github.com/hsnayd/validetta/archive/v0.9.0.zip", + "download" : "https://github.com/hsnayd/validetta/releases/download/v1.0.0/validetta-1.0.0-dist.zip", "author" : { "name": "Hasan Aydoğdu", "url" : "http://github.com/hsnayd"