1(function($){ 2var passwordStrength = new function() { 3 this.getStrength = function(pw) { 4 var pwlength=(pw.length); 5 if(pwlength>5)pwlength=5; 6 var numnumeric=pw.replace(/[0-9]/g,""); 7 var numeric=(pw.length-numnumeric.length); 8 if(numeric>3)numeric=3; 9 var symbols=pw.replace(/\W/g,""); 10 var numsymbols=(pw.length-symbols.length); 11 if(numsymbols>3)numsymbols=3; 12 var numupper=pw.replace(/[A-Z]/g,""); 13 var upper=(pw.length-numupper.length); 14 if(upper>3)upper=3; 15 var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10); 16 if(pwstrength<0){pwstrength=0} 17 if(pwstrength>100){pwstrength=100} 18 return pwstrength; 19 } 20 21 this.getStrengthLevel = function(val) { 22 return this.getStrength(val); 23 } 24} 25 26$.fn.password_strength = function(options) 27{ 28 var settings = $.extend({ 29 'container' : null, 30 }, options); 31 32 return this.each(function(){ 33 if (settings.container) { 34 var container = $(settings.container); 35 } else { 36 var container = $('<span/>').attr('class', 'password_strength'); 37 $(this).after(container); 38 } 39 40 $(this).focus(function() { 41 container.slideDown(); 42 }); 43 44 $(this).keyup(function() { 45 var val = $(this).val(); 46 if (val.length > 0) { 47 var level = passwordStrength.getStrengthLevel(val); 48 } else { 49 var level = 0 50 } 51 container.children("div").css("background-position", level+"% 50%"); 52 }); 53 }); 54}; 55})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.