Edit File by line
/home/barbar84/public_h.../wp-admin/js
File: customize-controls.js
/**
[0] Fix | Delete
* @output wp-admin/js/customize-controls.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
/* global _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer, console, confirm */
[4] Fix | Delete
(function( exports, $ ){
[5] Fix | Delete
var Container, focus, normalizedTransitionendEventName, api = wp.customize;
[6] Fix | Delete
[7] Fix | Delete
api.OverlayNotification = api.Notification.extend(/** @lends wp.customize.OverlayNotification.prototype */{
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Whether the notification should show a loading spinner.
[11] Fix | Delete
*
[12] Fix | Delete
* @since 4.9.0
[13] Fix | Delete
* @var {boolean}
[14] Fix | Delete
*/
[15] Fix | Delete
loading: false,
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* A notification that is displayed in a full-screen overlay.
[19] Fix | Delete
*
[20] Fix | Delete
* @constructs wp.customize.OverlayNotification
[21] Fix | Delete
* @augments wp.customize.Notification
[22] Fix | Delete
*
[23] Fix | Delete
* @since 4.9.0
[24] Fix | Delete
*
[25] Fix | Delete
* @param {string} code - Code.
[26] Fix | Delete
* @param {Object} params - Params.
[27] Fix | Delete
*/
[28] Fix | Delete
initialize: function( code, params ) {
[29] Fix | Delete
var notification = this;
[30] Fix | Delete
api.Notification.prototype.initialize.call( notification, code, params );
[31] Fix | Delete
notification.containerClasses += ' notification-overlay';
[32] Fix | Delete
if ( notification.loading ) {
[33] Fix | Delete
notification.containerClasses += ' notification-loading';
[34] Fix | Delete
}
[35] Fix | Delete
},
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* Render notification.
[39] Fix | Delete
*
[40] Fix | Delete
* @since 4.9.0
[41] Fix | Delete
*
[42] Fix | Delete
* @return {jQuery} Notification container.
[43] Fix | Delete
*/
[44] Fix | Delete
render: function() {
[45] Fix | Delete
var li = api.Notification.prototype.render.call( this );
[46] Fix | Delete
li.on( 'keydown', _.bind( this.handleEscape, this ) );
[47] Fix | Delete
return li;
[48] Fix | Delete
},
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Stop propagation on escape key presses, but also dismiss notification if it is dismissible.
[52] Fix | Delete
*
[53] Fix | Delete
* @since 4.9.0
[54] Fix | Delete
*
[55] Fix | Delete
* @param {jQuery.Event} event - Event.
[56] Fix | Delete
* @return {void}
[57] Fix | Delete
*/
[58] Fix | Delete
handleEscape: function( event ) {
[59] Fix | Delete
var notification = this;
[60] Fix | Delete
if ( 27 === event.which ) {
[61] Fix | Delete
event.stopPropagation();
[62] Fix | Delete
if ( notification.dismissible && notification.parent ) {
[63] Fix | Delete
notification.parent.remove( notification.code );
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
});
[68] Fix | Delete
[69] Fix | Delete
api.Notifications = api.Values.extend(/** @lends wp.customize.Notifications.prototype */{
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Whether the alternative style should be used.
[73] Fix | Delete
*
[74] Fix | Delete
* @since 4.9.0
[75] Fix | Delete
* @type {boolean}
[76] Fix | Delete
*/
[77] Fix | Delete
alt: false,
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* The default constructor for items of the collection.
[81] Fix | Delete
*
[82] Fix | Delete
* @since 4.9.0
[83] Fix | Delete
* @type {object}
[84] Fix | Delete
*/
[85] Fix | Delete
defaultConstructor: api.Notification,
[86] Fix | Delete
[87] Fix | Delete
/**
[88] Fix | Delete
* A collection of observable notifications.
[89] Fix | Delete
*
[90] Fix | Delete
* @since 4.9.0
[91] Fix | Delete
*
[92] Fix | Delete
* @constructs wp.customize.Notifications
[93] Fix | Delete
* @augments wp.customize.Values
[94] Fix | Delete
*
[95] Fix | Delete
* @param {Object} options - Options.
[96] Fix | Delete
* @param {jQuery} [options.container] - Container element for notifications. This can be injected later.
[97] Fix | Delete
* @param {boolean} [options.alt] - Whether alternative style should be used when rendering notifications.
[98] Fix | Delete
*
[99] Fix | Delete
* @return {void}
[100] Fix | Delete
*/
[101] Fix | Delete
initialize: function( options ) {
[102] Fix | Delete
var collection = this;
[103] Fix | Delete
[104] Fix | Delete
api.Values.prototype.initialize.call( collection, options );
[105] Fix | Delete
[106] Fix | Delete
_.bindAll( collection, 'constrainFocus' );
[107] Fix | Delete
[108] Fix | Delete
// Keep track of the order in which the notifications were added for sorting purposes.
[109] Fix | Delete
collection._addedIncrement = 0;
[110] Fix | Delete
collection._addedOrder = {};
[111] Fix | Delete
[112] Fix | Delete
// Trigger change event when notification is added or removed.
[113] Fix | Delete
collection.bind( 'add', function( notification ) {
[114] Fix | Delete
collection.trigger( 'change', notification );
[115] Fix | Delete
});
[116] Fix | Delete
collection.bind( 'removed', function( notification ) {
[117] Fix | Delete
collection.trigger( 'change', notification );
[118] Fix | Delete
});
[119] Fix | Delete
},
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Get the number of notifications added.
[123] Fix | Delete
*
[124] Fix | Delete
* @since 4.9.0
[125] Fix | Delete
* @return {number} Count of notifications.
[126] Fix | Delete
*/
[127] Fix | Delete
count: function() {
[128] Fix | Delete
return _.size( this._value );
[129] Fix | Delete
},
[130] Fix | Delete
[131] Fix | Delete
/**
[132] Fix | Delete
* Add notification to the collection.
[133] Fix | Delete
*
[134] Fix | Delete
* @since 4.9.0
[135] Fix | Delete
*
[136] Fix | Delete
* @param {string|wp.customize.Notification} notification - Notification object to add. Alternatively code may be supplied, and in that case the second notificationObject argument must be supplied.
[137] Fix | Delete
* @param {wp.customize.Notification} [notificationObject] - Notification to add when first argument is the code string.
[138] Fix | Delete
* @return {wp.customize.Notification} Added notification (or existing instance if it was already added).
[139] Fix | Delete
*/
[140] Fix | Delete
add: function( notification, notificationObject ) {
[141] Fix | Delete
var collection = this, code, instance;
[142] Fix | Delete
if ( 'string' === typeof notification ) {
[143] Fix | Delete
code = notification;
[144] Fix | Delete
instance = notificationObject;
[145] Fix | Delete
} else {
[146] Fix | Delete
code = notification.code;
[147] Fix | Delete
instance = notification;
[148] Fix | Delete
}
[149] Fix | Delete
if ( ! collection.has( code ) ) {
[150] Fix | Delete
collection._addedIncrement += 1;
[151] Fix | Delete
collection._addedOrder[ code ] = collection._addedIncrement;
[152] Fix | Delete
}
[153] Fix | Delete
return api.Values.prototype.add.call( collection, code, instance );
[154] Fix | Delete
},
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* Add notification to the collection.
[158] Fix | Delete
*
[159] Fix | Delete
* @since 4.9.0
[160] Fix | Delete
* @param {string} code - Notification code to remove.
[161] Fix | Delete
* @return {api.Notification} Added instance (or existing instance if it was already added).
[162] Fix | Delete
*/
[163] Fix | Delete
remove: function( code ) {
[164] Fix | Delete
var collection = this;
[165] Fix | Delete
delete collection._addedOrder[ code ];
[166] Fix | Delete
return api.Values.prototype.remove.call( this, code );
[167] Fix | Delete
},
[168] Fix | Delete
[169] Fix | Delete
/**
[170] Fix | Delete
* Get list of notifications.
[171] Fix | Delete
*
[172] Fix | Delete
* Notifications may be sorted by type followed by added time.
[173] Fix | Delete
*
[174] Fix | Delete
* @since 4.9.0
[175] Fix | Delete
* @param {Object} args - Args.
[176] Fix | Delete
* @param {boolean} [args.sort=false] - Whether to return the notifications sorted.
[177] Fix | Delete
* @return {Array.<wp.customize.Notification>} Notifications.
[178] Fix | Delete
*/
[179] Fix | Delete
get: function( args ) {
[180] Fix | Delete
var collection = this, notifications, errorTypePriorities, params;
[181] Fix | Delete
notifications = _.values( collection._value );
[182] Fix | Delete
[183] Fix | Delete
params = _.extend(
[184] Fix | Delete
{ sort: false },
[185] Fix | Delete
args
[186] Fix | Delete
);
[187] Fix | Delete
[188] Fix | Delete
if ( params.sort ) {
[189] Fix | Delete
errorTypePriorities = { error: 4, warning: 3, success: 2, info: 1 };
[190] Fix | Delete
notifications.sort( function( a, b ) {
[191] Fix | Delete
var aPriority = 0, bPriority = 0;
[192] Fix | Delete
if ( ! _.isUndefined( errorTypePriorities[ a.type ] ) ) {
[193] Fix | Delete
aPriority = errorTypePriorities[ a.type ];
[194] Fix | Delete
}
[195] Fix | Delete
if ( ! _.isUndefined( errorTypePriorities[ b.type ] ) ) {
[196] Fix | Delete
bPriority = errorTypePriorities[ b.type ];
[197] Fix | Delete
}
[198] Fix | Delete
if ( aPriority !== bPriority ) {
[199] Fix | Delete
return bPriority - aPriority; // Show errors first.
[200] Fix | Delete
}
[201] Fix | Delete
return collection._addedOrder[ b.code ] - collection._addedOrder[ a.code ]; // Show newer notifications higher.
[202] Fix | Delete
});
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
return notifications;
[206] Fix | Delete
},
[207] Fix | Delete
[208] Fix | Delete
/**
[209] Fix | Delete
* Render notifications area.
[210] Fix | Delete
*
[211] Fix | Delete
* @since 4.9.0
[212] Fix | Delete
* @return {void}
[213] Fix | Delete
*/
[214] Fix | Delete
render: function() {
[215] Fix | Delete
var collection = this,
[216] Fix | Delete
notifications, hadOverlayNotification = false, hasOverlayNotification, overlayNotifications = [],
[217] Fix | Delete
previousNotificationsByCode = {},
[218] Fix | Delete
listElement, focusableElements;
[219] Fix | Delete
[220] Fix | Delete
// Short-circuit if there are no container to render into.
[221] Fix | Delete
if ( ! collection.container || ! collection.container.length ) {
[222] Fix | Delete
return;
[223] Fix | Delete
}
[224] Fix | Delete
[225] Fix | Delete
notifications = collection.get( { sort: true } );
[226] Fix | Delete
collection.container.toggle( 0 !== notifications.length );
[227] Fix | Delete
[228] Fix | Delete
// Short-circuit if there are no changes to the notifications.
[229] Fix | Delete
if ( collection.container.is( collection.previousContainer ) && _.isEqual( notifications, collection.previousNotifications ) ) {
[230] Fix | Delete
return;
[231] Fix | Delete
}
[232] Fix | Delete
[233] Fix | Delete
// Make sure list is part of the container.
[234] Fix | Delete
listElement = collection.container.children( 'ul' ).first();
[235] Fix | Delete
if ( ! listElement.length ) {
[236] Fix | Delete
listElement = $( '<ul></ul>' );
[237] Fix | Delete
collection.container.append( listElement );
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
// Remove all notifications prior to re-rendering.
[241] Fix | Delete
listElement.find( '> [data-code]' ).remove();
[242] Fix | Delete
[243] Fix | Delete
_.each( collection.previousNotifications, function( notification ) {
[244] Fix | Delete
previousNotificationsByCode[ notification.code ] = notification;
[245] Fix | Delete
});
[246] Fix | Delete
[247] Fix | Delete
// Add all notifications in the sorted order.
[248] Fix | Delete
_.each( notifications, function( notification ) {
[249] Fix | Delete
var notificationContainer;
[250] Fix | Delete
if ( wp.a11y && ( ! previousNotificationsByCode[ notification.code ] || ! _.isEqual( notification.message, previousNotificationsByCode[ notification.code ].message ) ) ) {
[251] Fix | Delete
wp.a11y.speak( notification.message, 'assertive' );
[252] Fix | Delete
}
[253] Fix | Delete
notificationContainer = $( notification.render() );
[254] Fix | Delete
notification.container = notificationContainer;
[255] Fix | Delete
listElement.append( notificationContainer ); // @todo Consider slideDown() as enhancement.
[256] Fix | Delete
[257] Fix | Delete
if ( notification.extended( api.OverlayNotification ) ) {
[258] Fix | Delete
overlayNotifications.push( notification );
[259] Fix | Delete
}
[260] Fix | Delete
});
[261] Fix | Delete
hasOverlayNotification = Boolean( overlayNotifications.length );
[262] Fix | Delete
[263] Fix | Delete
if ( collection.previousNotifications ) {
[264] Fix | Delete
hadOverlayNotification = Boolean( _.find( collection.previousNotifications, function( notification ) {
[265] Fix | Delete
return notification.extended( api.OverlayNotification );
[266] Fix | Delete
} ) );
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
if ( hasOverlayNotification !== hadOverlayNotification ) {
[270] Fix | Delete
$( document.body ).toggleClass( 'customize-loading', hasOverlayNotification );
[271] Fix | Delete
collection.container.toggleClass( 'has-overlay-notifications', hasOverlayNotification );
[272] Fix | Delete
if ( hasOverlayNotification ) {
[273] Fix | Delete
collection.previousActiveElement = document.activeElement;
[274] Fix | Delete
$( document ).on( 'keydown', collection.constrainFocus );
[275] Fix | Delete
} else {
[276] Fix | Delete
$( document ).off( 'keydown', collection.constrainFocus );
[277] Fix | Delete
}
[278] Fix | Delete
}
[279] Fix | Delete
[280] Fix | Delete
if ( hasOverlayNotification ) {
[281] Fix | Delete
collection.focusContainer = overlayNotifications[ overlayNotifications.length - 1 ].container;
[282] Fix | Delete
collection.focusContainer.prop( 'tabIndex', -1 );
[283] Fix | Delete
focusableElements = collection.focusContainer.find( ':focusable' );
[284] Fix | Delete
if ( focusableElements.length ) {
[285] Fix | Delete
focusableElements.first().focus();
[286] Fix | Delete
} else {
[287] Fix | Delete
collection.focusContainer.focus();
[288] Fix | Delete
}
[289] Fix | Delete
} else if ( collection.previousActiveElement ) {
[290] Fix | Delete
$( collection.previousActiveElement ).focus();
[291] Fix | Delete
collection.previousActiveElement = null;
[292] Fix | Delete
}
[293] Fix | Delete
[294] Fix | Delete
collection.previousNotifications = notifications;
[295] Fix | Delete
collection.previousContainer = collection.container;
[296] Fix | Delete
collection.trigger( 'rendered' );
[297] Fix | Delete
},
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* Constrain focus on focus container.
[301] Fix | Delete
*
[302] Fix | Delete
* @since 4.9.0
[303] Fix | Delete
*
[304] Fix | Delete
* @param {jQuery.Event} event - Event.
[305] Fix | Delete
* @return {void}
[306] Fix | Delete
*/
[307] Fix | Delete
constrainFocus: function constrainFocus( event ) {
[308] Fix | Delete
var collection = this, focusableElements;
[309] Fix | Delete
[310] Fix | Delete
// Prevent keys from escaping.
[311] Fix | Delete
event.stopPropagation();
[312] Fix | Delete
[313] Fix | Delete
if ( 9 !== event.which ) { // Tab key.
[314] Fix | Delete
return;
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
focusableElements = collection.focusContainer.find( ':focusable' );
[318] Fix | Delete
if ( 0 === focusableElements.length ) {
[319] Fix | Delete
focusableElements = collection.focusContainer;
[320] Fix | Delete
}
[321] Fix | Delete
[322] Fix | Delete
if ( ! $.contains( collection.focusContainer[0], event.target ) || ! $.contains( collection.focusContainer[0], document.activeElement ) ) {
[323] Fix | Delete
event.preventDefault();
[324] Fix | Delete
focusableElements.first().focus();
[325] Fix | Delete
} else if ( focusableElements.last().is( event.target ) && ! event.shiftKey ) {
[326] Fix | Delete
event.preventDefault();
[327] Fix | Delete
focusableElements.first().focus();
[328] Fix | Delete
} else if ( focusableElements.first().is( event.target ) && event.shiftKey ) {
[329] Fix | Delete
event.preventDefault();
[330] Fix | Delete
focusableElements.last().focus();
[331] Fix | Delete
}
[332] Fix | Delete
}
[333] Fix | Delete
});
[334] Fix | Delete
[335] Fix | Delete
api.Setting = api.Value.extend(/** @lends wp.customize.Setting.prototype */{
[336] Fix | Delete
[337] Fix | Delete
/**
[338] Fix | Delete
* Default params.
[339] Fix | Delete
*
[340] Fix | Delete
* @since 4.9.0
[341] Fix | Delete
* @var {object}
[342] Fix | Delete
*/
[343] Fix | Delete
defaults: {
[344] Fix | Delete
transport: 'refresh',
[345] Fix | Delete
dirty: false
[346] Fix | Delete
},
[347] Fix | Delete
[348] Fix | Delete
/**
[349] Fix | Delete
* A Customizer Setting.
[350] Fix | Delete
*
[351] Fix | Delete
* A setting is WordPress data (theme mod, option, menu, etc.) that the user can
[352] Fix | Delete
* draft changes to in the Customizer.
[353] Fix | Delete
*
[354] Fix | Delete
* @see PHP class WP_Customize_Setting.
[355] Fix | Delete
*
[356] Fix | Delete
* @constructs wp.customize.Setting
[357] Fix | Delete
* @augments wp.customize.Value
[358] Fix | Delete
*
[359] Fix | Delete
* @since 3.4.0
[360] Fix | Delete
*
[361] Fix | Delete
* @param {string} id - The setting ID.
[362] Fix | Delete
* @param {*} value - The initial value of the setting.
[363] Fix | Delete
* @param {Object} [options={}] - Options.
[364] Fix | Delete
* @param {string} [options.transport=refresh] - The transport to use for previewing. Supports 'refresh' and 'postMessage'.
[365] Fix | Delete
* @param {boolean} [options.dirty=false] - Whether the setting should be considered initially dirty.
[366] Fix | Delete
* @param {Object} [options.previewer] - The Previewer instance to sync with. Defaults to wp.customize.previewer.
[367] Fix | Delete
*/
[368] Fix | Delete
initialize: function( id, value, options ) {
[369] Fix | Delete
var setting = this, params;
[370] Fix | Delete
params = _.extend(
[371] Fix | Delete
{ previewer: api.previewer },
[372] Fix | Delete
setting.defaults,
[373] Fix | Delete
options || {}
[374] Fix | Delete
);
[375] Fix | Delete
[376] Fix | Delete
api.Value.prototype.initialize.call( setting, value, params );
[377] Fix | Delete
[378] Fix | Delete
setting.id = id;
[379] Fix | Delete
setting._dirty = params.dirty; // The _dirty property is what the Customizer reads from.
[380] Fix | Delete
setting.notifications = new api.Notifications();
[381] Fix | Delete
[382] Fix | Delete
// Whenever the setting's value changes, refresh the preview.
[383] Fix | Delete
setting.bind( setting.preview );
[384] Fix | Delete
},
[385] Fix | Delete
[386] Fix | Delete
/**
[387] Fix | Delete
* Refresh the preview, respective of the setting's refresh policy.
[388] Fix | Delete
*
[389] Fix | Delete
* If the preview hasn't sent a keep-alive message and is likely
[390] Fix | Delete
* disconnected by having navigated to a non-allowed URL, then the
[391] Fix | Delete
* refresh transport will be forced when postMessage is the transport.
[392] Fix | Delete
* Note that postMessage does not throw an error when the recipient window
[393] Fix | Delete
* fails to match the origin window, so using try/catch around the
[394] Fix | Delete
* previewer.send() call to then fallback to refresh will not work.
[395] Fix | Delete
*
[396] Fix | Delete
* @since 3.4.0
[397] Fix | Delete
* @access public
[398] Fix | Delete
*
[399] Fix | Delete
* @return {void}
[400] Fix | Delete
*/
[401] Fix | Delete
preview: function() {
[402] Fix | Delete
var setting = this, transport;
[403] Fix | Delete
transport = setting.transport;
[404] Fix | Delete
[405] Fix | Delete
if ( 'postMessage' === transport && ! api.state( 'previewerAlive' ).get() ) {
[406] Fix | Delete
transport = 'refresh';
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
if ( 'postMessage' === transport ) {
[410] Fix | Delete
setting.previewer.send( 'setting', [ setting.id, setting() ] );
[411] Fix | Delete
} else if ( 'refresh' === transport ) {
[412] Fix | Delete
setting.previewer.refresh();
[413] Fix | Delete
}
[414] Fix | Delete
},
[415] Fix | Delete
[416] Fix | Delete
/**
[417] Fix | Delete
* Find controls associated with this setting.
[418] Fix | Delete
*
[419] Fix | Delete
* @since 4.6.0
[420] Fix | Delete
* @return {wp.customize.Control[]} Controls associated with setting.
[421] Fix | Delete
*/
[422] Fix | Delete
findControls: function() {
[423] Fix | Delete
var setting = this, controls = [];
[424] Fix | Delete
api.control.each( function( control ) {
[425] Fix | Delete
_.each( control.settings, function( controlSetting ) {
[426] Fix | Delete
if ( controlSetting.id === setting.id ) {
[427] Fix | Delete
controls.push( control );
[428] Fix | Delete
}
[429] Fix | Delete
} );
[430] Fix | Delete
} );
[431] Fix | Delete
return controls;
[432] Fix | Delete
}
[433] Fix | Delete
});
[434] Fix | Delete
[435] Fix | Delete
/**
[436] Fix | Delete
* Current change count.
[437] Fix | Delete
*
[438] Fix | Delete
* @alias wp.customize._latestRevision
[439] Fix | Delete
*
[440] Fix | Delete
* @since 4.7.0
[441] Fix | Delete
* @type {number}
[442] Fix | Delete
* @protected
[443] Fix | Delete
*/
[444] Fix | Delete
api._latestRevision = 0;
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Last revision that was saved.
[448] Fix | Delete
*
[449] Fix | Delete
* @alias wp.customize._lastSavedRevision
[450] Fix | Delete
*
[451] Fix | Delete
* @since 4.7.0
[452] Fix | Delete
* @type {number}
[453] Fix | Delete
* @protected
[454] Fix | Delete
*/
[455] Fix | Delete
api._lastSavedRevision = 0;
[456] Fix | Delete
[457] Fix | Delete
/**
[458] Fix | Delete
* Latest revisions associated with the updated setting.
[459] Fix | Delete
*
[460] Fix | Delete
* @alias wp.customize._latestSettingRevisions
[461] Fix | Delete
*
[462] Fix | Delete
* @since 4.7.0
[463] Fix | Delete
* @type {object}
[464] Fix | Delete
* @protected
[465] Fix | Delete
*/
[466] Fix | Delete
api._latestSettingRevisions = {};
[467] Fix | Delete
[468] Fix | Delete
/*
[469] Fix | Delete
* Keep track of the revision associated with each updated setting so that
[470] Fix | Delete
* requestChangesetUpdate knows which dirty settings to include. Also, once
[471] Fix | Delete
* ready is triggered and all initial settings have been added, increment
[472] Fix | Delete
* revision for each newly-created initially-dirty setting so that it will
[473] Fix | Delete
* also be included in changeset update requests.
[474] Fix | Delete
*/
[475] Fix | Delete
api.bind( 'change', function incrementChangedSettingRevision( setting ) {
[476] Fix | Delete
api._latestRevision += 1;
[477] Fix | Delete
api._latestSettingRevisions[ setting.id ] = api._latestRevision;
[478] Fix | Delete
} );
[479] Fix | Delete
api.bind( 'ready', function() {
[480] Fix | Delete
api.bind( 'add', function incrementCreatedSettingRevision( setting ) {
[481] Fix | Delete
if ( setting._dirty ) {
[482] Fix | Delete
api._latestRevision += 1;
[483] Fix | Delete
api._latestSettingRevisions[ setting.id ] = api._latestRevision;
[484] Fix | Delete
}
[485] Fix | Delete
} );
[486] Fix | Delete
} );
[487] Fix | Delete
[488] Fix | Delete
/**
[489] Fix | Delete
* Get the dirty setting values.
[490] Fix | Delete
*
[491] Fix | Delete
* @alias wp.customize.dirtyValues
[492] Fix | Delete
*
[493] Fix | Delete
* @since 4.7.0
[494] Fix | Delete
* @access public
[495] Fix | Delete
*
[496] Fix | Delete
* @param {Object} [options] Options.
[497] Fix | Delete
* @param {boolean} [options.unsaved=false] Whether only values not saved yet into a changeset will be returned (differential changes).
[498] Fix | Delete
* @return {Object} Dirty setting values.
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function