diff --git src/wp-admin/customize.php src/wp-admin/customize.php
index 7828ee4..6496367 100644
|
|
|
endif; |
| 78 | 78 | |
| 79 | 79 | $is_ios = wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ); |
| 80 | 80 | |
| 81 | | if ( $is_ios ) |
| | 81 | if ( $is_ios ) { |
| 82 | 82 | $body_class .= ' ios'; |
| | 83 | } |
| 83 | 84 | |
| 84 | | if ( is_rtl() ) |
| 85 | | $body_class .= ' rtl'; |
| | 85 | if ( is_rtl() ) { |
| | 86 | $body_class .= ' rtl'; |
| | 87 | } |
| 86 | 88 | $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
| 87 | 89 | |
| 88 | | $admin_title = sprintf( __( '%1$s — WordPress' ), strip_tags( sprintf( __( 'Customize %s' ), $wp_customize->theme()->display('Name') ) ) ); |
| | 90 | if ( $wp_customize->is_theme_active() ) { |
| | 91 | $document_title_tmpl = _x( 'Customize: %s', 'Placeholder is the document title from the preview' ); |
| | 92 | } else { |
| | 93 | $document_title_tmpl = _x( 'Live Preview: %s', 'Placeholder is the document title from the preview' ); |
| | 94 | } |
| | 95 | $document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // because exported to JS and assigned to document.title |
| | 96 | $admin_title = sprintf( $document_title_tmpl, __( 'Loading…' ) ); |
| | 97 | |
| 89 | 98 | ?><title><?php echo $admin_title; ?></title> |
| 90 | 99 | |
| 91 | 100 | <script type="text/javascript"> |
| … |
… |
do_action( 'customize_controls_print_scripts' ); |
| 253 | 262 | 'save' => wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ), |
| 254 | 263 | 'preview' => wp_create_nonce( 'preview-customize_' . $wp_customize->get_stylesheet() ) |
| 255 | 264 | ), |
| | 265 | 'documentTitleTmpl' => $document_title_tmpl, |
| 256 | 266 | ); |
| 257 | 267 | |
| 258 | 268 | // Prepare Customize Setting objects to pass to Javascript. |
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index fad223e..3d912e1 100644
|
|
|
|
| 763 | 763 | }()); |
| 764 | 764 | |
| 765 | 765 | /** |
| | 766 | * Set the document title of the customizer |
| | 767 | * |
| | 768 | * @param {string} documentTitle |
| | 769 | */ |
| | 770 | api.setDocumentTitle = function ( documentTitle ) { |
| | 771 | var tmpl, title; |
| | 772 | tmpl = api.settings.documentTitleTmpl; |
| | 773 | title = tmpl.replace( '%s', documentTitle ); |
| | 774 | document.title = title; |
| | 775 | if ( window !== window.parent ) { |
| | 776 | window.parent.document.title = document.title; |
| | 777 | } |
| | 778 | }; |
| | 779 | |
| | 780 | /** |
| 766 | 781 | * @constructor |
| 767 | 782 | * @augments wp.customize.Messenger |
| 768 | 783 | * @augments wp.customize.Class |
| … |
… |
|
| 877 | 892 | |
| 878 | 893 | // Update the URL when the iframe sends a URL message. |
| 879 | 894 | this.bind( 'url', this.previewUrl ); |
| | 895 | |
| | 896 | // Update the document title when the preview changes |
| | 897 | this.bind( 'documentTitle', function ( title ) { |
| | 898 | api.setDocumentTitle( title ); |
| | 899 | } ); |
| 880 | 900 | }, |
| 881 | 901 | |
| 882 | 902 | query: function() {}, |
diff --git src/wp-includes/js/customize-loader.js src/wp-includes/js/customize-loader.js
index f0dbfdc..07f2196 100644
|
|
|
window.wp = window.wp || {}; |
| 78 | 78 | Loader.open( Loader.settings.url + '?' + hash ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | | if ( ! hash && ! $.support.history ){ |
| | 81 | if ( ! hash && ! $.support.history ) { |
| 82 | 82 | Loader.close(); |
| 83 | 83 | } |
| 84 | 84 | }, |
| … |
… |
window.wp = window.wp || {}; |
| 105 | 105 | return window.location = src; |
| 106 | 106 | } |
| 107 | 107 | |
| | 108 | // Store the document title prior to opening the Live Preview |
| | 109 | this.originalDocumentTitle = document.title; |
| | 110 | |
| 108 | 111 | this.active = true; |
| 109 | 112 | this.body.addClass('customize-loading'); |
| 110 | 113 | |
| … |
… |
window.wp = window.wp || {}; |
| 134 | 137 | } else { |
| 135 | 138 | Loader.close(); |
| 136 | 139 | } |
| 137 | | } ); |
| | 140 | }); |
| 138 | 141 | |
| 139 | 142 | // Prompt AYS dialog when navigating away |
| 140 | 143 | $( window ).on( 'beforeunload', this.beforeunload ); |
| … |
… |
window.wp = window.wp || {}; |
| 158 | 161 | }, |
| 159 | 162 | |
| 160 | 163 | pushState: function ( src ) { |
| 161 | | var hash; |
| | 164 | var hash = src.split( '?' )[1]; |
| 162 | 165 | |
| 163 | 166 | // Ensure we don't call pushState if the user hit the forward button. |
| 164 | 167 | if ( $.support.history && window.location.href !== src ) { |
| 165 | 168 | history.pushState( { customize: src }, '', src ); |
| 166 | 169 | } else if ( ! $.support.history && $.support.hashchange && hash ) { |
| 167 | | hash = src.split( '?' )[1]; |
| 168 | 170 | window.location.hash = 'wp_customize=on&' + hash; |
| 169 | 171 | } |
| | 172 | |
| | 173 | this.trigger( 'open' ); |
| 170 | 174 | }, |
| 171 | 175 | |
| 172 | 176 | /** |
| … |
… |
window.wp = window.wp || {}; |
| 195 | 199 | |
| 196 | 200 | this.trigger( 'close' ); |
| 197 | 201 | |
| | 202 | // Restore document title prior to opening the Live Preview |
| | 203 | if ( this.originalDocumentTitle ) { |
| | 204 | document.title = this.originalDocumentTitle; |
| | 205 | } |
| | 206 | |
| 198 | 207 | // Return focus to link that was originally clicked. |
| 199 | 208 | if ( this.link ) { |
| 200 | 209 | this.link.focus(); |
diff --git src/wp-includes/js/customize-preview.js src/wp-includes/js/customize-preview.js
index 6da26f4..3979f43 100644
|
|
|
|
| 101 | 101 | preview.send( 'synced' ); |
| 102 | 102 | }); |
| 103 | 103 | |
| 104 | | preview.bind( 'active', function() { |
| 105 | | if ( api.settings.nonce ) |
| 106 | | preview.send( 'nonce', api.settings.nonce ); |
| 107 | | }); |
| | 104 | preview.bind( 'active', function() { |
| | 105 | if ( api.settings.nonce ) { |
| | 106 | preview.send( 'nonce', api.settings.nonce ); |
| | 107 | } |
| | 108 | |
| | 109 | preview.send( 'documentTitle', document.title ); |
| | 110 | }); |
| 108 | 111 | |
| 109 | 112 | preview.send( 'ready', { |
| 110 | 113 | activeControls: api.settings.activeControls |