WordPress/wp-admin/js/about.js
Matt Thomas 41b8584cd2 Updates to the About page:
* A live color scheme preview
* Replace the hard-coded version number
* Copy edits
* New screenshots
* Size adjustments to the header and WP badge
* Capitalize 'Open Sans'

See #26387, props markoheijnen, ryelle, siobhan, melchoyce.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-06 19:36:11 +00:00

52 lines
1.2 KiB
JavaScript

/* global isRtl */
(function($){
$(document).ready( function() {
var $colorpicker, $stylesheet;
$('.color-palette').click( function() {
$(this).siblings('input[name="admin_color"]').prop('checked', true);
});
$colorpicker = $( '#color-picker' );
$stylesheet = $( '#colors-css' );
if ( isRtl ){
$stylesheet = $( '#colors-rtl-css' );
}
$colorpicker.on( 'click.colorpicker', '.color-option', function() {
var colors, css_url,
$this = $(this);
if ( $this.hasClass( 'selected' ) ) {
return;
}
$this.siblings( '.selected' ).removeClass( 'selected' );
$this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true );
// Set color scheme
// Load the colors stylesheet
css_url = $this.children( '.css_url' ).val();
if ( isRtl ){
css_url = css_url.replace('.min', '-rtl.min');
}
$stylesheet.attr( 'href', css_url );
// repaint icons
if ( typeof wp !== 'undefined' && wp.svgPainter ) {
try {
colors = $.parseJSON( $this.children( '.icon_colors' ).val() );
} catch ( error ) {}
if ( colors ) {
wp.svgPainter.setColors( colors );
wp.svgPainter.paint();
}
}
});
});
})(jQuery);