Changeset 33911
- Timestamp:
- 09/05/2015 07:52:17 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r33902 r33911 4 4 5 5 /** 6 7 8 9 10 11 12 6 13 * @class 7 14 * @augments wp.customize.Value 8 15 * @augments wp.customize.Class 9 16 * 10 * @param options 11 * - previewer - The Previewer instance to sync with. 12 * - transport - The transport to use for previewing. Supports 'refresh' and 'postMessage'. 17 * @param {object} id The Setting ID. 18 * @param {object} value The initial value of the setting. 19 * @param {object} options.previewer The Previewer instance to sync with. 20 * @param {object} options.transport The transport to use for previewing. Supports 'refresh' and 'postMessage'. 21 * @param {object} options.dirty 13 22 */ 14 23 api.Setting = api.Value.extend({ … … 20 29 this._dirty = options.dirty || false; 21 30 31 22 32 this.bind( this.preview ); 23 33 }, 34 35 36 37 24 38 preview: function() { 25 39 switch ( this.transport ) { … … 271 285 272 286 /** 273 * Handle changes to the active state. 274 * 275 * This does not change the active state, it merely handles the behavior 276 * for when it does change. 287 * Active state change handler. 288 * 289 * Shows the container if it is active, hides it if not. 277 290 * 278 291 * To override by subclass, update the container's UI to reflect the provided active state. … … 1348 1361 * @augments wp.customize.Class 1349 1362 * 1350 * @param {string} id Unique identifier for the control instance.1351 * @param {object} options Options hash for the control instance.1363 * @param {string} id Unique identifier for the control instance. 1364 * @param {object} options Options hash for the control instance. 1352 1365 * @param {object} options.params 1353 * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.)1354 * @param {string} options.params.content The HTML content for the control.1355 * @param {string} options.params.priority Order of priority to show the control within the section.1366 * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.) 1367 * @param {string} options.params.content The HTML content for the control. 1368 * @param {string} options.params.priority Order of priority to show the control within the section. 1356 1369 * @param {string} options.params.active 1357 * @param {string} options.params.section 1370 * @param {string} options.params.section The ID of the section the control belongs to. 1371 * @param {string} options.params.settings.default The ID of the setting the control relates to. 1372 * @param {string} options.params.settings.data 1358 1373 * @param {string} options.params.label 1359 1374 * @param {string} options.params.description … … 1421 1436 api.utils.bubbleChildValueChanges( control, [ 'section', 'priority', 'active' ] ); 1422 1437 1423 // Associate this control with its settings when they are created 1438 /* 1439 * After all settings related to the control are available, 1440 * make them available on the control and embed the control into the page. 1441 */ 1424 1442 settings = $.map( control.params.settings, function( value ) { 1425 1443 return value; … … 1438 1456 }) ); 1439 1457 1458 1440 1459 control.deferred.embedded.done( function () { 1441 1460 control.ready(); … … 2574 2593 2575 2594 /** 2595 2596 2597 2576 2598 * @class 2577 2599 * @augments wp.customize.Messenger … … 2582 2604 sensitivity: 2000, 2583 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2584 2615 initialize: function( params, options ) { 2585 2616 var deferred = $.Deferred(); 2586 2617 2587 // This is the promise object. 2618 /* 2619 * Make the instance of the PreviewFrame the promise object 2620 * so other objects can easily interact with it. 2621 */ 2588 2622 deferred.promise( this ); 2589 2623 … … 2602 2636 }, 2603 2637 2638 2639 2640 2641 2642 2643 2604 2644 run: function( deferred ) { 2605 2645 var self = this, … … 2805 2845 2806 2846 /** 2807 * Requires params: 2808 * - container - a selector or jQuery element 2809 * - previewUrl - the URL of preview frame 2847 * @param {array} params.allowedUrls 2848 * @param {string} params.container A selector or jQuery element for the preview 2849 * frame to be placed. 2850 * @param {string} params.form 2851 * @param {string} params.previewUrl The URL to preview. 2852 * @param {string} params.signature 2853 * @param {object} options 2810 2854 */ 2811 2855 initialize: function( params, options ) { … … 2920 2964 }, 2921 2965 2966 2967 2968 2969 2970 2922 2971 query: function() {}, 2923 2972 … … 2929 2978 }, 2930 2979 2980 2981 2982 2931 2983 refresh: function() { 2932 2984 var self = this; … … 3141 3193 nonce: api.settings.nonce, 3142 3194 3195 3196 3197 3198 3199 3143 3200 query: function() { 3144 3201 var dirtyCustomized = {}; … … 3468 3525 } 3469 3526 3470 // Create a potential postMessage connection with the parent frame. 3527 /* 3528 * Create a postMessage connection with a parent frame, 3529 * in case the Customizer frame was opened with the Customize loader. 3530 * 3531 * @see wp.customize.Loader 3532 */ 3471 3533 parent = new api.Messenger({ 3472 3534 url: api.settings.url.parent, … … 3474 3536 }); 3475 3537 3476 // If we receive a 'back' event, we're inside an iframe. 3477 // Send any clicks to the 'Return' link to the parent page. 3538 /* 3539 * If we receive a 'back' event, we're inside an iframe. 3540 * Send any clicks to the 'Return' link to the parent page. 3541 */ 3478 3542 parent.bind( 'back', function() { 3479 3543 closeBtn.on( 'click.customize-controls-close', function( event ) { … … 3500 3564 } ); 3501 3565 3502 // When activated, let the loader handle redirecting the page. 3503 // If no loader exists, redirect the page ourselves (if a url exists). 3566 /* 3567 * When activated, let the loader handle redirecting the page. 3568 * If no loader exists, redirect the page ourselves (if a url exists). 3569 */ 3504 3570 api.bind( 'activated', function() { 3505 3571 if ( parent.targetWindow() ) -
trunk/src/wp-includes/class-wp-customize-setting.php
r33488 r33911 25 25 26 26 /** 27 28 27 29 * @access public 28 30 * @var string … … 75 77 public $dirty = false; 76 78 79 80 81 77 82 protected $id_data = array(); 78 83 … … 149 154 150 155 /** 151 * Handle previewing the setting. 156 * Set up filters for the setting so that the preview request 157 * will render the drafted changes. 152 158 * 153 159 * @since 3.4.0 -
trunk/src/wp-includes/js/customize-base.js
r33841 r33911 79 79 * If the class has a method called "instance", 80 80 * the return value from the class' constructor will be a function that 81 * calls invoked, along with all the object properties of the class. 81 * calls the "instance" method. 82 * 83 * It is also an object that has properties and methods inside it. 82 84 */ 83 85 if ( this.instance ) { … … 167 169 */ 168 170 api.Value = api.Class.extend({ 171 172 173 174 169 175 initialize: function( initial, options ) { 170 176 this._value = initial; // @todo: potentially change this to a this.set() call. … … 185 191 }, 186 192 193 194 195 196 197 187 198 get: function() { 188 199 return this._value; 189 200 }, 190 201 202 203 204 205 206 191 207 set: function( to ) { 192 208 var from = this._value; … … 231 247 }, 232 248 249 250 251 252 253 233 254 bind: function() { 234 255 this.callbacks.add.apply( this.callbacks, arguments ); … … 236 257 }, 237 258 259 260 261 262 263 238 264 unbind: function() { 239 265 this.callbacks.remove.apply( this.callbacks, arguments ); … … 284 310 */ 285 311 api.Values = api.Class.extend({ 312 313 314 315 316 317 286 318 defaultConstructor: api.Value, 287 319 … … 348 380 this._value[ id ] = value; 349 381 value.parent = this; 382 383 350 384 if ( value.extended( api.Value ) ) 351 385 value.bind( this._change ); … … 373 407 }, 374 408 409 410 411 412 413 414 375 415 each: function( callback, context ) { 376 416 context = typeof context === 'undefined' ? this : context; … … 454 494 }, 455 495 496 497 498 499 456 500 _change: function() { 457 501 this.parent.trigger( 'change', this ); … … 459 503 }); 460 504 505 461 506 $.extend( api.Values.prototype, api.Events ); 462 507 … … 571 616 572 617 /** 573 * Messenger for postMessage.618 * r postMessage. 574 619 * 575 620 * @constuctor … … 650 695 }, 651 696 697 698 699 700 701 652 702 receive: function( event ) { 653 703 var message; … … 680 730 }, 681 731 732 733 734 735 736 737 682 738 send: function( id, data ) { 683 739 var message; … … 699 755 $.extend( api.Messenger.prototype, api.Events ); 700 756 701 // Core customize object.757 // . 702 758 api = $.extend( new api.Values(), api ); 759 760 761 762 763 764 703 765 api.get = function() { 704 766 var result = {}; -
trunk/src/wp-includes/js/customize-loader.js
r33709 r33911 116 116 this.body.addClass('customize-loading'); 117 117 118 // Dirty state of Customizer in iframe 118 /* 119 * Track the dirtiness state (whether the drafted changes have been published) 120 * of the Customizer in the iframe. This is used to decide whether to display 121 * an AYS alert if the user tries to close the window before saving changes. 122 */ 119 123 this.saved = new api.Value( true ); 120 124 -
trunk/src/wp-includes/js/customize-preview.js
r33709 r33911 112 112 }); 113 113 114 115 116 117 114 118 api.preview.send( 'ready', { 115 119 activePanels: api.settings.activePanels,
Note: See TracChangeset
for help on using the changeset viewer.