Changeset 21033
- Timestamp:
- 06/08/2012 10:59:48 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/customize-controls.dev.js
r21031 r21033 302 302 api.Messenger.prototype.initialize.call( this, params, options ); 303 303 304 this.add( 'previewUrl', params.previewUrl ); 305 304 306 this.bind( 'ready', function() { 305 307 ready = true; … … 311 313 params.query = $.extend( params.query || {}, { customize_messenger_channel: this.channel() }); 312 314 313 this.request = $.ajax( this. url(), {315 this.request = $.ajax( this.previewUrl(), { 314 316 type: 'POST', 315 317 data: params.query, … … 330 332 // Check if the location response header differs from the current URL. 331 333 // If so, the request was redirected; try loading the requested page. 332 if ( location && location != self. url() ) {334 if ( location && location != self.previewUrl() ) { 333 335 deferred.rejectWith( self, [ 'redirect', location ] ); 334 336 return; … … 411 413 /** 412 414 * Requires params: 413 * - container - a selector or jQuery element414 * - url- the URL of preview frame415 * - container - a selector or jQuery element 416 * - previewUrl - the URL of preview frame 415 417 */ 416 418 initialize: function( params, options ) { … … 458 460 this.allowedUrls = params.allowedUrls; 459 461 460 url = params.url; 461 delete params.url; 462 params.url = window.location.href; 462 463 463 464 api.Messenger.prototype.initialize.call( this, params ); 464 465 // We're dynamically generating the iframe, so the origin is set466 // to the current window's location, not the url's.467 this.origin.unlink( this.url ).set( window.location.href );468 465 469 466 this.add( 'scheme', this.origin() ).link( this.origin ).setter( function( to ) { … … 480 477 // ssl certs. 481 478 482 this. url.setter( function( to ) {479 this.add( 'previewUrl', params.previewUrl ).setter( function( to ) { 483 480 var result; 484 481 … … 505 502 }); 506 503 507 // Set the url.508 this.url( url );509 510 504 // Refresh the preview when the URL is changed (but not yet). 511 this. url.bind( this.refresh );505 this.previewUrl.bind( this.refresh ); 512 506 513 507 this.scroll = 0; … … 517 511 518 512 // Update the URL when the iframe sends a URL message. 519 this.bind( 'url', this. url );513 this.bind( 'url', this.previewUrl ); 520 514 }, 521 515 … … 535 529 536 530 this.loading = new api.PreviewFrame({ 537 url: this.url(), 538 query: this.query() || {}, 539 previewer: this 531 url: this.url(), 532 previewUrl: this.previewUrl(), 533 query: this.query() || {}, 534 previewer: this 540 535 }); 541 536 … … 543 538 // 'this' is the loading frame 544 539 this.bind( 'synced', function() { 545 if ( self. iframe)546 self. iframe.destroy();547 self. iframe= this;540 if ( self.preview ) 541 self.preview.destroy(); 542 self.preview = this; 548 543 delete self.loading; 549 544 … … 560 555 this.loading.fail( function( reason, location ) { 561 556 if ( 'redirect' === reason && location ) 562 self. url( location );557 self.previewUrl( location ); 563 558 564 559 if ( 'logged out' === reason ) { 565 if ( self. iframe) {566 self. iframe.destroy();567 delete self. iframe;560 if ( self.preview ) { 561 self.preview.destroy(); 562 delete self.preview; 568 563 } 569 564 … … 649 644 container: '#customize-preview', 650 645 form: '#customize-controls', 651 url:api.settings.url.preview,646 previewUrl: api.settings.url.preview, 652 647 allowedUrls: api.settings.url.allowed 653 648 }, { … … 681 676 // Check if the user is logged out. 682 677 if ( '0' === response ) { 683 self. iframe.iframe.hide();678 self.preview.iframe.hide(); 684 679 self.login().done( function() { 685 680 self.save(); 686 self. iframe.iframe.show();681 self.preview.iframe.show(); 687 682 }); 688 683 return; … … 718 713 719 714 // Check if preview url is valid and load the preview frame. 720 if ( previewer. url() )715 if ( previewer.previewUrl() ) 721 716 previewer.refresh(); 722 717 else 723 previewer. url( api.settings.url.home );718 previewer.previewUrl( api.settings.url.home ); 724 719 725 720 // Save and activated states -
trunk/wp-includes/js/customize-base.dev.js
r21029 r21033 193 193 194 194 setter: function( callback ) { 195 var from = this.get(); 195 196 this._setter = callback; 196 this.set( this.get() ); 197 // Temporarily clear value so setter can decide if it's valid. 198 this._value = null; 199 this.set( from ); 197 200 return this; 198 201 },
Note: See TracChangeset
for help on using the changeset viewer.