/*!
 * strength.js
 * Original author: @aaronlumsden
 * Further changes, comments: @aaronlumsden
 * Licensed under the MIT license
 */
(function(e,c,a,g){var d="strength",f={strengthClass:"strength",strengthInputClass:"strength_input",strengthMeterClass:"strength_meter",strengthButtonClass:"button_strength",strengthTipText:"密码填写建议：长度不小于8位，切包含，大写英文字母、小写英文字母、数字和符号。",strengthButtonText:"点击显示密码。",strengthButtonTextToggle:"点击隐藏密码。",veryweakText:"密码太弱啦！",weakText:"密码比较弱哦！",mediumText:"密码较安全！",strongText:"密码很强很安全！",strengthCheck:function(h,i){}};if(c.lang=="en"){e.extend(true,f,{strengthTipText:"Password no less than 8 bits in length, and included, upper case letters, lower case letters, Numbers and symbols.",strengthButtonText:"Click to display the password.",strengthButtonTextToggle:"Click the hidden password.",veryweakText:"Password is too weak!",weakText:"Password is weak!",mediumText:"Password is safer!",strongText:"Password is very strong and safe!"})}function b(i,h){this.element=i;this.$elem=e(this.element);this.options=e.extend({},f,h);this._defaults=f;this._name=d;this.init()}b.prototype={init:function(){var r=this.options;var n=new RegExp("[A-Z]");var p=new RegExp("[a-z]");var m=new RegExp("[0-9]");var l=new RegExp("[~!@#$%\\^&\\*()_+\\{\\}:\"\\|<>?`\\-=\\[\\];\\'\\\\,\\./]");function i(w,z){var v=w.length>=8?1:0;var s=w.match(n)?1:0;var u=w.match(p)?1:0;var y=w.match(m)?1:0;var t=w.match(l)?1:0;var x=v+s+u+y+t;j(x,z);r.strengthCheck(w,x)}function j(t,u){var s=e('div[data-meter="'+u+'"]').removeClass();s.parent().removeClass().addClass(r.strengthMeterClass);if(t==0){s.html("")}else{if(t==1){s.parent().addClass("veryweak");s.addClass("veryweak").html("<p>"+r.veryweakText+"</p>")}else{if(t==2){s.parent().addClass("weak");s.addClass("weak").html("<p>"+r.weakText+"</p>")}else{if(t==3||t==4){s.parent().addClass("medium");s.addClass("medium").html("<p>"+r.mediumText+"</p>")}else{s.parent().addClass("strong");s.addClass("strong").html("<p>"+r.strongText+"</p>")}}}}}var o=false;var q=r.strengthTipText+" "+r.strengthButtonText;var h=r.strengthTipText+" "+r.strengthButtonTextToggle;var k=this.$elem.attr("id");this.$elem.parent().addClass(r.strengthClass);this.$elem.addClass(r.strengthInputClass).attr("data-password",k).after('<input style="display:none" class="'+this.$elem.attr("class")+'" data-password="'+k+'" type="text" name="" value=""><a data-password-button="'+k+'" href="javascript:" class="'+r.strengthButtonClass+'" tabindex="-1">'+q+'</a><div class="'+r.strengthMeterClass+'"><div data-meter="'+k+'"><p></p></div></div>');this.$elem.bind("keyup keydown",function(t){thisval=e("#"+k).val();var s=e('input[type="text"][data-password="'+k+'"]').val(thisval);try{s.valid()}catch(u){}i(thisval,k)});e('input[type="text"][data-password="'+k+'"]').bind("keyup keydown",function(s){thisval=e('input[type="text"][data-password="'+k+'"]').val();e('input[type="password"][data-password="'+k+'"]').val(thisval);i(thisval,k)});e(a.body).on("click","."+r.strengthButtonClass,function(s){s.preventDefault();thisclass="hide_"+e(this).attr("class");if(o){e('input[type="text"][data-password="'+k+'"]').hide();e('input[type="password"][data-password="'+k+'"]').show().focus();e('a[data-password-button="'+k+'"]').removeClass(thisclass).html(q);o=false}else{e('input[type="text"][data-password="'+k+'"]').show().focus();e('input[type="password"][data-password="'+k+'"]').hide();e('a[data-password-button="'+k+'"]').addClass(thisclass).html(h);o=true}})}};e.fn[d]=function(h){return this.each(function(){if(!e.data(this,"plugin_"+d)){e.data(this,"plugin_"+d,new b(this,h))}})}})(jQuery,window,document);