2013-12-05 23:01:10 +01:00
|
|
|
/* global ajaxurl, pwsL10n */
|
2012-08-23 02:04:18 +02:00
|
|
|
(function($){
|
|
|
|
|
|
|
|
function check_pass_strength() {
|
2013-11-19 05:40:10 +01:00
|
|
|
var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength;
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
$('#pass-strength-result').removeClass('short bad good strong');
|
|
|
|
if ( ! pass1 ) {
|
|
|
|
$('#pass-strength-result').html( pwsL10n.empty );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-09-28 08:47:10 +02:00
|
|
|
strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 );
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
switch ( strength ) {
|
|
|
|
case 2:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('good').html( pwsL10n.good );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2013-11-19 05:40:10 +01:00
|
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
|
2012-08-23 02:04:18 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready( function() {
|
2013-11-19 05:40:10 +01:00
|
|
|
var $colorpicker, $stylesheet, user_id, current_user_id,
|
|
|
|
select = $( '#display_name' );
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
$('#pass1').val('').keyup( check_pass_strength );
|
|
|
|
$('#pass2').val('').keyup( check_pass_strength );
|
|
|
|
$('#pass-strength-result').show();
|
|
|
|
$('.color-palette').click( function() {
|
|
|
|
$(this).siblings('input[name="admin_color"]').prop('checked', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( select.length ) {
|
|
|
|
$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
|
|
|
|
var 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 && inputs.display_lastname ) {
|
2013-11-19 05:40:10 +01:00
|
|
|
inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname;
|
|
|
|
inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname;
|
2012-08-23 02:04:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$.each( $('option', select), function( i, el ){
|
|
|
|
dub.push( el.value );
|
|
|
|
});
|
|
|
|
|
|
|
|
$.each(inputs, function( id, value ) {
|
2013-11-19 05:40:10 +01:00
|
|
|
if ( ! value ) {
|
2012-08-23 02:04:18 +02:00
|
|
|
return;
|
2013-11-19 05:40:10 +01:00
|
|
|
}
|
2012-08-23 02:04:18 +02:00
|
|
|
|
|
|
|
var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
|
|
|
|
|
2013-11-19 05:40:10 +01:00
|
|
|
if ( inputs[id].length && $.inArray( val, dub ) === -1 ) {
|
2012-08-23 02:04:18 +02:00
|
|
|
dub.push(val);
|
|
|
|
$('<option />', {
|
|
|
|
'text': val
|
|
|
|
}).appendTo( select );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-11-19 05:40:10 +01:00
|
|
|
$colorpicker = $( '#color-picker' );
|
|
|
|
$stylesheet = $( '#colors-css' );
|
|
|
|
user_id = $( 'input#user_id' ).val();
|
|
|
|
current_user_id = $( 'input[name="checkuser_id"]' ).val();
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
$colorpicker.on( 'click.colorpicker', '.color-option', function() {
|
2013-12-04 05:13:11 +01:00
|
|
|
var colors,
|
|
|
|
$this = $(this);
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
if ( $this.hasClass( 'selected' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
$this.siblings( '.selected' ).removeClass( 'selected' );
|
|
|
|
$this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true );
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
2013-12-01 20:50:09 +01:00
|
|
|
// Set color scheme
|
2013-11-19 05:40:10 +01:00
|
|
|
if ( user_id === current_user_id ) {
|
2013-12-01 20:50:09 +01:00
|
|
|
// Load the colors stylesheet
|
|
|
|
$stylesheet.attr( 'href', $this.children( '.css_url' ).val() );
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
|
|
|
// repaint icons
|
2013-12-05 23:01:10 +01:00
|
|
|
if ( typeof wp !== 'undefined' && wp.svgPainter ) {
|
2013-12-04 05:13:11 +01:00
|
|
|
try {
|
|
|
|
colors = $.parseJSON( $this.children( '.icon_colors' ).val() );
|
|
|
|
} catch ( error ) {}
|
|
|
|
|
|
|
|
if ( colors ) {
|
2013-12-05 23:01:10 +01:00
|
|
|
wp.svgPainter.setColors( colors );
|
|
|
|
wp.svgPainter.paint();
|
2013-12-04 05:13:11 +01:00
|
|
|
}
|
2013-12-01 20:50:09 +01:00
|
|
|
}
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
|
|
|
|
// update user option
|
|
|
|
$.post( ajaxurl, {
|
2013-12-02 20:45:10 +01:00
|
|
|
action: 'save-user-color-scheme',
|
|
|
|
color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
|
2013-12-07 08:46:21 +01:00
|
|
|
nonce: $('#color-nonce').val()
|
Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.
Color scheme selection on your own profile page gives you a preview and autosaves the selection.
Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.
Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.
props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.
Built from https://develop.svn.wordpress.org/trunk@26137
git-svn-id: http://core.svn.wordpress.org/trunk@26048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:38:38 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2012-08-23 02:04:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|