Changeset 20123
- Timestamp:
- 03/06/2012 02:49:02 AM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 4 edited
-
class-wp-customize.php (modified) (1 diff)
-
js/customize-base.dev.js (modified) (3 diffs)
-
js/customize-controls.dev.js (modified) (5 diffs)
-
js/customize-preview.dev.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize.php
r20110 r20123 123 123 // @todo: Perhaps grab the URL via $_POST? 124 124 'parent' => esc_url( admin_url( 'themes.php' ) ), 125 'values' => array(), 125 126 ); 127 128 foreach ( $this->settings as $id => $setting ) { 129 $settings['values'][ $id ] = $setting->value(); 130 } 131 126 132 ?> 127 133 <script type="text/javascript"> -
trunk/wp-includes/js/customize-base.dev.js
r20034 r20123 439 439 add: api.ValueFactory(), 440 440 441 initialize: function( url, options ) {441 initialize: function( url, targetWindow, options ) { 442 442 $.extend( this, options || {} ); 443 443 444 444 this.add( 'url', url ); 445 this.add( 'targetWindow', targetWindow || null ); 445 446 this.add( 'origin' ).link( 'url', function( url ) { 446 447 return url().replace( /([^:]+:\/\/[^\/]+).*/, '$1' ); … … 454 455 var message; 455 456 456 console.log( 'messenger receiveMessage', arguments );457 458 457 // @todo: remove, this is done in the postMessage plugin. 459 458 // if ( this.origin && event.origin !== this.origin ) … … 471 470 return; 472 471 473 console.log( 'sending message', id, data );474 472 message = JSON.stringify({ id: id, data: data }); 475 $.postMessage( message, this.url(), this.targetWindow || null);473 $.postMessage( message, this.url(), this.targetWindow() ); 476 474 }, 477 475 bind: function( id, callback ) { -
trunk/wp-includes/js/customize-controls.dev.js
r20121 r20123 60 60 this.container = this.iframe.parent(); 61 61 62 api.Messenger.prototype.initialize.call( this, params.url, { 63 targetWindow: this.iframe[0].contentWindow 64 }); 62 api.Messenger.prototype.initialize.call( this, params.url, this.iframe[0].contentWindow ); 65 63 66 64 this._formOriginalProps = { … … 101 99 delete this.loading; 102 100 this.iframe.prop( 'name', this.name ); 101 this.targetWindow( this.iframe[0].contentWindow ); 103 102 }, 104 103 refresh: function() { … … 128 127 129 128 var controls = $('[name^="' + api.settings.prefix + '"]'), 130 previewer, pickers, validateColor ;129 previewer, pickers, validateColor, sendSetting; 131 130 132 131 // Initialize Previewer … … 147 146 148 147 setting.bind( previewer.refresh ); 148 149 149 150 }); 150 151 … … 197 198 }); 198 199 199 // Fetch prefixed settings.200 $('[name^="' + api.settings.prefix + '"]').each( function() {201 // console.log( this.name);200 // Background color uses postMessage by default 201 api('background_color').unbind( previewer.refresh ).bind( function() { 202 previewer.send( 'setting', [ 'background_color', this() ] ); 202 203 }); 203 204 }); -
trunk/wp-includes/js/customize-preview.dev.js
r19995 r20123 52 52 53 53 $( function() { 54 var preview; 54 if ( ! api.settings ) 55 return; 56 57 var preview, body; 55 58 56 59 preview = new api.Preview( api.settings.parent ); 60 61 $.each( api.settings.values, function( id, value ) { 62 api.set( id, value ); 63 }); 64 65 preview.bind( 'setting', function( args ) { 66 api.set.apply( api, args ); 67 }); 68 69 body = $(document.body); 70 // Auto update background color by default 71 api.bind( 'background_color', function( to ) { 72 body.css( 'background-color', '#' + to ); 73 }); 57 74 }); 58 75
Note: See TracChangeset
for help on using the changeset viewer.