User Profile JS cleanup, props dd32, fixes #17910 for 3.1
git-svn-id: http://svn.automattic.com/wordpress/branches/3.1@18363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1611198696
commit
40fef4668e
|
@ -29,36 +29,38 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
$(document).ready(function() {
|
||||
$('#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]').attr('checked', 'checked')});
|
||||
$('#nickname').blur(function(){
|
||||
var str = $(this).val() || $('#user_login').val();
|
||||
var select = $('#display_name');
|
||||
var sel = select.children('option:selected').attr('id');
|
||||
select.children('#display_nickname').remove();
|
||||
if ( ! select.children('option[value=' + str + ']').length )
|
||||
select.append('<option id="display_nickname" value="' + str + '">' + str + '</option>');
|
||||
$('#'+sel).attr('selected', 'selected');
|
||||
});
|
||||
$('#first_name, #last_name').blur(function(){
|
||||
var select = $('#display_name');
|
||||
var first = $('#first_name').val(), last = $('#last_name').val();
|
||||
var sel = select.children('option:selected').attr('id');
|
||||
$('#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst').remove();
|
||||
if ( first && ! select.children('option[value=' + first + ']').length )
|
||||
select.append('<option id="display_firstname" value="' + first + '">' + first + '</option>');
|
||||
if ( last && ! select.children('option[value=' + last + ']').length )
|
||||
select.append('<option id="display_lastname" value="' + last + '">' + last + '</option>');
|
||||
if ( first && last ) {
|
||||
if ( ! select.children('option[value=' + first + ' ' + last + ']').length )
|
||||
select.append('<option id="display_firstlast" value="' + first + ' ' + last + '">' + first + ' ' + last + '</option>');
|
||||
if ( ! select.children('option[value=' + last + ' ' + first + ']').length )
|
||||
select.append('<option id="display_lastfirst" value="' + last + ' ' + first + '">' + last + ' ' + first + '</option>');
|
||||
$('.color-palette').click(function(){$(this).siblings('input[name="admin_color"]').prop('checked', true)});
|
||||
$('#first_name, #last_name, #nickname').blur(function(){
|
||||
var select = $('#display_name'), current = select.find('option:selected').attr('id'), 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;
|
||||
}
|
||||
$('#'+sel).attr('selected', 'selected');
|
||||
|
||||
$('option', select).remove();
|
||||
$.each(inputs, function( id, value ) {
|
||||
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
|
||||
|
||||
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
|
||||
dub.push(val);
|
||||
$('<option />', {
|
||||
'id': id,
|
||||
'text': val,
|
||||
'selected': (id == current)
|
||||
}).appendTo( select );
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
(function(a){function b(){var e=a("#pass1").val(),d=a("#user_login").val(),c=a("#pass2").val(),f;a("#pass-strength-result").removeClass("short bad good strong");if(!e){a("#pass-strength-result").html(pwsL10n.empty);return}f=passwordStrength(e,d,c);switch(f){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:a("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){a("#pass1").val("").keyup(b);a("#pass2").val("").keyup(b);a("#pass-strength-result").show();a(".color-palette").click(function(){a(this).siblings("input[name=admin_color]").attr("checked","checked")});a("#nickname").blur(function(){var e=a(this).val()||a("#user_login").val();var c=a("#display_name");var d=c.children("option:selected").attr("id");c.children("#display_nickname").remove();if(!c.children("option[value="+e+"]").length){c.append('<option id="display_nickname" value="'+e+'">'+e+"</option>")}a("#"+d).attr("selected","selected")});a("#first_name, #last_name").blur(function(){var c=a("#display_name");var f=a("#first_name").val(),d=a("#last_name").val();var e=c.children("option:selected").attr("id");a("#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst").remove();if(f&&!c.children("option[value="+f+"]").length){c.append('<option id="display_firstname" value="'+f+'">'+f+"</option>")}if(d&&!c.children("option[value="+d+"]").length){c.append('<option id="display_lastname" value="'+d+'">'+d+"</option>")}if(f&&d){if(!c.children("option[value="+f+" "+d+"]").length){c.append('<option id="display_firstlast" value="'+f+" "+d+'">'+f+" "+d+"</option>")}if(!c.children("option[value="+d+" "+f+"]").length){c.append('<option id="display_lastfirst" value="'+d+" "+f+'">'+d+" "+f+"</option>")}}a("#"+e).attr("selected","selected")})})})(jQuery);
|
||||
(function(a){function b(){var e=a("#pass1").val(),d=a("#user_login").val(),c=a("#pass2").val(),f;a("#pass-strength-result").removeClass("short bad good strong");if(!e){a("#pass-strength-result").html(pwsL10n.empty);return}f=passwordStrength(e,d,c);switch(f){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:a("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){a("#pass1").val("").keyup(b);a("#pass2").val("").keyup(b);a("#pass-strength-result").show();a(".color-palette").click(function(){a(this).siblings('input[name="admin_color"]').prop("checked",true)});a("#first_name, #last_name, #nickname").blur(function(){var c=a("#display_name"),e=c.find("option:selected").attr("id"),f=[],d={display_nickname:a("#nickname").val(),display_username:a("#user_login").val(),display_firstname:a("#first_name").val(),display_lastname:a("#last_name").val()};if(d.display_firstname&&d.display_lastname){d.display_firstlast=d.display_firstname+" "+d.display_lastname;d.display_lastfirst=d.display_lastname+" "+d.display_firstname}a("option",c).remove();a.each(d,function(i,g){var h=g.replace(/<\/?[a-z][^>]*>/gi,"");if(d[i].length&&a.inArray(h,f)==-1){f.push(h);a("<option />",{id:i,text:h,selected:(i==e)}).appendTo(c)}})})})})(jQuery);
|
|
@ -259,7 +259,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20110113' );
|
||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20110628' );
|
||||
$scripts->add_data( 'user-profile', 'group', 1 );
|
||||
|
||||
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110131' );
|
||||
|
|
Loading…
Reference in New Issue