Permalink
Browse files

User Profile JS cleanup, props dd32, fixes #17910 for 3.2

git-svn-id: http://svn.automattic.com/wordpress/trunk@18364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 4e0de4a commit b80ad7a9cf42f899249faba7e4cf40ed6e3549f9 azaozz committed Jun 28, 2011
Showing with 10 additions and 7 deletions.
  1. +8 −5 wp-admin/js/user-profile.dev.js
  2. +1 −1 wp-admin/js/user-profile.js
  3. +1 −1 wp-includes/script-loader.php
View
13 wp-admin/js/user-profile.dev.js
@@ -50,12 +50,15 @@
$('option', select).remove();
$.each(inputs, function( id, value ) {
- var selected;
+ var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
- if ( inputs[id].length && $.inArray( value, dub ) == -1 ) {
- dub.push(value);
- selected = id == current ? 'selected="selected"' : '';
- select.append('<option id="' + id + '" ' + selected + '">' + value + '</option>');
+ if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {
+ dub.push(val);
+ $('<option />', {
+ 'id': id,
+ 'text': val,
+ 'selected': (id == current)
+ }).appendTo( select );
}
});
});
View
2 wp-admin/js/user-profile.js
@@ -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"]').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,h){var g;if(d[i].length&&a.inArray(h,f)==-1){f.push(h);g=i==e?'selected="selected"':"";c.append('<option id="'+i+'" '+g+'">'+h+"</option>")}})})})})(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);
View
2 wp-includes/script-loader.php
@@ -266,7 +266,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' ), '20110524' );
+ $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' );

0 comments on commit b80ad7a

Please sign in to comment.