X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..b22765f41bf0b2021b9beb9120ee0ac91fa89292:/wp-includes/js/customize-loader.js diff --git a/wp-includes/js/customize-loader.js b/wp-includes/js/customize-loader.js index 2ee0c0f9..e7b411df 100644 --- a/wp-includes/js/customize-loader.js +++ b/wp-includes/js/customize-loader.js @@ -1,4 +1,8 @@ /* global _wpCustomizeLoaderSettings, confirm */ +/* + * Expose a public API that allows the customizer to be + * loaded on any page. + */ window.wp = window.wp || {}; (function( exports, $ ){ @@ -14,9 +18,9 @@ window.wp = window.wp || {}; * Allows the Customizer to be overlayed on any page. * * By default, any element in the body with the load-customize class will open - * the Customizer overlay with the URL specified. + * an iframe overlay with the URL specified. * - * e.g. Open customizer + * e.g. Open Customizer * * @augments wp.customize.Events */ @@ -45,7 +49,7 @@ window.wp = window.wp || {}; $('#wpbody').on( 'click', '.load-customize', function( event ) { event.preventDefault(); - // Store a reference to the link that opened the customizer. + // Store a reference to the link that opened the Customizer. Loader.link = $(this); // Load the theme. Loader.open( Loader.link.attr('href') ); @@ -78,7 +82,7 @@ window.wp = window.wp || {}; Loader.open( Loader.settings.url + '?' + hash ); } - if ( ! hash && ! $.support.history ){ + if ( ! hash && ! $.support.history ) { Loader.close(); } }, @@ -90,7 +94,7 @@ window.wp = window.wp || {}; }, /** - * Open the customizer overlay for a specific URL. + * Open the Customizer overlay for a specific URL. * * @param string src URL to load in the Customizer. */ @@ -105,13 +109,20 @@ window.wp = window.wp || {}; return window.location = src; } + // Store the document title prior to opening the Live Preview + this.originalDocumentTitle = document.title; + this.active = true; this.body.addClass('customize-loading'); - // Dirty state of customizer in iframe + /* + * Track the dirtiness state (whether the drafted changes have been published) + * of the Customizer in the iframe. This is used to decide whether to display + * an AYS alert if the user tries to close the window before saving changes. + */ this.saved = new api.Value( true ); - this.iframe = $( '