[ Root ] [ Search ] [ Index ]

PHP Cross Reference of WordPress 3.0.1

Provided by Yoast

title

Body

[close]

/wp-admin/js/ -> user-profile.dev.js (source)

   1  (function($){
   2  
   3  	function check_pass_strength() {
   4          var pass1 = $('#pass1').val(), user = $('#user_login').val(), pass2 = $('#pass2').val(), strength;
   5  
   6          $('#pass-strength-result').removeClass('short bad good strong');
   7          if ( ! pass1 ) {
   8              $('#pass-strength-result').html( pwsL10n.empty );
   9              return;
  10          }
  11  
  12          strength = passwordStrength(pass1, user, pass2);
  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              case 5:
  25                  $('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] );
  26                  break;
  27              default:
  28                  $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
  29          }
  30      }
  31  
  32      $(document).ready( function() {
  33          $('#pass1').val('').keyup( check_pass_strength );
  34          $('#pass2').val('').keyup( check_pass_strength );
  35          $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
  36          $('#nickname').blur(function(){
  37              var str = $(this).val() || $('#user_login').val();
  38              var select = $('#display_name');
  39              var sel = select.children('option:selected').attr('id');
  40              select.children('#display_nickname').remove();
  41              if ( ! select.children('option[value=' + str + ']').length )
  42                  select.append('<option id="display_nickname" value="' + str + '">' + str + '</option>');
  43              $('#'+sel).attr('selected', 'selected');
  44          });
  45          $('#first_name, #last_name').blur(function(){
  46              var select = $('#display_name');
  47              var first = $('#first_name').val(), last = $('#last_name').val();
  48              var sel = select.children('option:selected').attr('id');
  49              $('#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst').remove();
  50              if ( first && ! select.children('option[value=' + first + ']').length )
  51                  select.append('<option id="display_firstname" value="' + first + '">' + first + '</option>');
  52              if ( last && ! select.children('option[value=' + last + ']').length )
  53                  select.append('<option id="display_lastname" value="' + last + '">' + last + '</option>');
  54              if ( first && last ) {
  55                  if ( ! select.children('option[value=' + first + ' ' + last + ']').length )
  56                      select.append('<option id="display_firstlast" value="' + first + ' ' + last + '">' + first + ' ' + last + '</option>');
  57                  if ( ! select.children('option[value=' + last + ' ' + first + ']').length )
  58                      select.append('<option id="display_lastfirst" value="' + last + ' ' + first + '">' + last + ' ' + first + '</option>');
  59              }
  60              $('#'+sel).attr('selected', 'selected');
  61          });
  62      });
  63  
  64  })(jQuery);


Generated: Thu Oct 14 05:12:05 2010 Cross-referenced by PHPXref 0.7