Ticket #26016: 26016.4.diff
File 26016.4.diff, 3.6 KB (added by , 11 years ago) |
---|
-
user-profile.js
1 /* global ajaxurl, pwsL10n, svgPainter */ 2 1 3 (function($){ 2 4 3 5 function check_pass_strength() { 4 var pass1 = $('#pass1').val(), user = $('#user_login').val(),pass2 = $('#pass2').val(), strength;6 var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength; 5 7 6 8 $('#pass-strength-result').removeClass('short bad good strong'); 7 9 if ( ! pass1 ) { … … 13 15 14 16 switch ( strength ) { 15 17 case 2: 16 $('#pass-strength-result').addClass('bad').html( pwsL10n ['bad']);18 $('#pass-strength-result').addClass('bad').html( pwsL10n.bad ); 17 19 break; 18 20 case 3: 19 $('#pass-strength-result').addClass('good').html( pwsL10n ['good']);21 $('#pass-strength-result').addClass('good').html( pwsL10n.good ); 20 22 break; 21 23 case 4: 22 $('#pass-strength-result').addClass('strong').html( pwsL10n ['strong']);24 $('#pass-strength-result').addClass('strong').html( pwsL10n.strong ); 23 25 break; 24 26 case 5: 25 $('#pass-strength-result').addClass('short').html( pwsL10n ['mismatch']);27 $('#pass-strength-result').addClass('short').html( pwsL10n.mismatch ); 26 28 break; 27 29 default: 28 30 $('#pass-strength-result').addClass('short').html( pwsL10n['short'] ); … … 30 32 } 31 33 32 34 $(document).ready( function() { 33 var select = $('#display_name'); 35 var select = $('#display_name'), 36 $colorpicker, 37 $stylesheet, 38 user_id, 39 current_user_id; 34 40 35 41 $('#pass1').val('').keyup( check_pass_strength ); 36 42 $('#pass2').val('').keyup( check_pass_strength ); … … 50 56 }; 51 57 52 58 if ( inputs.display_firstname && inputs.display_lastname ) { 53 inputs ['display_firstlast']= inputs.display_firstname + ' ' + inputs.display_lastname;54 inputs ['display_lastfirst']= inputs.display_lastname + ' ' + inputs.display_firstname;59 inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname; 60 inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname; 55 61 } 56 62 57 63 $.each( $('option', select), function( i, el ){ … … 59 65 }); 60 66 61 67 $.each(inputs, function( id, value ) { 62 if ( ! value ) 68 if ( ! value ) { 63 69 return; 70 } 64 71 65 72 var val = value.replace(/<\/?[a-z][^>]*>/gi, ''); 66 73 67 if ( inputs[id].length && $.inArray( val, dub ) == -1 ) {74 if ( inputs[id].length && $.inArray( val, dub ) === -1 ) { 68 75 dub.push(val); 69 76 $('<option />', { 70 77 'text': val … … 74 81 }); 75 82 } 76 83 77 var $colorpicker = $( '#color-picker' ),78 $stylesheet = $( '#colors-css' ),79 user_id = $( 'input#user_id' ).val(),80 84 $colorpicker = $( '#color-picker' ); 85 $stylesheet = $( '#colors-css' ); 86 user_id = $( 'input#user_id' ).val(); 87 current_user_id = $( 'input[name="checkuser_id"]' ).val(); 81 88 82 89 // dropdown toggle 83 90 $colorpicker.on( 'click', '.dropdown-current', function() { … … 89 96 var color_scheme = $( this ).children( 'input[name="admin_color"]' ).val(); 90 97 91 98 // update selected 92 $( this ).siblings( '.selected' ).removeClass( 'selected' ) 99 $( this ).siblings( '.selected' ).removeClass( 'selected' ); 93 100 $( this ).addClass( 'selected' ); 94 101 $( this ).find( 'input' ).prop( 'checked', true ); 95 102 … … 99 106 $colorpicker.toggleClass( 'picker-expanded' ); 100 107 101 108 // preview/save color scheme 102 if ( user_id == current_user_id ) {109 if ( user_id === current_user_id ) { 103 110 104 111 // repaint icons 105 112 $stylesheet.attr( 'href', $( this ).children( '.css_url' ).val() );