diff --git src/wp-admin/customize.php src/wp-admin/customize.php
index 1faf371..0c2a52e 100644
|
|
|
endif; |
| 68 | 68 | |
| 69 | 69 | $is_ios = wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ); |
| 70 | 70 | |
| 71 | | if ( $is_ios ) |
| | 71 | if ( $is_ios ) { |
| 72 | 72 | $body_class .= ' ios'; |
| | 73 | } |
| 73 | 74 | |
| 74 | | if ( is_rtl() ) |
| 75 | | $body_class .= ' rtl'; |
| | 75 | if ( is_rtl() ) { |
| | 76 | $body_class .= ' rtl'; |
| | 77 | } |
| 76 | 78 | $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
| 77 | 79 | |
| 78 | | $admin_title = sprintf( __( '%1$s — WordPress' ), strip_tags( sprintf( __( 'Customize %s' ), $wp_customize->theme()->display('Name') ) ) ); |
| | 80 | if ( $wp_customize->is_theme_active() ) { |
| | 81 | $document_title_tmpl = _x( 'Customize: {{title}} — WordPress', '{{title}} is for JS template' ); |
| | 82 | } else { |
| | 83 | $document_title_tmpl = sprintf( |
| | 84 | _x( 'Live Preview %s: {{title}} — WordPress', '%s is theme name, {{title}} is for JS template' ), |
| | 85 | strip_tags( $wp_customize->theme()->display( 'Name' ) ) |
| | 86 | ); |
| | 87 | } |
| | 88 | $document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); |
| | 89 | $admin_title = str_replace( '{{title}}', __( 'Loading…' ), $document_title_tmpl ); |
| | 90 | |
| 79 | 91 | ?><title><?php echo $admin_title; ?></title> |
| 80 | 92 | |
| 81 | 93 | <script type="text/javascript"> |
| … |
… |
do_action( 'customize_controls_print_scripts' ); |
| 230 | 242 | 'save' => wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ), |
| 231 | 243 | 'preview' => wp_create_nonce( 'preview-customize_' . $wp_customize->get_stylesheet() ) |
| 232 | 244 | ), |
| | 245 | 'documentTitleTmpl' => $document_title_tmpl, |
| 233 | 246 | ); |
| 234 | 247 | |
| 235 | 248 | // 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 4bfc252..c73b2a6 100644
|
|
|
|
| 685 | 685 | }; |
| 686 | 686 | }()); |
| 687 | 687 | |
| | 688 | /** |
| | 689 | * Set the document title of the customizer |
| | 690 | * |
| | 691 | * @param title |
| | 692 | */ |
| | 693 | api.setDocumentTitle = function ( documentTitle ) { |
| | 694 | var tmpl, title; |
| | 695 | tmpl = api.settings.documentTitleTmpl; |
| | 696 | title = tmpl.replace( '{{title}}', documentTitle ); |
| | 697 | document.title = title; |
| | 698 | if ( window !== window.parent ) { |
| | 699 | window.parent.document.title = document.title; |
| | 700 | } |
| | 701 | }; |
| | 702 | |
| 688 | 703 | api.Previewer = api.Messenger.extend({ |
| 689 | 704 | refreshBuffer: 250, |
| 690 | 705 | |
| … |
… |
|
| 794 | 809 | |
| 795 | 810 | // Update the URL when the iframe sends a URL message. |
| 796 | 811 | this.bind( 'url', this.previewUrl ); |
| | 812 | |
| | 813 | // Update the document title when the preview changes |
| | 814 | this.bind( 'documentTitle', function ( title ) { |
| | 815 | api.setDocumentTitle( title ); |
| | 816 | } ); |
| 797 | 817 | }, |
| 798 | 818 | |
| 799 | 819 | query: function() {}, |
diff --git src/wp-includes/js/customize-loader.js src/wp-includes/js/customize-loader.js
index cccf71a..8f84659 100644
|
|
|
window.wp = window.wp || {}; |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | 38 | // Add navigation listeners. |
| 39 | | if ( $.support.history ) |
| | 39 | if ( $.support.history ) { |
| 40 | 40 | this.window.on( 'popstate', Loader.popstate ); |
| | 41 | } |
| 41 | 42 | |
| 42 | 43 | if ( $.support.hashchange ) { |
| 43 | 44 | this.window.on( 'hashchange', Loader.hashchange ); |
| … |
… |
window.wp = window.wp || {}; |
| 47 | 48 | |
| 48 | 49 | popstate: function( e ) { |
| 49 | 50 | var state = e.originalEvent.state; |
| 50 | | if ( state && state.customize ) |
| | 51 | if ( state && state.customize ) { |
| 51 | 52 | Loader.open( state.customize ); |
| 52 | | else if ( Loader.active ) |
| | 53 | } else if ( Loader.active ) { |
| 53 | 54 | Loader.close(); |
| | 55 | } |
| 54 | 56 | }, |
| 55 | 57 | |
| 56 | 58 | hashchange: function() { |
| 57 | 59 | var hash = window.location.toString().split('#')[1]; |
| 58 | 60 | |
| 59 | | if ( hash && 0 === hash.indexOf( 'wp_customize=on' ) ) |
| | 61 | if ( hash && 0 === hash.indexOf( 'wp_customize=on' ) ) { |
| 60 | 62 | Loader.open( Loader.settings.url + '?' + hash ); |
| | 63 | } |
| 61 | 64 | |
| 62 | | if ( ! hash && ! $.support.history ) |
| | 65 | if ( ! hash && ! $.support.history ) { |
| 63 | 66 | Loader.close(); |
| | 67 | } |
| 64 | 68 | }, |
| 65 | 69 | |
| 66 | 70 | open: function( src ) { |
| 67 | 71 | var hash; |
| 68 | 72 | |
| 69 | | if ( this.active ) |
| | 73 | if ( this.active ) { |
| 70 | 74 | return; |
| | 75 | } |
| 71 | 76 | |
| 72 | 77 | // Load the full page on mobile devices. |
| 73 | | if ( Loader.settings.browser.mobile ) |
| | 78 | if ( Loader.settings.browser.mobile ) { |
| 74 | 79 | return window.location = src; |
| | 80 | } |
| | 81 | |
| | 82 | // Store the document title prior to opening the Live Preview |
| | 83 | this.originalDocumentTitle = document.title; |
| 75 | 84 | |
| 76 | 85 | this.active = true; |
| 77 | 86 | this.body.addClass('customize-loading'); |
| … |
… |
window.wp = window.wp || {}; |
| 92 | 101 | }); |
| 93 | 102 | |
| 94 | 103 | this.messenger.bind( 'close', function() { |
| 95 | | if ( $.support.history ) |
| | 104 | if ( $.support.history ) { |
| 96 | 105 | history.back(); |
| 97 | | else if ( $.support.hashchange ) |
| | 106 | } else if ( $.support.hashchange ) { |
| 98 | 107 | window.location.hash = ''; |
| 99 | | else |
| | 108 | } else { |
| 100 | 109 | Loader.close(); |
| | 110 | } |
| 101 | 111 | }); |
| 102 | 112 | |
| 103 | 113 | this.messenger.bind( 'activated', function( location ) { |
| 104 | | if ( location ) |
| | 114 | if ( location ) { |
| 105 | 115 | window.location = location; |
| | 116 | } |
| 106 | 117 | }); |
| 107 | 118 | |
| 108 | 119 | hash = src.split('?')[1]; |
| 109 | 120 | |
| 110 | 121 | // Ensure we don't call pushState if the user hit the forward button. |
| 111 | | if ( $.support.history && window.location.href !== src ) |
| | 122 | if ( $.support.history && window.location.href !== src ) { |
| 112 | 123 | history.pushState( { customize: src }, '', src ); |
| 113 | | else if ( ! $.support.history && $.support.hashchange && hash ) |
| | 124 | } else if ( ! $.support.history && $.support.hashchange && hash ) { |
| 114 | 125 | window.location.hash = 'wp_customize=on&' + hash; |
| | 126 | } |
| 115 | 127 | |
| 116 | 128 | this.trigger( 'open' ); |
| 117 | 129 | }, |
| … |
… |
window.wp = window.wp || {}; |
| 121 | 133 | }, |
| 122 | 134 | |
| 123 | 135 | close: function() { |
| 124 | | if ( ! this.active ) |
| | 136 | if ( ! this.active ) { |
| 125 | 137 | return; |
| | 138 | } |
| 126 | 139 | this.active = false; |
| 127 | 140 | |
| 128 | 141 | this.trigger( 'close' ); |
| 129 | 142 | |
| | 143 | // Restore document title prior to opening the Live Preview |
| | 144 | if ( this.originalDocumentTitle ) { |
| | 145 | document.title = this.originalDocumentTitle; |
| | 146 | } |
| | 147 | |
| 130 | 148 | // Return focus to link that was originally clicked. |
| 131 | | if ( this.link ) |
| | 149 | if ( this.link ) { |
| 132 | 150 | this.link.focus(); |
| | 151 | } |
| 133 | 152 | }, |
| 134 | 153 | |
| 135 | 154 | closed: function() { |
diff --git src/wp-includes/js/customize-preview.js src/wp-includes/js/customize-preview.js
index 1d274f9..1b47b78 100644
|
|
|
|
| 90 | 90 | preview.send( 'synced' ); |
| 91 | 91 | }); |
| 92 | 92 | |
| 93 | | preview.bind( 'active', function() { |
| 94 | | if ( api.settings.nonce ) |
| 95 | | preview.send( 'nonce', api.settings.nonce ); |
| 96 | | }); |
| | 93 | preview.bind( 'active', function() { |
| | 94 | if ( api.settings.nonce ) { |
| | 95 | preview.send( 'nonce', api.settings.nonce ); |
| | 96 | } |
| | 97 | |
| | 98 | preview.send( 'documentTitle', document.title ); |
| | 99 | }); |
| 97 | 100 | |
| 98 | 101 | preview.send( 'ready' ); |
| 99 | 102 | |