db981a3b27
* This moves our "development" versions from .dev.js to .js (same for css). * The compressed version then moves from .js to .min.js (same for css). By switching to the standard .min convention, it sets expectations for developers, and works nicely with existing tools such as ack. fixes #21633. git-svn-id: https://develop.svn.wordpress.org/trunk@21592 602fd350-edb4-49c9-b593-d223f7449a82
79 lines
2.2 KiB
JavaScript
79 lines
2.2 KiB
JavaScript
(function($){
|
|
|
|
function check_pass_strength() {
|
|
var pass1 = $('#pass1').val(), user = $('#user_login').val(), pass2 = $('#pass2').val(), strength;
|
|
|
|
$('#pass-strength-result').removeClass('short bad good strong');
|
|
if ( ! pass1 ) {
|
|
$('#pass-strength-result').html( pwsL10n.empty );
|
|
return;
|
|
}
|
|
|
|
strength = passwordStrength(pass1, user, pass2);
|
|
|
|
switch ( strength ) {
|
|
case 2:
|
|
$('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] );
|
|
break;
|
|
case 3:
|
|
$('#pass-strength-result').addClass('good').html( pwsL10n['good'] );
|
|
break;
|
|
case 4:
|
|
$('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
|
|
break;
|
|
case 5:
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] );
|
|
break;
|
|
default:
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
|
|
}
|
|
}
|
|
|
|
$(document).ready( function() {
|
|
var select = $('#display_name');
|
|
|
|
$('#pass1').val('').keyup( check_pass_strength );
|
|
$('#pass2').val('').keyup( check_pass_strength );
|
|
$('#pass-strength-result').show();
|
|
$('.color-palette').click( function() {
|
|
$(this).siblings('input[name="admin_color"]').prop('checked', true);
|
|
});
|
|
|
|
if ( select.length ) {
|
|
$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
|
|
var dub = [],
|
|
inputs = {
|
|
display_nickname : $('#nickname').val() || '',
|
|
display_username : $('#user_login').val() || '',
|
|
display_firstname : $('#first_name').val() || '',
|
|
display_lastname : $('#last_name').val() || ''
|
|
};
|
|
|
|
if ( inputs.display_firstname && inputs.display_lastname ) {
|
|
inputs['display_firstlast'] = inputs.display_firstname + ' ' + inputs.display_lastname;
|
|
inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname;
|
|
}
|
|
|
|
$.each( $('option', select), function( i, el ){
|
|
dub.push( el.value );
|
|
});
|
|
|
|
$.each(inputs, function( id, value ) {
|
|
if ( ! value )
|
|
return;
|
|
|
|
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
|
|
|
|
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
|
|
dub.push(val);
|
|
$('<option />', {
|
|
'text': val
|
|
}).appendTo( select );
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|
|
})(jQuery);
|