]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/customize-preview.js
WordPress 4.1
[autoinstalls/wordpress.git] / wp-includes / js / customize-preview.js
index 6da26f47a0ea994141d2f2e1945ed25ad53b258d..82f7bb862d965bce212d9899b51a7cf41206a1ea 100644 (file)
                if ( ! api.settings )
                        return;
 
-               var preview, bg;
+               var bg;
 
-               preview = new api.Preview({
+               api.preview = new api.Preview({
                        url: window.location.href,
                        channel: api.settings.channel
                });
 
-               preview.bind( 'settings', function( values ) {
+               api.preview.bind( 'settings', function( values ) {
                        $.each( values, function( id, value ) {
                                if ( api.has( id ) )
                                        api( id ).set( value );
@@ -83,9 +83,9 @@
                        });
                });
 
-               preview.trigger( 'settings', api.settings.values );
+               api.preview.trigger( 'settings', api.settings.values );
 
-               preview.bind( 'setting', function( args ) {
+               api.preview.bind( 'setting', function( args ) {
                        var value;
 
                        args = args.slice();
                                value.set.apply( value, args );
                });
 
-               preview.bind( 'sync', function( events ) {
+               api.preview.bind( 'sync', function( events ) {
                        $.each( events, function( event, args ) {
-                               preview.trigger( event, args );
+                               api.preview.trigger( event, args );
                        });
-                       preview.send( 'synced' );
+                       api.preview.send( 'synced' );
                });
 
-        preview.bind( 'active', function() {
-            if ( api.settings.nonce )
-                preview.send( 'nonce', api.settings.nonce );
-        });
+               api.preview.bind( 'active', function() {
+                       if ( api.settings.nonce ) {
+                               api.preview.send( 'nonce', api.settings.nonce );
+                       }
 
-               preview.send( 'ready', {
+                       api.preview.send( 'documentTitle', document.title );
+               });
+
+               api.preview.send( 'ready', {
+                       activePanels: api.settings.activePanels,
+                       activeSections: api.settings.activeSections,
                        activeControls: api.settings.activeControls
                } );
 
                                this.bind( update );
                        });
                });
+
+               api.trigger( 'preview-ready' );
        });
 
 })( wp, jQuery );