我想删除此支票->if ( value._dirty )
来自下面的代码片段,但它位于Wordpress核心文件(customize-controls.js line 1919)中
我不能编辑它,我需要从我的主题的自定义js文件中完成它,但我不知道如何完成,因为我想它应该被扩展并正确排队。代码:
// 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 );
}
}
});