diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
index b3b4433..fbc5d16 100644
|
a
|
b
|
|
| 3 | 3 | var Container, focus, api = wp.customize; |
| 4 | 4 | |
| 5 | 5 | /** |
| | 6 | * A Customizer Setting. |
| | 7 | * |
| | 8 | * A setting is WordPress data (theme mod, option, menu, etc.) that the user can |
| | 9 | * draft changes to in the Customizer. |
| | 10 | * |
| | 11 | * @see PHP class WP_Customize_Setting. |
| | 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({ |
| 15 | 24 | initialize: function( id, value, options ) { |
| … |
… |
|
| 19 | 28 | this.transport = this.transport || 'refresh'; |
| 20 | 29 | this._dirty = options.dirty || false; |
| 21 | 30 | |
| | 31 | // Whenever the setting's value changes, refresh the preview. |
| 22 | 32 | this.bind( this.preview ); |
| 23 | 33 | }, |
| | 34 | |
| | 35 | /** |
| | 36 | * Refresh the preview, respective of the setting's refresh policy. |
| | 37 | */ |
| 24 | 38 | preview: function() { |
| 25 | 39 | switch ( this.transport ) { |
| 26 | 40 | case 'refresh': |
| … |
… |
|
| 1347 | 1361 | * @class |
| 1348 | 1362 | * @augments wp.customize.Class |
| 1349 | 1363 | * |
| 1350 | | * @param {string} id Unique identifier for the control instance. |
| 1351 | | * @param {object} options Options hash for the control instance. |
| | 1364 | * @param {string} id Unique identifier for the control instance. |
| | 1365 | * @param {object} options Options hash for the control instance. |
| 1352 | 1366 | * @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. |
| | 1367 | * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.) |
| | 1368 | * @param {string} options.params.content The HTML content for the control. |
| | 1369 | * @param {string} options.params.priority Order of priority to show the control within the section. |
| 1356 | 1370 | * @param {string} options.params.active |
| 1357 | | * @param {string} options.params.section |
| | 1371 | * @param {string} options.params.section The ID of the section the control belongs to. |
| | 1372 | * @param {string} options.params.settings.default The ID of the setting the control relates to. |
| | 1373 | * @param {string} options.params.settings.data |
| 1358 | 1374 | * @param {string} options.params.label |
| 1359 | 1375 | * @param {string} options.params.description |
| 1360 | 1376 | * @param {string} options.params.instanceNumber Order in which this instance was created in relation to other instances. |
| … |
… |
|
| 1420 | 1436 | |
| 1421 | 1437 | api.utils.bubbleChildValueChanges( control, [ 'section', 'priority', 'active' ] ); |
| 1422 | 1438 | |
| 1423 | | // Associate this control with its settings when they are created |
| | 1439 | // After all settings related to the control are available, |
| | 1440 | // make them available on the control and embed the control into the page. |
| 1424 | 1441 | settings = $.map( control.params.settings, function( value ) { |
| 1425 | 1442 | return value; |
| 1426 | 1443 | }); |
| … |
… |
|
| 1437 | 1454 | control.embed(); |
| 1438 | 1455 | }) ); |
| 1439 | 1456 | |
| | 1457 | // After the control is embedded on the page, invoke the "ready" method. |
| 1440 | 1458 | control.deferred.embedded.done( function () { |
| 1441 | 1459 | control.ready(); |
| 1442 | 1460 | }); |
| … |
… |
|
| 2928 | 2946 | } |
| 2929 | 2947 | }, |
| 2930 | 2948 | |
| | 2949 | /** |
| | 2950 | * Refresh the preview. |
| | 2951 | */ |
| 2931 | 2952 | refresh: function() { |
| 2932 | 2953 | var self = this; |
| 2933 | 2954 | |
| … |
… |
|
| 3137 | 3158 | |
| 3138 | 3159 | nonce: api.settings.nonce, |
| 3139 | 3160 | |
| | 3161 | /** |
| | 3162 | * Build the query to send along with the Preview request. |
| | 3163 | * |
| | 3164 | * @return {object} |
| | 3165 | */ |
| 3140 | 3166 | query: function() { |
| 3141 | 3167 | var dirtyCustomized = {}; |
| 3142 | 3168 | api.each( function ( value, key ) { |
diff --git a/src/wp-includes/js/customize-base.js b/src/wp-includes/js/customize-base.js
index 720a312..b4b9aca 100644
|
a
|
b
|
window.wp = window.wp || {}; |
| 78 | 78 | /* |
| 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 ) { |
| 84 | 86 | magic = function() { |
| … |
… |
window.wp = window.wp || {}; |
| 166 | 168 | * @constuctor |
| 167 | 169 | */ |
| 168 | 170 | api.Value = api.Class.extend({ |
| | 171 | /** |
| | 172 | * @param {mixed} initial The initial value. |
| | 173 | * @param {[type]} options |
| | 174 | */ |
| 169 | 175 | initialize: function( initial, options ) { |
| 170 | 176 | this._value = initial; // @todo: potentially change this to a this.set() call. |
| 171 | 177 | this.callbacks = $.Callbacks(); |
| … |
… |
window.wp = window.wp || {}; |
| 184 | 190 | return arguments.length ? this.set.apply( this, arguments ) : this.get(); |
| 185 | 191 | }, |
| 186 | 192 | |
| | 193 | /** |
| | 194 | * Get the value. |
| | 195 | * |
| | 196 | * @return {mixed} |
| | 197 | */ |
| 187 | 198 | get: function() { |
| 188 | 199 | return this._value; |
| 189 | 200 | }, |
| 190 | 201 | |
| | 202 | /** |
| | 203 | * Set the value and trigger all bound callbacks. |
| | 204 | * |
| | 205 | * @param {object} to New value. |
| | 206 | */ |
| 191 | 207 | set: function( to ) { |
| 192 | 208 | var from = this._value; |
| 193 | 209 | |
| … |
… |
window.wp = window.wp || {}; |
| 230 | 246 | return value; |
| 231 | 247 | }, |
| 232 | 248 | |
| | 249 | /** |
| | 250 | * Bind a function to be invoked whenever the value changes. |
| | 251 | * |
| | 252 | * @param {...Function} A function, or multiple functions, to add to the callback stack. |
| | 253 | */ |
| 233 | 254 | bind: function() { |
| 234 | 255 | this.callbacks.add.apply( this.callbacks, arguments ); |
| 235 | 256 | return this; |
| 236 | 257 | }, |
| 237 | 258 | |
| | 259 | /** |
| | 260 | * Unbind a previously bound function. |
| | 261 | * |
| | 262 | * @param {...Function} A function, or multiple functions, to add to the callback stack. |
| | 263 | */ |
| 238 | 264 | unbind: function() { |
| 239 | 265 | this.callbacks.remove.apply( this.callbacks, arguments ); |
| 240 | 266 | return this; |
| … |
… |
window.wp = window.wp || {}; |
| 283 | 309 | * @mixes wp.customize.Events |
| 284 | 310 | */ |
| 285 | 311 | api.Values = api.Class.extend({ |
| | 312 | |
| | 313 | /** |
| | 314 | * The default constructor for items of the collection. |
| | 315 | * |
| | 316 | * @type {object} |
| | 317 | */ |
| 286 | 318 | defaultConstructor: api.Value, |
| 287 | 319 | |
| 288 | 320 | initialize: function( options ) { |
| … |
… |
window.wp = window.wp || {}; |
| 372 | 404 | return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) ); |
| 373 | 405 | }, |
| 374 | 406 | |
| | 407 | /** |
| | 408 | * Iterate over all items in the collection invoking the provided callback. |
| | 409 | * |
| | 410 | * @param {Function} callback Function to invoke. |
| | 411 | * @param {object} context Object context to invoke the function with. Optional. |
| | 412 | */ |
| 375 | 413 | each: function( callback, context ) { |
| 376 | 414 | context = typeof context === 'undefined' ? this : context; |
| 377 | 415 | |
| … |
… |
window.wp = window.wp || {}; |
| 698 | 736 | // Add the Events mixin to api.Messenger. |
| 699 | 737 | $.extend( api.Messenger.prototype, api.Events ); |
| 700 | 738 | |
| 701 | | // Core customize object. |
| | 739 | // The main API object is also a collection of all customizer settings. |
| 702 | 740 | api = $.extend( new api.Values(), api ); |
| | 741 | |
| | 742 | /** |
| | 743 | * Get all settings. |
| | 744 | * |
| | 745 | * @return {object} |
| | 746 | */ |
| 703 | 747 | api.get = function() { |
| 704 | 748 | var result = {}; |
| 705 | 749 | |