Add New User screen: don't bind to blur event on the user_name fields when the <select> doesn't exist, props SergeyBiryukov, fixes #20392

git-svn-id: https://develop.svn.wordpress.org/trunk@20431 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2012-04-11 01:57:58 +00:00
parent c148fb4eb5
commit 14dca5a882
1 changed files with 39 additions and 38 deletions

View File

@ -29,19 +29,19 @@
} }
} }
$(document).ready(function() { $(document).ready( function() {
var select = $('#display_name');
$('#pass1').val('').keyup( check_pass_strength ); $('#pass1').val('').keyup( check_pass_strength );
$('#pass2').val('').keyup( check_pass_strength ); $('#pass2').val('').keyup( check_pass_strength );
$('#pass-strength-result').show(); $('#pass-strength-result').show();
$('.color-palette').click(function(){$(this).siblings('input[name="admin_color"]').prop('checked', true)}); $('.color-palette').click( function() {
$('#first_name, #last_name, #nickname').blur(function(){ $(this).siblings('input[name="admin_color"]').prop('checked', true);
var select = $('#display_name'), current, dub = [], inputs; });
if ( !select.length )
return;
current = select.find('option:selected').attr('id');
if ( select.length ) {
$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
var current = select.find('option:selected').attr('id'), dub = [],
inputs = { inputs = {
display_nickname : $('#nickname').val() || '', display_nickname : $('#nickname').val() || '',
display_username : $('#user_login').val() || '', display_username : $('#user_login').val() || '',
@ -56,7 +56,7 @@
$('option', select).remove(); $('option', select).remove();
$.each(inputs, function( id, value ) { $.each(inputs, function( id, value ) {
if ( !value ) if ( ! value )
return; return;
var val = value.replace(/<\/?[a-z][^>]*>/gi, ''); var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
@ -71,6 +71,7 @@
} }
}); });
}); });
}
}); });
})(jQuery); })(jQuery);