Fix JShint errors in user-profile.js.
props dougwollison. fixes #26016. git-svn-id: https://develop.svn.wordpress.org/trunk@26266 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
114e544ffb
commit
9cf1790265
@ -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() );
|
||||||
|
Loading…
Reference in New Issue
Block a user