source: trunk/www.guidonia.net/wp/wp-admin/js/user-profile.dev.js@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 2.0 KB
Line 
1(function($){
2
3 function check_pass_strength() {
4 var pass = $('#pass1').val(), user = $('#user_login').val(), strength;
5
6 $('#pass-strength-result').removeClass('short bad good strong');
7 if ( ! pass ) {
8 $('#pass-strength-result').html( pwsL10n.empty );
9 return;
10 }
11
12 strength = passwordStrength(pass, user);
13
14 switch ( strength ) {
15 case 2:
16 $('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] );
17 break;
18 case 3:
19 $('#pass-strength-result').addClass('good').html( pwsL10n['good'] );
20 break;
21 case 4:
22 $('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
23 break;
24 default:
25 $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
26 }
27 }
28
29 $(document).ready( function() {
30 $('#pass1').val('').keyup( check_pass_strength );
31 $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
32 $('#nickname').blur(function(){
33 var str = $(this).val() || $('#user_login').val();
34 $('#display_name #display_nickname').val(str).html(str);
35 });
36 $('#first_name, #last_name').blur(function(){
37 var first = $('#first_name').val(), last = $('#last_name').val();
38 $('#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst').remove();
39 if ( first && last ) {
40 $('#display_name').append('<option id="display_firstname" value="' + first + '">' + first + '</option>' +
41 '<option id="display_lastname" value="' + last + '">' + last + '</option>' +
42 '<option id="display_firstlast" value="' + first + ' ' + last + '">' + first + ' ' + last + '</option>' +
43 '<option id="display_lastfirst" value="' + last + ' ' + first + '">' + last + ' ' + first + '</option>');
44 } else if ( first && !last ) {
45 $('#display_name').append('<option id="display_firstname" value="' + first + '">' + first + '</option>');
46 } else if ( !first && last ) {
47 $('#display_name').append('<option id="display_lastname" value="' + last + '">' + last + '</option>');
48 }
49 });
50 });
51
52})(jQuery);
Note: See TracBrowser for help on using the repository browser.