]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-content/themes/twentytwelve/js/theme-customizer.js
Wordpress 3.5
[autoinstalls/wordpress.git] / wp-content / themes / twentytwelve / js / theme-customizer.js
1 /**
2  * Theme Customizer enhancements for a better user experience.
3  *
4  * Contains handlers to make Theme Customizer preview reload changes asynchronously.
5  * Things like site title, description, and background color changes.
6  */
7
8 ( function( $ ) {
9         // Site title and description.
10         wp.customize( 'blogname', function( value ) {
11                 value.bind( function( to ) {
12                         $( '.site-title a' ).html( to );
13                 } );
14         } );
15         wp.customize( 'blogdescription', function( value ) {
16                 value.bind( function( to ) {
17                         $( '.site-description' ).html( to );
18                 } );
19         } );
20
21         // Hook into background color change and adjust body class value as needed.
22         wp.customize( 'background_color', function( value ) {
23                 value.bind( function( to ) {
24                         if ( '#ffffff' == to || '#fff' == to )
25                                 $( 'body' ).addClass( 'custom-background-white' );
26                         else if ( '' == to )
27                                 $( 'body' ).addClass( 'custom-background-empty' );
28                         else
29                                 $( 'body' ).removeClass( 'custom-background-empty custom-background-white' );
30                 } );
31         } );
32 } )( jQuery );