wp/wp-content/themes/twentythirteen/js/theme-customizer.js
author ymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 03:35:32 +0200
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
permissions -rw-r--r--
upgrade wordpress + plugins
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     2
 * Customizer enhancements for a better user experience.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     4
 * Contains handlers to make Customizer preview reload changes asynchronously.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * Things like site title and description changes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
( function( $ ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
	// Site title and description.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
	wp.customize( 'blogname', function( value ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
		value.bind( function( to ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
			$( '.site-title' ).text( to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
		} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
	} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
	wp.customize( 'blogdescription', function( value ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
		value.bind( function( to ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
			$( '.site-description' ).text( to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
		} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
	} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
	// Header text color.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
	wp.customize( 'header_textcolor', function( value ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
		value.bind( function( to ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
			if ( 'blank' == to ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    24
				if ( 'remove-header' == wp.customize.instance( 'header_image' ).get() ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
					$( '.home-link' ).css( 'min-height', '0' );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    26
				}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
				$( '.site-title, .site-description' ).css( {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
					'clip': 'rect(1px, 1px, 1px, 1px)',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
					'position': 'absolute'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
				} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
			} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
				$( '.home-link' ).css( 'min-height', '230px' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
				$( '.site-title, .site-description' ).css( {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
					'clip': 'auto',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
					'color': to,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
					'position': 'relative'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
				} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
		} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
	} );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
} )( jQuery );