I want to remove this check -> if ( value._dirty )
from code snippet below, but as it is located in Wordpress core file(customize-controls.js line 1919)
I can't edit that, I need to accomplish that from my theme's custom js file, but I don't know how, as I guess it should be extended and enqueued correctly. code:
// Initialize Previewer
api.previewer = new api.Previewer({
container: '#customize-preview',
form: '#customize-controls',
previewUrl: api.settings.url.preview,
allowedUrls: api.settings.url.allowed,
signature: 'WP_CUSTOMIZER_SIGNATURE'
}, {
nonce: api.settings.nonce,
query: function() {
var dirtyCustomized = {};
api.each( function ( value, key ) {
if ( value._dirty ) {
dirtyCustomized[ key ] = value();
}
} );
return {
wp_customize: 'on',
theme: api.settings.theme.stylesheet,
customized: JSON.stringify( dirtyCustomized ),
nonce: this.nonce.preview
};
},
save: function() {
var self = this,
query = $.extend( this.query(), {
action: 'customize_save',
nonce: this.nonce.save
} ),
processing = api.state( 'processing' ),
submitWhenDoneProcessing,
submit;
body.addClass( 'saving' );
submit = function () {
var request = $.post( api.settings.url.ajax, query );
api.trigger( 'save', request );
request.always( function () {
body.removeClass( 'saving' );
} );
request.done( function( response ) {
// Check if the user is logged out.
if ( '0' === response ) {
self.preview.iframe.hide();
self.login().done( function() {
self.save();
self.preview.iframe.show();
} );
return;
}
// Check for cheaters.
if ( '-1' === response ) {
self.cheatin();
return;
}
// Clear setting dirty states
api.each( function ( value ) {
value._dirty = false;
} );
api.trigger( 'saved' );
} );
};
if ( 0 === processing() ) {
submit();
} else {
submitWhenDoneProcessing = function () {
if ( 0 === processing() ) {
api.state.unbind( 'change', submitWhenDoneProcessing );
submit();
}
};
api.state.bind( 'change', submitWhenDoneProcessing );
}
}
});