Fix JShint errors in user-profile.js.

props dougwollison.
fixes #26016.

Built from https://develop.svn.wordpress.org/trunk@26266


git-svn-id: http://core.svn.wordpress.org/trunk@26172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-11-19 04:40:10 +00:00
parent 56f5b8b4ec
commit 42293a5c7c
2 changed files with 20 additions and 17 deletions

View File

@ -1,7 +1,8 @@
/* global ajaxurl, pwsL10n, svgPainter */
(function($){ (function($){
function check_pass_strength() { function check_pass_strength() {
var pass1 = $('#pass1').val(), user = $('#user_login').val(), pass2 = $('#pass2').val(), strength; var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength;
$('#pass-strength-result').removeClass('short bad good strong'); $('#pass-strength-result').removeClass('short bad good strong');
if ( ! pass1 ) { if ( ! pass1 ) {
@ -13,16 +14,16 @@
switch ( strength ) { switch ( strength ) {
case 2: case 2:
$('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] ); $('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
break; break;
case 3: case 3:
$('#pass-strength-result').addClass('good').html( pwsL10n['good'] ); $('#pass-strength-result').addClass('good').html( pwsL10n.good );
break; break;
case 4: case 4:
$('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] ); $('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
break; break;
case 5: case 5:
$('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] ); $('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
break; break;
default: default:
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] ); $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
@ -30,7 +31,8 @@
} }
$(document).ready( function() { $(document).ready( function() {
var select = $('#display_name'); var $colorpicker, $stylesheet, user_id, current_user_id,
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 );
@ -50,8 +52,8 @@
}; };
if ( inputs.display_firstname && inputs.display_lastname ) { if ( inputs.display_firstname && inputs.display_lastname ) {
inputs['display_firstlast'] = inputs.display_firstname + ' ' + inputs.display_lastname; inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname;
inputs['display_lastfirst'] = inputs.display_lastname + ' ' + inputs.display_firstname; inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname;
} }
$.each( $('option', select), function( i, el ){ $.each( $('option', select), function( i, el ){
@ -59,12 +61,13 @@
}); });
$.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, '');
if ( inputs[id].length && $.inArray( val, dub ) == -1 ) { if ( inputs[id].length && $.inArray( val, dub ) === -1 ) {
dub.push(val); dub.push(val);
$('<option />', { $('<option />', {
'text': val 'text': val
@ -74,10 +77,10 @@
}); });
} }
var $colorpicker = $( '#color-picker' ), $colorpicker = $( '#color-picker' );
$stylesheet = $( '#colors-css' ), $stylesheet = $( '#colors-css' );
user_id = $( 'input#user_id' ).val(), user_id = $( 'input#user_id' ).val();
current_user_id = $( 'input[name="checkuser_id"]' ).val(); current_user_id = $( 'input[name="checkuser_id"]' ).val();
// dropdown toggle // dropdown toggle
$colorpicker.on( 'click', '.dropdown-current', function() { $colorpicker.on( 'click', '.dropdown-current', function() {
@ -89,7 +92,7 @@
var color_scheme = $( this ).children( 'input[name="admin_color"]' ).val(); var color_scheme = $( this ).children( 'input[name="admin_color"]' ).val();
// update selected // update selected
$( this ).siblings( '.selected' ).removeClass( 'selected' ) $( this ).siblings( '.selected' ).removeClass( 'selected' );
$( this ).addClass( 'selected' ); $( this ).addClass( 'selected' );
$( this ).find( 'input' ).prop( 'checked', true ); $( this ).find( 'input' ).prop( 'checked', true );
@ -99,7 +102,7 @@
$colorpicker.toggleClass( 'picker-expanded' ); $colorpicker.toggleClass( 'picker-expanded' );
// preview/save color scheme // preview/save color scheme
if ( user_id == current_user_id ) { if ( user_id === current_user_id ) {
// repaint icons // repaint icons
$stylesheet.attr( 'href', $( this ).children( '.css_url' ).val() ); $stylesheet.attr( 'href', $( this ).children( '.css_url' ).val() );

View File

@ -1 +1 @@
!function(a){function b(){var b,c=a("#pass1").val(),d=(a("#user_login").val(),a("#pass2").val());if(a("#pass-strength-result").removeClass("short bad good strong"),!c)return a("#pass-strength-result").html(pwsL10n.empty),void 0;switch(b=wp.passwordStrength.meter(c,wp.passwordStrength.userInputBlacklist(),d)){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(){var c=a("#display_name");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",!0)}),c.length&&a("#first_name, #last_name, #nickname").bind("blur.user_profile",function(){var b=[],d={display_nickname:a("#nickname").val()||"",display_username:a("#user_login").val()||"",display_firstname:a("#first_name").val()||"",display_lastname:a("#last_name").val()||""};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.each(a("option",c),function(a,c){b.push(c.value)}),a.each(d,function(e,f){if(f){var g=f.replace(/<\/?[a-z][^>]*>/gi,"");d[e].length&&-1==a.inArray(g,b)&&(b.push(g),a("<option />",{text:g}).appendTo(c))}})});var d=a("#color-picker"),e=a("#colors-css"),f=a("input#user_id").val(),g=a('input[name="checkuser_id"]').val();d.on("click",".dropdown-current",function(){d.toggleClass("picker-expanded")}),d.on("click",".color-option",function(){var b=a(this).children('input[name="admin_color"]').val();a(this).siblings(".selected").removeClass("selected"),a(this).addClass("selected"),a(this).find("input").prop("checked",!0),d.find(".dropdown-current label").html(a(this).children("label").html()),d.find(".dropdown-current table").html(a(this).children("table").html()),d.toggleClass("picker-expanded"),f==g&&(e.attr("href",a(this).children(".css_url").val()),svgPainter.setColors(a.parseJSON(a(this).children(".icon_colors").val())),svgPainter.paint(),a.post(ajaxurl,{action:"save-user-color-scheme",color_scheme:b,user_id:f}))})})}(jQuery); !function(a){function b(){var b,c=a("#pass1").val(),d=a("#pass2").val();if(a("#pass-strength-result").removeClass("short bad good strong"),!c)return a("#pass-strength-result").html(pwsL10n.empty),void 0;switch(b=wp.passwordStrength.meter(c,wp.passwordStrength.userInputBlacklist(),d)){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(){var c,d,e,f,g=a("#display_name");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",!0)}),g.length&&a("#first_name, #last_name, #nickname").bind("blur.user_profile",function(){var b=[],c={display_nickname:a("#nickname").val()||"",display_username:a("#user_login").val()||"",display_firstname:a("#first_name").val()||"",display_lastname:a("#last_name").val()||""};c.display_firstname&&c.display_lastname&&(c.display_firstlast=c.display_firstname+" "+c.display_lastname,c.display_lastfirst=c.display_lastname+" "+c.display_firstname),a.each(a("option",g),function(a,c){b.push(c.value)}),a.each(c,function(d,e){if(e){var f=e.replace(/<\/?[a-z][^>]*>/gi,"");c[d].length&&-1===a.inArray(f,b)&&(b.push(f),a("<option />",{text:f}).appendTo(g))}})}),c=a("#color-picker"),d=a("#colors-css"),e=a("input#user_id").val(),f=a('input[name="checkuser_id"]').val(),c.on("click",".dropdown-current",function(){c.toggleClass("picker-expanded")}),c.on("click",".color-option",function(){var b=a(this).children('input[name="admin_color"]').val();a(this).siblings(".selected").removeClass("selected"),a(this).addClass("selected"),a(this).find("input").prop("checked",!0),c.find(".dropdown-current label").html(a(this).children("label").html()),c.find(".dropdown-current table").html(a(this).children("table").html()),c.toggleClass("picker-expanded"),e===f&&(d.attr("href",a(this).children(".css_url").val()),svgPainter.setColors(a.parseJSON(a(this).children(".icon_colors").val())),svgPainter.paint(),a.post(ajaxurl,{action:"save-user-color-scheme",color_scheme:b,user_id:e}))})})}(jQuery);