CoreFiles by mySites.guru
customize-preview.js41 lines, 1,061 bytes, from wordpress-4.4.21.zip
Raw History Compare with 4.4.20
md5
3241a807c07ff37024d5a318b14a54d0
sha1
3d6841cf69ef353ec5795a12c19eaafc7fec7cf5
sha256
8333988d0887ad636ebefc2ded0fb8fdb3f41310e2e785038c4ed9a4c9c6e583
/**
 * Live-update changed settings in real time in the Customizer preview.
 */

( function( $ ) {
	var style = $( '#twentysixteen-color-scheme-css' ),
		api = wp.customize;

	if ( ! style.length ) {
		style = $( 'head' ).append( '<style type="text/css" id="twentysixteen-color-scheme-css" />' )
		                    .find( '#twentysixteen-color-scheme-css' );
	}

	// Site title.
	api( 'blogname', function( value ) {
		value.bind( function( to ) {
			$( '.site-title a' ).text( to );
		} );
	} );

	// Site tagline.
	api( 'blogdescription', function( value ) {
		value.bind( function( to ) {
			$( '.site-description' ).text( to );
		} );
	} );

	// Add custom-background-image body class when background image is added.
	api( 'background_image', function( value ) {
		value.bind( function( to ) {
			$( 'body' ).toggleClass( 'custom-background-image', '' !== to );
		} );
	} );

	// Color Scheme CSS.
	api.bind( 'preview-ready', function() {
		api.preview.bind( 'update-color-scheme-css', function( css ) {
			style.html( css );
		} );
	} );
} )( jQuery );

The same content is in 410 releases, WordPress 4.4-beta1 to 5.3.2. See them all, or every version of this file.