PageSourceSearch

https://shop.hamiplant.nl/_ui/responsive/common/js/jquery.pstrength.custom-1.2.0.js?v=1.1.4.13

js hamiplant.nl collected 2026-09-27 01:24:30 UTC 4,238 bytes, 143 lines download raw bytes

1/* jQuery Password Strength Plugin (pstrength) - A jQuery plugin to provide accessibility functions
2 * Author: Tane Piper ([email protected])
3 * Website: http://digitalspaghetti.me.uk
4 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
5 * This code uses a modified version of Steve Moitozo's algorithm (http://www.geekwisdom.com/dyn/passwdmeter)
6 *
7 * === Changelog ===
8 * Version 1.2 (03/09/2007)
9 * Added more options for colors and common words
10 * Added common words checked to see if words like 'password' or 'qwerty' are being entered
11 * Added minimum characters required for password
12 * Re-worked scoring system to give better results
13 *
14 * Version 1.1 (20/08/2007)
15 * Changed code to be more jQuery-like
16 *
17 * Version 1.0 (20/07/2007)
18 * Initial version.
19 */
20(function($){
21	$.extend($.fn, {
22		pstrength : function(options) {
23			var options = $.extend({
24				verdicts:	["Too Short!","Very Weak","Weak","Medium","Strong","Very Strong"],
25				colors: 	["#ccc","#f00","#c06","#f60","#3c0","#3f0"],
26				values: 	[20,30,40,60,80,100],
27				scores: 	[10,15,30,40],
28				minchar:	6,
29				minCharText: "Minimum length is %d characters"
30			},options);
31			return this.each(function(){
32				var infoarea = $(this).attr('id');
33
34
35				$(this).after('<div id="' + infoarea + '_bar" class="progress" style="display: none;"><div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"><span  id="' + infoarea + '_text">0%<span></div></div>');
36
37				if(options.minchar>0){
38					$(this).after('<div class="help-block" id="' + infoarea + '_minchar">' + options.minCharText.replace('%d', options.minchar) + '</div>');
39				}
40
41
42				options.$ctlBar = $("#" + infoarea + "_bar .progress-bar");
43	    		options.$ctlText = $("#" + infoarea + "_text");
44
45				$(this).keyup(function(){
46					if(options.minchar <= $(this).val().length && $("#"+infoarea + '_bar:hidden')){
47						$("#"+infoarea + '_bar').show()
48					}
49
50					$.fn.runPassword($(this).val(), infoarea, options);
51				});
52			});
53		},
54		runPassword : function (password, infoarea, options){
55
56			nPerc = $.fn.checkPassword(password, options);
57	    	var statusNum;
58
59			if (nPerc < 0){
60				statusNum=0
61			}
62			else if(nPerc <= options.scores[0]){
63				statusNum=1
64			}
65			else if (nPerc > options.scores[0] && nPerc <= options.scores[1]){
66				statusNum=2
67			}
68			else if (nPerc > options.scores[1] && nPerc <= options.scores[2]){
69				statusNum=3
70			}
71			else if (nPerc > options.scores[2] && nPerc <= options.scores[3]){
72				statusNum=4
73			}
74			else{
75				statusNum=5
76			}
77
78
79			options.$ctlBar.css({width: options.values[statusNum]+"%"});
80			options.$ctlBar.attr("aria-valuenow",options.values[statusNum]);
81			options.$ctlBar.css({backgroundColor: options.colors[statusNum]});
82			options.$ctlText.html(options.verdicts[statusNum]);
83
84		},
85		checkPassword : function(password, options)
86		{
87			var intScore = 0;
88			var strVerdict = options.verdicts[0];
89			
90			if (password.length  < options.minchar){
91				intScore = (intScore-100)
92			}
93			else if (password.length >options.minchar+1 && password.length <options.minchar+3){
94				intScore = (intScore+6)
95			}
96			else if (password.length >options.minchar+2 && password.length <options.minchar+4){
97				intScore = (intScore+12)
98			}
99			else if (password.length >options.minchar*2){
100				intScore = (intScore+18)
101			}
102
103			if (password.match(/[a-z]/)){
104				intScore = (intScore+1)
105			}
106
107			if (password.match(/[A-Z]/)){
108				intScore = (intScore+5)
109			}
110
111			if (password.match(/\d+/)){
112				intScore = (intScore+5)
113			}
114
115			if (password.match(/(.*[0-9].*[0-9].*[0-9])/)){
116				intScore = (intScore+5)
117			}
118
119			if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){
120				intScore = (intScore+5)
121			}
122
123			if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){
124				intScore = (intScore+5)
125			}
126
127			if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){
128				intScore = (intScore+2)
129			}
130
131			if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)){
132				intScore = (intScore+2)
133			}
134
135			if (password.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){
136				intScore = (intScore+2)
137			}
138
139			return intScore;
140
141		}
142	});
143})(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.