<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[18363] branches/3.1: User Profile JS cleanup, props dd32, fixes #17910 for 3.1</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/18363">18363</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2011-06-28 16:16:45 +0000 (Tue, 28 Jun 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>User Profile JS cleanup, props dd32, fixes <a href="http://trac.wordpress.org/ticket/17910">#17910</a> for 3.1</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches31wpadminjsuserprofiledevjs">branches/3.1/wp-admin/js/user-profile.dev.js</a></li>
<li><a href="#branches31wpadminjsuserprofilejs">branches/3.1/wp-admin/js/user-profile.js</a></li>
<li><a href="#branches31wpincludesscriptloaderphp">branches/3.1/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches31wpadminjsuserprofiledevjs"></a>
<div class="modfile"><h4>Modified: branches/3.1/wp-admin/js/user-profile.dev.js (18362 => 18363)</h4>
<pre class="diff"><span>
<span class="info">--- branches/3.1/wp-admin/js/user-profile.dev.js        2011-06-28 06:47:34 UTC (rev 18362)
+++ branches/3.1/wp-admin/js/user-profile.dev.js        2011-06-28 16:16:45 UTC (rev 18363)
</span><span class="lines">@@ -29,37 +29,39 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $(document).ready( function() {
</del><ins>+        $(document).ready(function() {
</ins><span class="cx">                 $('#pass1').val('').keyup( check_pass_strength );
</span><span class="cx">                 $('#pass2').val('').keyup( check_pass_strength );
</span><span class="cx">                 $('#pass-strength-result').show();
</span><del>-                $('.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('&lt;option id=&quot;display_nickname&quot; value=&quot;' + str + '&quot;&gt;' + str + '&lt;/option&gt;');
-                        $('#'+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 &amp;&amp; ! select.children('option[value=' + first + ']').length )
-                                select.append('&lt;option id=&quot;display_firstname&quot; value=&quot;' + first + '&quot;&gt;' + first + '&lt;/option&gt;');
-                        if ( last &amp;&amp; ! select.children('option[value=' + last + ']').length )
-                                select.append('&lt;option id=&quot;display_lastname&quot; value=&quot;' + last + '&quot;&gt;' + last + '&lt;/option&gt;');
-                        if ( first &amp;&amp; last ) {
-                                if ( ! select.children('option[value=' + first + ' ' + last + ']').length )
-                                        select.append('&lt;option id=&quot;display_firstlast&quot; value=&quot;' + first + ' ' + last + '&quot;&gt;' + first + ' ' + last + '&lt;/option&gt;');
-                                if ( ! select.children('option[value=' + last + ' ' + first + ']').length )
-                                        select.append('&lt;option id=&quot;display_lastfirst&quot; value=&quot;' + last + ' ' + first + '&quot;&gt;' + last + ' ' + first + '&lt;/option&gt;');
</del><ins>+                $('.color-palette').click(function(){$(this).siblings('input[name=&quot;admin_color&quot;]').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 &amp;&amp; inputs.display_lastname ) {
+                                inputs['display_firstlast'] = inputs.display_firstname + ' ' + inputs.display_lastname;
+                                inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname;
</ins><span class="cx">                         }
</span><del>-                        $('#'+sel).attr('selected', 'selected');
</del><ins>+
+                        $('option', select).remove();
+                        $.each(inputs, function( id, value ) {
+                                var val = value.replace(/&lt;\/?[a-z][^&gt;]*&gt;/gi, ''); 
+
+                                if ( inputs[id].length &amp;&amp; $.inArray( val, dub ) == -1 ) {
+                                        dub.push(val);
+                                        $('&lt;option /&gt;', {
+                                                  'id': id,
+                                                'text': val,
+                                                'selected': (id == current)
+                                        }).appendTo( select );
+                                }
+                        });
</ins><span class="cx">                 });
</span><del>-    });
</del><ins>+        });
</ins><span class="cx"> 
</span><span class="cx"> })(jQuery);
</span></span></pre></div>
<a id="branches31wpadminjsuserprofilejs"></a>
<div class="modfile"><h4>Modified: branches/3.1/wp-admin/js/user-profile.js (18362 => 18363)</h4>
<pre class="diff"><span>
<span class="info">--- branches/3.1/wp-admin/js/user-profile.js        2011-06-28 06:47:34 UTC (rev 18362)
+++ branches/3.1/wp-admin/js/user-profile.js        2011-06-28 16:16:45 UTC (rev 18363)
</span><span class="lines">@@ -1 +1 @@
</span><del>-(function(a){function b(){var e=a(&quot;#pass1&quot;).val(),d=a(&quot;#user_login&quot;).val(),c=a(&quot;#pass2&quot;).val(),f;a(&quot;#pass-strength-result&quot;).removeClass(&quot;short bad good strong&quot;);if(!e){a(&quot;#pass-strength-result&quot;).html(pwsL10n.empty);return}f=passwordStrength(e,d,c);switch(f){case 2:a(&quot;#pass-strength-result&quot;).addClass(&quot;bad&quot;).html(pwsL10n.bad);break;case 3:a(&quot;#pass-strength-result&quot;).addClass(&quot;good&quot;).html(pwsL10n.good);break;case 4:a(&quot;#pass-strength-result&quot;).addClass(&quot;strong&quot;).html(pwsL10n.strong);break;case 5:a(&quot;#pass-strength-result&quot;).addClass(&quot;short&quot;).html(pwsL10n.mismatch);break;default:a(&quot;#pass-strength-result&quot;).addClass(&quot;short&quot;).html(pwsL10n[&quot;short&quot;])}}a(document).ready(function(){a(&quot;#pass1&quot;).val(&quot;&quot;).keyup(b);a(&quot;#pass2&quot;).val(&quot;&quot;).keyup(b);a(&quot;#pass-strength-result&quot
 ;).show();a(&quot;.color-palette&quot;).click(function(){a(this).siblings(&quot;input[name=admin_color]&quot;).attr(&quot;checked&quot;,&quot;checked&quot;)});a(&quot;#nickname&quot;).blur(function(){var e=a(this).val()||a(&quot;#user_login&quot;).val();var c=a(&quot;#display_name&quot;);var d=c.children(&quot;option:selected&quot;).attr(&quot;id&quot;);c.children(&quot;#display_nickname&quot;).remove();if(!c.children(&quot;option[value=&quot;+e+&quot;]&quot;).length){c.append('&lt;option id=&quot;display_nickname&quot; value=&quot;'+e+'&quot;&gt;'+e+&quot;&lt;/option&gt;&quot;)}a(&quot;#&quot;+d).attr(&quot;selected&quot;,&quot;selected&quot;)});a(&quot;#first_name, #last_name&quot;).blur(function(){var c=a(&quot;#display_name&quot;);var f=a(&quot;#first_name&quot;).val(),d=a(&quot;#last_name&quot;).val();var e=c.children(&quot;option:selected&quot;).attr(&quot;id&quot;);a(&quot;#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst&quot;).remove();if
 (f&amp;&amp;!c.children(&quot;option[value=&quot;+f+&quot;]&quot;).length){c.append('&lt;option id=&quot;display_firstname&quot; value=&quot;'+f+'&quot;&gt;'+f+&quot;&lt;/option&gt;&quot;)}if(d&amp;&amp;!c.children(&quot;option[value=&quot;+d+&quot;]&quot;).length){c.append('&lt;option id=&quot;display_lastname&quot; value=&quot;'+d+'&quot;&gt;'+d+&quot;&lt;/option&gt;&quot;)}if(f&amp;&amp;d){if(!c.children(&quot;option[value=&quot;+f+&quot; &quot;+d+&quot;]&quot;).length){c.append('&lt;option id=&quot;display_firstlast&quot; value=&quot;'+f+&quot; &quot;+d+'&quot;&gt;'+f+&quot; &quot;+d+&quot;&lt;/option&gt;&quot;)}if(!c.children(&quot;option[value=&quot;+d+&quot; &quot;+f+&quot;]&quot;).length){c.append('&lt;option id=&quot;display_lastfirst&quot; value=&quot;'+d+&quot; &quot;+f+'&quot;&gt;'+d+&quot; &quot;+f+&quot;&lt;/option&gt;&quot;)}}a(&quot;#&quot;+e).attr(&quot;selected&quot;,&quot;selected&quot;)})})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+(function(a){function b(){var e=a(&quot;#pass1&quot;).val(),d=a(&quot;#user_login&quot;).val(),c=a(&quot;#pass2&quot;).val(),f;a(&quot;#pass-strength-result&quot;).removeClass(&quot;short bad good strong&quot;);if(!e){a(&quot;#pass-strength-result&quot;).html(pwsL10n.empty);return}f=passwordStrength(e,d,c);switch(f){case 2:a(&quot;#pass-strength-result&quot;).addClass(&quot;bad&quot;).html(pwsL10n.bad);break;case 3:a(&quot;#pass-strength-result&quot;).addClass(&quot;good&quot;).html(pwsL10n.good);break;case 4:a(&quot;#pass-strength-result&quot;).addClass(&quot;strong&quot;).html(pwsL10n.strong);break;case 5:a(&quot;#pass-strength-result&quot;).addClass(&quot;short&quot;).html(pwsL10n.mismatch);break;default:a(&quot;#pass-strength-result&quot;).addClass(&quot;short&quot;).html(pwsL10n[&quot;short&quot;])}}a(document).ready(function(){a(&quot;#pass1&quot;).val(&quot;&quot;).keyup(b);a(&quot;#pass2&quot;).val(&quot;&quot;).keyup(b);a(&quot;#pass-strength-result&quot
 ;).show();a(&quot;.color-palette&quot;).click(function(){a(this).siblings('input[name=&quot;admin_color&quot;]').prop(&quot;checked&quot;,true)});a(&quot;#first_name, #last_name, #nickname&quot;).blur(function(){var c=a(&quot;#display_name&quot;),e=c.find(&quot;option:selected&quot;).attr(&quot;id&quot;),f=[],d={display_nickname:a(&quot;#nickname&quot;).val(),display_username:a(&quot;#user_login&quot;).val(),display_firstname:a(&quot;#first_name&quot;).val(),display_lastname:a(&quot;#last_name&quot;).val()};if(d.display_firstname&amp;&amp;d.display_lastname){d.display_firstlast=d.display_firstname+&quot; &quot;+d.display_lastname;d.display_lastfirst=d.display_lastname+&quot; &quot;+d.display_firstname}a(&quot;option&quot;,c).remove();a.each(d,function(i,g){var h=g.replace(/&lt;\/?[a-z][^&gt;]*&gt;/gi,&quot;&quot;);if(d[i].length&amp;&amp;a.inArray(h,f)==-1){f.push(h);a(&quot;&lt;option /&gt;&quot;,{id:i,text:h,selected:(i==e)}).appendTo(c)}})})})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branches31wpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: branches/3.1/wp-includes/script-loader.php (18362 => 18363)</h4>
<pre class="diff"><span>
<span class="info">--- branches/3.1/wp-includes/script-loader.php        2011-06-28 06:47:34 UTC (rev 18362)
+++ branches/3.1/wp-includes/script-loader.php        2011-06-28 16:16:45 UTC (rev 18363)
</span><span class="lines">@@ -259,7 +259,7 @@
</span><span class="cx">                 'l10n_print_after' =&gt; 'try{convertEntities(pwsL10n);}catch(e){};'
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'user-profile', &quot;/wp-admin/js/user-profile$suffix.js&quot;, array( 'jquery', 'password-strength-meter' ), '20110113' );
</del><ins>+        $scripts-&gt;add( 'user-profile', &quot;/wp-admin/js/user-profile$suffix.js&quot;, array( 'jquery', 'password-strength-meter' ), '20110628' );
</ins><span class="cx">         $scripts-&gt;add_data( 'user-profile', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'admin-bar', &quot;/wp-includes/js/admin-bar$suffix.js&quot;, false, '20110131' );
</span></span></pre>
</div>
</div>

</body>
</html>