Customizer: Add loading indicators for the Customizer preview.

props Fab1en, westonruter.
fixes #31196.

git-svn-id: https://develop.svn.wordpress.org/trunk@31697 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2015-03-10 15:55:28 +00:00
parent 3bb3d2f1a5
commit 557ecd19c6
4 changed files with 56 additions and 3 deletions
+24 -1
View File
@@ -501,6 +501,7 @@ final class WP_Customize_Manager {
add_action( 'wp', array( $this, 'customize_preview_override_404_status' ) );
add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
add_action( 'wp_head', array( $this, 'customize_preview_html5' ) );
add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) );
add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
add_filter( 'wp_die_handler', array( $this, 'remove_preview_signature' ) );
@@ -543,7 +544,7 @@ final class WP_Customize_Manager {
}
/**
* Print a workaround to handle HTML5 tags in IE < 9
* Print a workaround to handle HTML5 tags in IE < 9.
*
* @since 3.4.0
*/
@@ -560,6 +561,25 @@ final class WP_Customize_Manager {
<![endif]--><?php
}
/**
* Print CSS for loading indicators for the Customizer preview.
*
* @since 4.2.0
*/
public function customize_preview_loading_style() {
?><style>
body.wp-customizer-unloading {
opacity: 0.25;
cursor: progress !important;
-webkit-transition: opacity 0.5s;
transition: opacity 0.5s;
}
body.wp-customizer-unloading * {
pointer-events: none !important;
}
</style><?php
}
/**
* Print JavaScript settings for preview frame.
*
@@ -572,6 +592,9 @@ final class WP_Customize_Manager {
'activePanels' => array(),
'activeSections' => array(),
'activeControls' => array(),
'l10n' => array(
'loading' => __( 'Loading ...' ),
),
);
if ( 2 == $this->nonce_tick ) {