PageSourceSearch

https://www.kgh.nhs.uk/plugins/jquery-pwstrength/jquery.pwstrength.min.js?_=890005370

js kgh.nhs.uk collected 2026-09-25 18:40:04 UTC 1,949 bytes, 56 lines download raw bytes

1;(function($) {
2    $.pwstrength = function(password) {
3        var score = 0, length = password.length, upperCase, lowerCase, digits, nonAlpha;
4
5        if(length < 5) score += 0;
6        else if(length < 8) score += 5;
7        else if(length < 16) score += 10;
8        else score += 15;
9
10        lowerCase = password.match(/[a-z]/g);
11        if(lowerCase) score += 1;
12
13        upperCase = password.match(/[A-Z]/g);
14        if(upperCase) score += 5;
15
16        if(upperCase && lowerCase) score += 2;
17
18        digits = password.match(/\d/g);
19        if(digits && digits.length > 1) score += 5;
20
21        nonAlpha = password.match(/\W/g)
22        if(nonAlpha) score += (nonAlpha.length > 1) ? 15 : 10;
23
24        if(upperCase && lowerCase && digits && nonAlpha) score += 15;
25
26        if(password.match(/\s/)) score += 10;
27
28        if(score < 15) return 0;
29        if(score < 20) return 1;
30        if(score < 35) return 2;
31        if(score < 50) return 3;
32        return 4;
33    };
34
35    function updateIndicator(event) {
36        var strength = $.pwstrength($(this).val()), options = event.data, klass;
37        klass = options.classes[strength];
38
39        options.indicator.removeClass(options.indicator.data('pwclass'));
40        options.indicator.data('pwclass', klass);
41        options.indicator.addClass('pw-strength');
42        options.indicator.addClass(klass);
43        options.indicator.find(options.label).html(options.texts[strength]);
44    }
45
46    $.fn.pwstrength = function(options) {
47        var options = $.extend({
48            label: '.label',
49            classes: ['pw-very-weak', 'pw-weak', 'pw-mediocre', 'pw-strong', 'pw-very-strong'],
50            texts: ['very weak', 'weak', 'mediocre', 'strong', 'very strong']
51        }, options || {});
52        options.indicator = $('<span class="pw-strength"><span class="meter">');
53        $(this).parent().append(options.indicator);
54        return this.keyup(options, updateIndicator);
55    };
56})(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.