Customizer: Nav Menus JS cleanup, second round

* Follow the same pattern of namespace instantiation that `WidgetCustomizerPreview` uses
* Remove use of `self` for global delegation
* Use `api` for `wp.customize` and import only top-level globals
* Bind `this` where appropriate and disambiguate scope

See #32911.

Built from https://develop.svn.wordpress.org/trunk@33347


git-svn-id: http://core.svn.wordpress.org/trunk@33319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-07-21 17:40:25 +00:00
parent 146befe7bf
commit 23712a822f
3 changed files with 252 additions and 249 deletions

View File

@ -1,8 +1,12 @@
/* global JSON, _wpCustomizePreviewNavMenusExports */
wp.customize.menusPreview = ( function( $, api ) {
( function( $, _, wp ) {
'use strict';
var currentRefreshDebounced = {},
if ( ! wp || ! wp.customize ) { return; }
var api = wp.customize,
currentRefreshDebounced = {},
refreshDebounceDelay = 200,
settings = {},
defaultSettings = {
@ -16,265 +20,264 @@ wp.customize.menusPreview = ( function( $, api ) {
stylesheet: ''
},
navMenuInstanceArgs: {}
},
self = {};
api.bind( 'preview-ready', function() {
api.preview.bind( 'active', function() {
self.init();
} );
} );
/**
* Bootstrap functionality.
*/
self.init = function() {
var self = this, initializedSettings = {};
settings = _.extend( {}, defaultSettings );
if ( 'undefined' !== typeof _wpCustomizePreviewNavMenusExports ) {
_.extend( settings, _wpCustomizePreviewNavMenusExports );
}
api.each( function( setting, id ) {
setting.id = id;
initializedSettings[ setting.id ] = true;
self.bindListener( setting );
} );
api.preview.bind( 'setting', function( args ) {
var id, value, setting;
args = args.slice();
id = args.shift();
value = args.shift();
setting = api( id );
if ( ! setting ) {
// Currently customize-preview.js is not creating settings for dynamically-created settings in the pane, so we have to do it.
setting = api.create( id, value ); // @todo This should be in core
}
if ( ! setting.id ) {
// Currently customize-preview.js doesn't set the id property for each setting, like customize-controls.js does.
setting.id = id;
}
if ( ! initializedSettings[ setting.id ] ) {
initializedSettings[ setting.id ] = true;
if ( self.bindListener( setting ) ) {
setting.callbacks.fireWith( setting, [ setting(), null ] );
}
}
} );
};
/**
*
* @param {wp.customize.Value} setting
* @returns {boolean} Whether the setting was bound.
*/
self.bindListener = function( setting ) {
var matches, themeLocation;
matches = setting.id.match( /^nav_menu\[(-?\d+)]$/ );
if ( matches ) {
setting.navMenuId = parseInt( matches[1], 10 );
setting.bind( self.onChangeNavMenuSetting );
return true;
}
matches = setting.id.match( /^nav_menu_item\[(-?\d+)]$/ );
if ( matches ) {
setting.navMenuItemId = parseInt( matches[1], 10 );
setting.bind( self.onChangeNavMenuItemSetting );
return true;
}
matches = setting.id.match( /^nav_menu_locations\[(.+?)]/ );
if ( matches ) {
themeLocation = matches[1];
setting.bind( function() {
self.refreshMenuLocation( themeLocation );
} );
return true;
}
return false;
};
/**
* Handle changing of a nav_menu setting.
*
* @this {wp.customize.Setting}
*/
self.onChangeNavMenuSetting = function() {
var setting = this;
if ( ! setting.navMenuId ) {
throw new Error( 'Expected navMenuId property to be set.' );
}
self.refreshMenu( setting.navMenuId );
};
/**
* Handle changing of a nav_menu_item setting.
*
* @this {wp.customize.Setting}
* @param {object} to
* @param {object} from
*/
self.onChangeNavMenuItemSetting = function( to, from ) {
if ( from && from.nav_menu_term_id && ( ! to || from.nav_menu_term_id !== to.nav_menu_term_id ) ) {
self.refreshMenu( from.nav_menu_term_id );
}
if ( to && to.nav_menu_term_id ) {
self.refreshMenu( to.nav_menu_term_id );
}
};
/**
* Update a given menu rendered in the preview.
*
* @param {int} menuId
*/
self.refreshMenu = function( menuId ) {
var assignedLocations = [];
api.each(function( setting, id ) {
var matches = id.match( /^nav_menu_locations\[(.+?)]/ );
if ( matches && menuId === setting() ) {
assignedLocations.push( matches[1] );
}
});
_.each( settings.navMenuInstanceArgs, function( navMenuArgs, instanceNumber ) {
if ( menuId === navMenuArgs.menu || -1 !== _.indexOf( assignedLocations, navMenuArgs.theme_location ) ) {
this.refreshMenuInstanceDebounced( instanceNumber );
}
}, this );
};
/**
* Refresh the menu(s) associated with a given nav menu location.
*
* @param {string} location
*/
self.refreshMenuLocation = function( location ) {
var foundInstance = false;
_.each( settings.navMenuInstanceArgs, function( navMenuArgs, instanceNumber ) {
if ( location === navMenuArgs.theme_location ) {
this.refreshMenuInstanceDebounced( instanceNumber );
foundInstance = true;
}
}, this );
if ( ! foundInstance ) {
api.preview.send( 'refresh' );
}
};
/**
* Update a specific instance of a given menu on the page.
*
* @param {int} instanceNumber
*/
self.refreshMenuInstance = function( instanceNumber ) {
var self = this, data, menuId, customized, container, request, wpNavArgs, instance, containerInstanceClassName;
if ( ! settings.navMenuInstanceArgs[ instanceNumber ] ) {
throw new Error( 'unknown_instance_number' );
}
instance = settings.navMenuInstanceArgs[ instanceNumber ];
containerInstanceClassName = 'partial-refreshable-nav-menu-' + String( instanceNumber );
container = $( '.' + containerInstanceClassName );
if ( _.isNumber( instance.menu ) ) {
menuId = instance.menu;
} else if ( instance.theme_location && api.has( 'nav_menu_locations[' + instance.theme_location + ']' ) ) {
menuId = api( 'nav_menu_locations[' + instance.theme_location + ']' ).get();
}
if ( ! menuId || ! instance.can_partial_refresh || 0 === container.length ) {
api.preview.send( 'refresh' );
return;
}
menuId = parseInt( menuId, 10 );
data = {
nonce: settings.previewCustomizeNonce, // for Customize Preview
wp_customize: 'on'
};
if ( ! settings.theme.active ) {
data.theme = settings.theme.stylesheet;
}
data[ settings.renderQueryVar ] = '1';
// Gather settings to send in partial refresh request.
customized = {};
api.each( function( setting, id ) {
var value = setting.get(), shouldSend = false;
// @todo Core should propagate the dirty state into the Preview as well so we can use that here.
api.MenusCustomizerPreview = {
/**
* Bootstrap functionality.
*/
init : function() {
var self = this, initializedSettings = {};
// Send setting if it is a nav_menu_locations[] setting.
shouldSend = shouldSend || /^nav_menu_locations\[/.test( id );
// Send setting if it is the setting for this menu.
shouldSend = shouldSend || id === 'nav_menu[' + String( menuId ) + ']';
// Send setting if it is one that is associated with this menu, or it is deleted.
shouldSend = shouldSend || ( /^nav_menu_item\[/.test( id ) && ( false === value || menuId === value.nav_menu_term_id ) );
if ( shouldSend ) {
customized[ id ] = value;
settings = _.extend( {}, defaultSettings );
if ( 'undefined' !== typeof _wpCustomizePreviewNavMenusExports ) {
_.extend( settings, _wpCustomizePreviewNavMenusExports );
}
} );
data.customized = JSON.stringify( customized );
data[ settings.renderNoncePostKey ] = settings.renderNonceValue;
wpNavArgs = $.extend( {}, instance );
data.wp_nav_menu_args_hash = wpNavArgs.args_hash;
delete wpNavArgs.args_hash;
data.wp_nav_menu_args = JSON.stringify( wpNavArgs );
api.each( function( setting, id ) {
setting.id = id;
initializedSettings[ setting.id ] = true;
self.bindListener( setting );
} );
container.addClass( 'customize-partial-refreshing' );
api.preview.bind( 'setting', function( args ) {
var id, value, setting;
args = args.slice();
id = args.shift();
value = args.shift();
request = wp.ajax.send( null, {
data: data,
url: settings.requestUri
} );
request.done( function( data ) {
// If the menu is now not visible, refresh since the page layout may have changed.
if ( false === data ) {
setting = api( id );
if ( ! setting ) {
// Currently customize-preview.js is not creating settings for dynamically-created settings in the pane, so we have to do it.
setting = api.create( id, value ); // @todo This should be in core
}
if ( ! setting.id ) {
// Currently customize-preview.js doesn't set the id property for each setting, like customize-controls.js does.
setting.id = id;
}
if ( ! initializedSettings[ setting.id ] ) {
initializedSettings[ setting.id ] = true;
if ( self.bindListener( setting ) ) {
setting.callbacks.fireWith( setting, [ setting(), null ] );
}
}
} );
},
/**
*
* @param {wp.customize.Value} setting
* @returns {boolean} Whether the setting was bound.
*/
bindListener : function( setting ) {
var matches, themeLocation;
matches = setting.id.match( /^nav_menu\[(-?\d+)]$/ );
if ( matches ) {
setting.navMenuId = parseInt( matches[1], 10 );
setting.bind( this.onChangeNavMenuSetting );
return true;
}
matches = setting.id.match( /^nav_menu_item\[(-?\d+)]$/ );
if ( matches ) {
setting.navMenuItemId = parseInt( matches[1], 10 );
setting.bind( this.onChangeNavMenuItemSetting );
return true;
}
matches = setting.id.match( /^nav_menu_locations\[(.+?)]/ );
if ( matches ) {
themeLocation = matches[1];
setting.bind( _.bind( function() {
this.refreshMenuLocation( themeLocation );
}, this ) );
return true;
}
return false;
},
/**
* Handle changing of a nav_menu setting.
*
* @this {wp.customize.Setting}
*/
onChangeNavMenuSetting : function() {
var setting = this;
if ( ! setting.navMenuId ) {
throw new Error( 'Expected navMenuId property to be set.' );
}
api.MenusCustomizerPreview.refreshMenu( setting.navMenuId );
},
/**
* Handle changing of a nav_menu_item setting.
*
* @this {wp.customize.Setting}
* @param {object} to
* @param {object} from
*/
onChangeNavMenuItemSetting : function( to, from ) {
if ( from && from.nav_menu_term_id && ( ! to || from.nav_menu_term_id !== to.nav_menu_term_id ) ) {
api.MenusCustomizerPreview.refreshMenu( from.nav_menu_term_id );
}
if ( to && to.nav_menu_term_id ) {
api.MenusCustomizerPreview.refreshMenu( to.nav_menu_term_id );
}
},
/**
* Update a given menu rendered in the preview.
*
* @param {int} menuId
*/
refreshMenu : function( menuId ) {
var assignedLocations = [];
api.each(function( setting, id ) {
var matches = id.match( /^nav_menu_locations\[(.+?)]/ );
if ( matches && menuId === setting() ) {
assignedLocations.push( matches[1] );
}
});
_.each( settings.navMenuInstanceArgs, function( navMenuArgs, instanceNumber ) {
if ( menuId === navMenuArgs.menu || -1 !== _.indexOf( assignedLocations, navMenuArgs.theme_location ) ) {
this.refreshMenuInstanceDebounced( instanceNumber );
}
}, this );
},
/**
* Refresh the menu(s) associated with a given nav menu location.
*
* @param {string} location
*/
refreshMenuLocation : function( location ) {
var foundInstance = false;
_.each( settings.navMenuInstanceArgs, function( navMenuArgs, instanceNumber ) {
if ( location === navMenuArgs.theme_location ) {
this.refreshMenuInstanceDebounced( instanceNumber );
foundInstance = true;
}
}, this );
if ( ! foundInstance ) {
api.preview.send( 'refresh' );
}
},
/**
* Update a specific instance of a given menu on the page.
*
* @param {int} instanceNumber
*/
refreshMenuInstance : function( instanceNumber ) {
var data, menuId, customized, container, request, wpNavArgs, instance, containerInstanceClassName;
if ( ! settings.navMenuInstanceArgs[ instanceNumber ] ) {
throw new Error( 'unknown_instance_number' );
}
instance = settings.navMenuInstanceArgs[ instanceNumber ];
containerInstanceClassName = 'partial-refreshable-nav-menu-' + String( instanceNumber );
container = $( '.' + containerInstanceClassName );
if ( _.isNumber( instance.menu ) ) {
menuId = instance.menu;
} else if ( instance.theme_location && api.has( 'nav_menu_locations[' + instance.theme_location + ']' ) ) {
menuId = api( 'nav_menu_locations[' + instance.theme_location + ']' ).get();
}
if ( ! menuId || ! instance.can_partial_refresh || 0 === container.length ) {
api.preview.send( 'refresh' );
return;
}
menuId = parseInt( menuId, 10 );
var eventParam, previousContainer = container;
container = $( data );
container.addClass( containerInstanceClassName );
container.addClass( 'partial-refreshable-nav-menu customize-partial-refreshing' );
previousContainer.replaceWith( container );
eventParam = {
instanceNumber: instanceNumber,
wpNavArgs: wpNavArgs,
oldContainer: previousContainer,
newContainer: container
data = {
nonce: settings.previewCustomizeNonce, // for Customize Preview
wp_customize: 'on'
};
container.removeClass( 'customize-partial-refreshing' );
$( document ).trigger( 'customize-preview-menu-refreshed', [ eventParam ] );
} );
};
if ( ! settings.theme.active ) {
data.theme = settings.theme.stylesheet;
}
data[ settings.renderQueryVar ] = '1';
self.refreshMenuInstanceDebounced = function( instanceNumber ) {
if ( currentRefreshDebounced[ instanceNumber ] ) {
clearTimeout( currentRefreshDebounced[ instanceNumber ] );
// Gather settings to send in partial refresh request.
customized = {};
api.each( function( setting, id ) {
var value = setting.get(), shouldSend = false;
// @todo Core should propagate the dirty state into the Preview as well so we can use that here.
// Send setting if it is a nav_menu_locations[] setting.
shouldSend = shouldSend || /^nav_menu_locations\[/.test( id );
// Send setting if it is the setting for this menu.
shouldSend = shouldSend || id === 'nav_menu[' + String( menuId ) + ']';
// Send setting if it is one that is associated with this menu, or it is deleted.
shouldSend = shouldSend || ( /^nav_menu_item\[/.test( id ) && ( false === value || menuId === value.nav_menu_term_id ) );
if ( shouldSend ) {
customized[ id ] = value;
}
} );
data.customized = JSON.stringify( customized );
data[ settings.renderNoncePostKey ] = settings.renderNonceValue;
wpNavArgs = $.extend( {}, instance );
data.wp_nav_menu_args_hash = wpNavArgs.args_hash;
delete wpNavArgs.args_hash;
data.wp_nav_menu_args = JSON.stringify( wpNavArgs );
container.addClass( 'customize-partial-refreshing' );
request = wp.ajax.send( null, {
data: data,
url: settings.requestUri
} );
request.done( function( data ) {
// If the menu is now not visible, refresh since the page layout may have changed.
if ( false === data ) {
api.preview.send( 'refresh' );
return;
}
var eventParam, previousContainer = container;
container = $( data );
container.addClass( containerInstanceClassName );
container.addClass( 'partial-refreshable-nav-menu customize-partial-refreshing' );
previousContainer.replaceWith( container );
eventParam = {
instanceNumber: instanceNumber,
wpNavArgs: wpNavArgs,
oldContainer: previousContainer,
newContainer: container
};
container.removeClass( 'customize-partial-refreshing' );
$( document ).trigger( 'customize-preview-menu-refreshed', [ eventParam ] );
} );
},
refreshMenuInstanceDebounced : function( instanceNumber ) {
if ( currentRefreshDebounced[ instanceNumber ] ) {
clearTimeout( currentRefreshDebounced[ instanceNumber ] );
}
currentRefreshDebounced[ instanceNumber ] = setTimeout(
_.bind( function() {
this.refreshMenuInstance( instanceNumber );
}, this ),
refreshDebounceDelay
);
}
currentRefreshDebounced[ instanceNumber ] = setTimeout(
function() {
self.refreshMenuInstance( instanceNumber );
},
refreshDebounceDelay
);
};
return self;
api.bind( 'preview-ready', function() {
api.preview.bind( 'active', function() {
api.MenusCustomizerPreview.init();
} );
} );
}( jQuery, wp.customize ) );
}( jQuery, _, wp ) );

View File

@ -1 +1 @@
wp.customize.menusPreview=function(a,b){"use strict";var c={},d=200,e={},f={renderQueryVar:null,renderNonceValue:null,renderNoncePostKey:null,previewCustomizeNonce:null,requestUri:"/",theme:{active:!1,stylesheet:""},navMenuInstanceArgs:{}},g={};return b.bind("preview-ready",function(){b.preview.bind("active",function(){g.init()})}),g.init=function(){var a=this,c={};e=_.extend({},f),"undefined"!=typeof _wpCustomizePreviewNavMenusExports&&_.extend(e,_wpCustomizePreviewNavMenusExports),b.each(function(b,d){b.id=d,c[b.id]=!0,a.bindListener(b)}),b.preview.bind("setting",function(d){var e,f,g;d=d.slice(),e=d.shift(),f=d.shift(),g=b(e),g||(g=b.create(e,f)),g.id||(g.id=e),c[g.id]||(c[g.id]=!0,a.bindListener(g)&&g.callbacks.fireWith(g,[g(),null]))})},g.bindListener=function(a){var b,c;return(b=a.id.match(/^nav_menu\[(-?\d+)]$/))?(a.navMenuId=parseInt(b[1],10),a.bind(g.onChangeNavMenuSetting),!0):(b=a.id.match(/^nav_menu_item\[(-?\d+)]$/))?(a.navMenuItemId=parseInt(b[1],10),a.bind(g.onChangeNavMenuItemSetting),!0):(b=a.id.match(/^nav_menu_locations\[(.+?)]/),b?(c=b[1],a.bind(function(){g.refreshMenuLocation(c)}),!0):!1)},g.onChangeNavMenuSetting=function(){var a=this;if(!a.navMenuId)throw new Error("Expected navMenuId property to be set.");g.refreshMenu(a.navMenuId)},g.onChangeNavMenuItemSetting=function(a,b){!b||!b.nav_menu_term_id||a&&b.nav_menu_term_id===a.nav_menu_term_id||g.refreshMenu(b.nav_menu_term_id),a&&a.nav_menu_term_id&&g.refreshMenu(a.nav_menu_term_id)},g.refreshMenu=function(a){var c=[];b.each(function(b,d){var e=d.match(/^nav_menu_locations\[(.+?)]/);e&&a===b()&&c.push(e[1])}),_.each(e.navMenuInstanceArgs,function(b,d){(a===b.menu||-1!==_.indexOf(c,b.theme_location))&&this.refreshMenuInstanceDebounced(d)},this)},g.refreshMenuLocation=function(a){var c=!1;_.each(e.navMenuInstanceArgs,function(b,d){a===b.theme_location&&(this.refreshMenuInstanceDebounced(d),c=!0)},this),c||b.preview.send("refresh")},g.refreshMenuInstance=function(c){var d,f,g,h,i,j,k,l;if(!e.navMenuInstanceArgs[c])throw new Error("unknown_instance_number");return k=e.navMenuInstanceArgs[c],l="partial-refreshable-nav-menu-"+String(c),h=a("."+l),_.isNumber(k.menu)?f=k.menu:k.theme_location&&b.has("nav_menu_locations["+k.theme_location+"]")&&(f=b("nav_menu_locations["+k.theme_location+"]").get()),f&&k.can_partial_refresh&&0!==h.length?(f=parseInt(f,10),d={nonce:e.previewCustomizeNonce,wp_customize:"on"},e.theme.active||(d.theme=e.theme.stylesheet),d[e.renderQueryVar]="1",g={},b.each(function(a,b){var c=a.get(),d=!1;d=d||/^nav_menu_locations\[/.test(b),d=d||b==="nav_menu["+String(f)+"]",d=d||/^nav_menu_item\[/.test(b)&&(!1===c||f===c.nav_menu_term_id),d&&(g[b]=c)}),d.customized=JSON.stringify(g),d[e.renderNoncePostKey]=e.renderNonceValue,j=a.extend({},k),d.wp_nav_menu_args_hash=j.args_hash,delete j.args_hash,d.wp_nav_menu_args=JSON.stringify(j),h.addClass("customize-partial-refreshing"),i=wp.ajax.send(null,{data:d,url:e.requestUri}),void i.done(function(d){if(!1===d)return void b.preview.send("refresh");var e,f=h;h=a(d),h.addClass(l),h.addClass("partial-refreshable-nav-menu customize-partial-refreshing"),f.replaceWith(h),e={instanceNumber:c,wpNavArgs:j,oldContainer:f,newContainer:h},h.removeClass("customize-partial-refreshing"),a(document).trigger("customize-preview-menu-refreshed",[e])})):void b.preview.send("refresh")},g.refreshMenuInstanceDebounced=function(a){c[a]&&clearTimeout(c[a]),c[a]=setTimeout(function(){g.refreshMenuInstance(a)},d)},g}(jQuery,wp.customize);
!function(a,b,c){"use strict";if(c&&c.customize){var d=c.customize,e={},f=200,g={},h={renderQueryVar:null,renderNonceValue:null,renderNoncePostKey:null,previewCustomizeNonce:null,requestUri:"/",theme:{active:!1,stylesheet:""},navMenuInstanceArgs:{}};d.MenusCustomizerPreview={init:function(){var a=this,c={};g=b.extend({},h),"undefined"!=typeof _wpCustomizePreviewNavMenusExports&&b.extend(g,_wpCustomizePreviewNavMenusExports),d.each(function(b,d){b.id=d,c[b.id]=!0,a.bindListener(b)}),d.preview.bind("setting",function(b){var e,f,g;b=b.slice(),e=b.shift(),f=b.shift(),g=d(e),g||(g=d.create(e,f)),g.id||(g.id=e),c[g.id]||(c[g.id]=!0,a.bindListener(g)&&g.callbacks.fireWith(g,[g(),null]))})},bindListener:function(a){var c,d;return(c=a.id.match(/^nav_menu\[(-?\d+)]$/))?(a.navMenuId=parseInt(c[1],10),a.bind(this.onChangeNavMenuSetting),!0):(c=a.id.match(/^nav_menu_item\[(-?\d+)]$/))?(a.navMenuItemId=parseInt(c[1],10),a.bind(this.onChangeNavMenuItemSetting),!0):(c=a.id.match(/^nav_menu_locations\[(.+?)]/),c?(d=c[1],a.bind(b.bind(function(){this.refreshMenuLocation(d)},this)),!0):!1)},onChangeNavMenuSetting:function(){var a=this;if(!a.navMenuId)throw new Error("Expected navMenuId property to be set.");d.MenusCustomizerPreview.refreshMenu(a.navMenuId)},onChangeNavMenuItemSetting:function(a,b){!b||!b.nav_menu_term_id||a&&b.nav_menu_term_id===a.nav_menu_term_id||d.MenusCustomizerPreview.refreshMenu(b.nav_menu_term_id),a&&a.nav_menu_term_id&&d.MenusCustomizerPreview.refreshMenu(a.nav_menu_term_id)},refreshMenu:function(a){var c=[];d.each(function(b,d){var e=d.match(/^nav_menu_locations\[(.+?)]/);e&&a===b()&&c.push(e[1])}),b.each(g.navMenuInstanceArgs,function(d,e){(a===d.menu||-1!==b.indexOf(c,d.theme_location))&&this.refreshMenuInstanceDebounced(e)},this)},refreshMenuLocation:function(a){var c=!1;b.each(g.navMenuInstanceArgs,function(b,d){a===b.theme_location&&(this.refreshMenuInstanceDebounced(d),c=!0)},this),c||d.preview.send("refresh")},refreshMenuInstance:function(e){var f,h,i,j,k,l,m,n;if(!g.navMenuInstanceArgs[e])throw new Error("unknown_instance_number");return m=g.navMenuInstanceArgs[e],n="partial-refreshable-nav-menu-"+String(e),j=a("."+n),b.isNumber(m.menu)?h=m.menu:m.theme_location&&d.has("nav_menu_locations["+m.theme_location+"]")&&(h=d("nav_menu_locations["+m.theme_location+"]").get()),h&&m.can_partial_refresh&&0!==j.length?(h=parseInt(h,10),f={nonce:g.previewCustomizeNonce,wp_customize:"on"},g.theme.active||(f.theme=g.theme.stylesheet),f[g.renderQueryVar]="1",i={},d.each(function(a,b){var c=a.get(),d=!1;d=d||/^nav_menu_locations\[/.test(b),d=d||b==="nav_menu["+String(h)+"]",d=d||/^nav_menu_item\[/.test(b)&&(!1===c||h===c.nav_menu_term_id),d&&(i[b]=c)}),f.customized=JSON.stringify(i),f[g.renderNoncePostKey]=g.renderNonceValue,l=a.extend({},m),f.wp_nav_menu_args_hash=l.args_hash,delete l.args_hash,f.wp_nav_menu_args=JSON.stringify(l),j.addClass("customize-partial-refreshing"),k=c.ajax.send(null,{data:f,url:g.requestUri}),void k.done(function(b){if(!1===b)return void d.preview.send("refresh");var c,f=j;j=a(b),j.addClass(n),j.addClass("partial-refreshable-nav-menu customize-partial-refreshing"),f.replaceWith(j),c={instanceNumber:e,wpNavArgs:l,oldContainer:f,newContainer:j},j.removeClass("customize-partial-refreshing"),a(document).trigger("customize-preview-menu-refreshed",[c])})):void d.preview.send("refresh")},refreshMenuInstanceDebounced:function(a){e[a]&&clearTimeout(e[a]),e[a]=setTimeout(b.bind(function(){this.refreshMenuInstance(a)},this),f)}},d.bind("preview-ready",function(){d.preview.bind("active",function(){d.MenusCustomizerPreview.init()})})}}(jQuery,_,wp);

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta3-33346';
$wp_version = '4.3-beta3-33347';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.