Make WordPress Core

Ticket #30726: 30726.patch

File 30726.patch, 2.0 KB (added by ocean90, 10 years ago)
  • src/wp-includes/js/customize-preview.js

     
    6767                if ( ! api.settings )
    6868                        return;
    6969
    70                 var preview, bg;
     70                var bg;
    7171
    72                 preview = new api.Preview({
     72                api.preview = new api.Preview({
    7373                        url: window.location.href,
    7474                        channel: api.settings.channel
    7575                });
    7676
    77                 preview.bind( 'settings', function( values ) {
     77                api.preview.bind( 'settings', function( values ) {
    7878                        $.each( values, function( id, value ) {
    7979                                if ( api.has( id ) )
    8080                                        api( id ).set( value );
     
    8383                        });
    8484                });
    8585
    86                 preview.trigger( 'settings', api.settings.values );
     86                api.preview.trigger( 'settings', api.settings.values );
    8787
    88                 preview.bind( 'setting', function( args ) {
     88                api.preview.bind( 'setting', function( args ) {
    8989                        var value;
    9090
    9191                        args = args.slice();
     
    9494                                value.set.apply( value, args );
    9595                });
    9696
    97                 preview.bind( 'sync', function( events ) {
     97                api.preview.bind( 'sync', function( events ) {
    9898                        $.each( events, function( event, args ) {
    99                                 preview.trigger( event, args );
     99                                api.preview.trigger( event, args );
    100100                        });
    101                         preview.send( 'synced' );
     101                        api.preview.send( 'synced' );
    102102                });
    103103
    104                 preview.bind( 'active', function() {
     104                api.preview.bind( 'active', function() {
    105105                        if ( api.settings.nonce ) {
    106                                 preview.send( 'nonce', api.settings.nonce );
     106                                api.preview.send( 'nonce', api.settings.nonce );
    107107                        }
    108108
    109                         preview.send( 'documentTitle', document.title );
     109                        api.preview.send( 'documentTitle', document.title );
    110110                });
    111111
    112                 preview.send( 'ready', {
     112                api.preview.send( 'ready', {
    113113                        activePanels: api.settings.activePanels,
    114114                        activeSections: api.settings.activeSections,
    115115                        activeControls: api.settings.activeControls
     
    154154                                this.bind( update );
    155155                        });
    156156                });
     157
     158                api.trigger( 'preview-ready' );
    157159        });
    158160
    159161})( wp, jQuery );