diff --git a/wp-admin/js/nav-menu.js b/wp-admin/js/nav-menu.js
index 4df69f9650..03a399a0fb 100644
--- a/wp-admin/js/nav-menu.js
+++ b/wp-admin/js/nav-menu.js
@@ -8,11 +8,15 @@
* @subpackage Administration
*/
+/* global menus, postboxes, columns, isRtl, navMenuL10n, ajaxurl */
+
var wpNavMenu;
(function($) {
- var api = wpNavMenu = {
+ var api;
+
+ api = wpNavMenu = {
options : {
menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead.
@@ -111,7 +115,7 @@ var wpNavMenu;
// If it has children, move those too
if ( children ) {
- children.each(function( index ) {
+ children.each(function() {
var t = $(this),
thisDepth = t.menuItemDepth(),
newDepth = thisDepth + diff;
@@ -130,11 +134,11 @@ var wpNavMenu;
return this.each(function(){
var item = $(this),
input = item.find( '.menu-item-data-parent-id' ),
- depth = parseInt( item.menuItemDepth() ),
+ depth = parseInt( item.menuItemDepth(), 10 ),
parentDepth = depth - 1,
parent = item.prevAll( '.menu-item-depth-' + parentDepth ).first();
- if ( 0 == depth ) { // Item is on the top level, has no parent
+ if ( 0 === depth ) { // Item is on the top level, has no parent
input.val(0);
} else { // Find the parent item, and retrieve its object id.
input.val( parent.find( '.menu-item-data-db-id' ).val() );
@@ -155,14 +159,14 @@ var wpNavMenu;
* @param jQuery metabox The metabox jQuery object.
*/
addSelectedToMenu : function(processMethod) {
- if ( 0 == $('#menu-to-edit').length ) {
+ if ( 0 === $('#menu-to-edit').length ) {
return false;
}
return this.each(function() {
var t = $(this), menuItems = {},
- checkboxes = ( menus.oneThemeLocationNoMenus && 0 == t.find('.tabs-panel-active .categorychecklist li input:checked').length ) ? t.find('#page-all li input[type="checkbox"]') : t.find('.tabs-panel-active .categorychecklist li input:checked'),
- re = new RegExp('menu-item\\[(\[^\\]\]*)');
+ checkboxes = ( menus.oneThemeLocationNoMenus && 0 === t.find( '.tabs-panel-active .categorychecklist li input:checked' ).length ) ? t.find( '#page-all li input[type="checkbox"]' ) : t.find( '.tabs-panel-active .categorychecklist li input:checked' ),
+ re = /menu-item\[([^]\]*)/;
processMethod = processMethod || api.addMenuItemToBottom;
@@ -271,23 +275,24 @@ var wpNavMenu;
moveMenuItem : function( $this, dir ) {
- var menuItems = $('#menu-to-edit li');
+ var items, newItemPosition, newDepth,
+ menuItems = $( '#menu-to-edit li' ),
menuItemsCount = menuItems.length,
thisItem = $this.parents( 'li.menu-item' ),
thisItemChildren = thisItem.childMenuItems(),
thisItemData = thisItem.getItemData(),
- thisItemDepth = parseInt( thisItem.menuItemDepth() ),
- thisItemPosition = parseInt( thisItem.index() ),
+ thisItemDepth = parseInt( thisItem.menuItemDepth(), 10 ),
+ thisItemPosition = parseInt( thisItem.index(), 10 ),
nextItem = thisItem.next(),
nextItemChildren = nextItem.childMenuItems(),
- nextItemDepth = parseInt( nextItem.menuItemDepth() ) + 1,
+ nextItemDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1,
prevItem = thisItem.prev(),
- prevItemDepth = parseInt( prevItem.menuItemDepth() ),
+ prevItemDepth = parseInt( prevItem.menuItemDepth(), 10 ),
prevItemId = prevItem.getItemData()['menu-item-db-id'];
switch ( dir ) {
case 'up':
- var newItemPosition = thisItemPosition - 1;
+ newItemPosition = thisItemPosition - 1;
// Already at top
if ( 0 === thisItemPosition )
@@ -303,7 +308,7 @@ var wpNavMenu;
// Does this item have sub items?
if ( thisItemChildren ) {
- var items = thisItem.add( thisItemChildren );
+ items = thisItem.add( thisItemChildren );
// Move the entire block
items.detach().insertBefore( menuItems.eq( newItemPosition ) ).updateParentMenuItemDBId();
} else {
@@ -313,12 +318,12 @@ var wpNavMenu;
case 'down':
// Does this item have sub items?
if ( thisItemChildren ) {
- var items = thisItem.add( thisItemChildren ),
+ items = thisItem.add( thisItemChildren ),
nextItem = menuItems.eq( items.length + thisItemPosition ),
nextItemChildren = 0 !== nextItem.childMenuItems().length;
if ( nextItemChildren ) {
- var newDepth = parseInt( nextItem.menuItemDepth() ) + 1;
+ newDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1;
thisItem.moveHorizontally( newDepth, thisItemDepth );
}
@@ -344,7 +349,7 @@ var wpNavMenu;
break;
// Does this item have sub items?
if ( thisItemChildren ) {
- var items = thisItem.add( thisItemChildren );
+ items = thisItem.add( thisItemChildren );
// Move the entire block
items.detach().insertBefore( menuItems.eq( 0 ) ).updateParentMenuItemDBId();
} else {
@@ -406,15 +411,15 @@ var wpNavMenu;
$( '.menu-item-settings .field-move a' ).css( 'display', 'none' );
$( '.item-edit' ).each( function() {
- var $this = $(this),
- movement = [],
- availableMovement = '',
+ var thisLink, thisLinkText, primaryItems, itemPosition, title,
+ parentItem, parentItemId, parentItemName, subItems,
+ $this = $(this),
menuItem = $this.closest( 'li.menu-item' ).first(),
depth = menuItem.menuItemDepth(),
isPrimaryMenuItem = ( 0 === depth ),
itemName = $this.closest( '.menu-item-handle' ).find( '.menu-item-title' ).text(),
- position = parseInt( menuItem.index() ),
- prevItemDepth = ( isPrimaryMenuItem ) ? depth : parseInt( depth - 1 ),
+ position = parseInt( menuItem.index(), 10 ),
+ prevItemDepth = ( isPrimaryMenuItem ) ? depth : parseInt( depth - 1, 10 ),
prevItemNameLeft = menuItem.prevAll('.menu-item-depth-' + prevItemDepth).first().find( '.menu-item-title' ).text(),
prevItemNameRight = menuItem.prevAll('.menu-item-depth-' + depth).first().find( '.menu-item-title' ).text(),
totalMenuItems = $('#menu-to-edit li').length,
@@ -422,55 +427,55 @@ var wpNavMenu;
// Where can they move this menu item?
if ( 0 !== position ) {
- var thisLink = menuItem.find( '.menus-move-up' );
+ thisLink = menuItem.find( '.menus-move-up' );
thisLink.prop( 'title', menus.moveUp ).css( 'display', 'inline' );
}
if ( 0 !== position && isPrimaryMenuItem ) {
- var thisLink = menuItem.find( '.menus-move-top' );
+ thisLink = menuItem.find( '.menus-move-top' );
thisLink.prop( 'title', menus.moveToTop ).css( 'display', 'inline' );
}
if ( position + 1 !== totalMenuItems && 0 !== position ) {
- var thisLink = menuItem.find( '.menus-move-down' );
+ thisLink = menuItem.find( '.menus-move-down' );
thisLink.prop( 'title', menus.moveDown ).css( 'display', 'inline' );
}
if ( 0 === position && 0 !== hasSameDepthSibling ) {
- var thisLink = menuItem.find( '.menus-move-down' );
+ thisLink = menuItem.find( '.menus-move-down' );
thisLink.prop( 'title', menus.moveDown ).css( 'display', 'inline' );
}
if ( ! isPrimaryMenuItem ) {
- var thisLink = menuItem.find( '.menus-move-left' ),
- thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
+ thisLink = menuItem.find( '.menus-move-left' ),
+ thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
thisLink.prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).html( thisLinkText ).css( 'display', 'inline' );
}
if ( 0 !== position ) {
if ( menuItem.find( '.menu-item-data-parent-id' ).val() !== menuItem.prev().find( '.menu-item-data-db-id' ).val() ) {
- var thisLink = menuItem.find( '.menus-move-right' ),
- thisLinkText = menus.under.replace( '%s', prevItemNameRight );
+ thisLink = menuItem.find( '.menus-move-right' ),
+ thisLinkText = menus.under.replace( '%s', prevItemNameRight );
thisLink.prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).html( thisLinkText ).css( 'display', 'inline' );
}
}
if ( isPrimaryMenuItem ) {
- var primaryItems = $( '.menu-item-depth-0' ),
- itemPosition = primaryItems.index( menuItem ) + 1,
- totalMenuItems = primaryItems.length,
+ primaryItems = $( '.menu-item-depth-0' ),
+ itemPosition = primaryItems.index( menuItem ) + 1,
+ totalMenuItems = primaryItems.length,
- // String together help text for primary menu items
- title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
+ // String together help text for primary menu items
+ title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
} else {
- var parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1 ) ).first(),
- parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
- parentItemName = parentItem.find( '.menu-item-title' ).text(),
- subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
- itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
+ parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1, 10 ) ).first(),
+ parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
+ parentItemName = parentItem.find( '.menu-item-title' ).text(),
+ subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
+ itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
- // String together help text for sub menu items
- title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
+ // String together help text for sub menu items
+ title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
}
$this.prop('title', title).html( title );
@@ -481,7 +486,10 @@ var wpNavMenu;
$( '.item-edit' ).off( 'focus' ).on( 'focus', function(){
$(this).off( 'keydown' ).on( 'keydown', function(e){
- var $this = $(this);
+ var arrows,
+ $this = $( this ),
+ thisItem = $this.parents( 'li.menu-item' ),
+ thisItemData = thisItem.getItemData();
// Bail if it's not an arrow key
if ( 37 != e.which && 38 != e.which && 39 != e.which && 40 != e.which )
@@ -495,7 +503,7 @@ var wpNavMenu;
return;
// If RTL, swap left/right arrows
- var arrows = { '38' : 'up', '40' : 'down', '37' : 'left', '39' : 'right' };
+ arrows = { '38': 'up', '40': 'down', '37': 'left', '39': 'right' };
if ( $('body').hasClass('rtl') )
arrows = { '38' : 'up', '40' : 'down', '39' : 'left', '37' : 'right' };
@@ -528,10 +536,10 @@ var wpNavMenu;
columns.useCheckboxesForHidden();
columns.checked = function(field) {
$('.field-' + field).removeClass('hidden-field');
- }
+ };
columns.unchecked = function(field) {
$('.field-' + field).addClass('hidden-field');
- }
+ };
// hide fields
api.menuList.hideAdvancedMenuItemFields();
@@ -553,7 +561,7 @@ var wpNavMenu;
body = $('body'), maxChildDepth,
menuMaxDepth = initialMenuMaxDepth();
- if( 0 != $( '#menu-to-edit li' ).length )
+ if( 0 !== $( '#menu-to-edit li' ).length )
$( '.drag-instructions' ).show();
// Use the right edge if RTL.
@@ -605,7 +613,7 @@ var wpNavMenu;
tempHolder = ui.placeholder.next();
tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder
ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item
- $(this).sortable( "refresh" ); // The children aren't sortable. We should let jQ UI know.
+ $(this).sortable( 'refresh' ); // The children aren't sortable. We should let jQ UI know.
ui.item.after( ui.placeholder ); // reattach the placeholder.
tempHolder.css('margin-top', 0); // reset the margin
@@ -613,20 +621,21 @@ var wpNavMenu;
updateSharedVars(ui);
},
stop: function(e, ui) {
- var children, depthChange = currentDepth - originalDepth;
+ var children, subMenuTitle,
+ depthChange = currentDepth - originalDepth;
// Return child elements to the list
children = transport.children().insertAfter(ui.item);
// Add "sub menu" description
- var subMenuTitle = ui.item.find( '.item-title .is-submenu' );
+ subMenuTitle = ui.item.find( '.item-title .is-submenu' );
if ( 0 < currentDepth )
subMenuTitle.show();
else
subMenuTitle.hide();
// Update depth classes
- if( depthChange != 0 ) {
+ if ( 0 !== depthChange ) {
ui.item.updateDepthClass( currentDepth );
children.shiftDepthClass( depthChange );
updateMenuMaxDepth( depthChange );
@@ -673,7 +682,7 @@ var wpNavMenu;
if( nextThreshold && offset.top + helperHeight > nextThreshold ) {
next.after( ui.placeholder );
updateSharedVars( ui );
- $(this).sortable( "refreshPositions" );
+ $( this ).sortable( 'refreshPositions' );
}
}
});
@@ -706,7 +715,7 @@ var wpNavMenu;
function initialMenuMaxDepth() {
if( ! body[0].className ) return 0;
var match = body[0].className.match(/menu-max-depth-(\d+)/);
- return match && match[1] ? parseInt(match[1]) : 0;
+ return match && match[1] ? parseInt( match[1], 10 ) : 0;
}
function updateMenuMaxDepth( depthChange ) {
@@ -760,7 +769,7 @@ var wpNavMenu;
$('#add-custom-links input[type="text"]').keypress(function(e){
if ( e.keyCode === 13 ) {
e.preventDefault();
- $("#submit-customlinkdiv").click();
+ $( '#submit-customlinkdiv' ).click();
}
});
},
@@ -779,7 +788,7 @@ var wpNavMenu;
var $t = $(this), title = $t.attr('title'), val = $t.val();
$t.data( name, title );
- if( '' == val ) $t.val( title );
+ if( '' === val ) $t.val( title );
else if ( title == val ) return;
else $t.removeClass( name );
}).focus( function(){
@@ -788,7 +797,7 @@ var wpNavMenu;
$t.val('').removeClass( name );
}).blur( function(){
var $t = $(this);
- if( '' == $t.val() )
+ if( '' === $t.val() )
$t.addClass( name ).val( $t.data(name) );
});
@@ -797,14 +806,14 @@ var wpNavMenu;
attachThemeLocationsListeners : function() {
var loc = $('#nav-menu-theme-locations'), params = {};
- params['action'] = 'menu-locations-save';
+ params.action = 'menu-locations-save';
params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val();
loc.find('input[type="submit"]').click(function() {
loc.find('select').each(function() {
params[this.name] = $(this).val();
});
loc.find('.spinner').show();
- $.post( ajaxurl, params, function(r) {
+ $.post( ajaxurl, params, function() {
loc.find('.spinner').hide();
});
return false;
@@ -860,7 +869,7 @@ var wpNavMenu;
processMethod = processMethod || api.addMenuItemToBottom;
- if ( '' == url || 'http://' == url )
+ if ( '' === url || 'http://' == url )
return false;
// Show the ajax spinner
@@ -889,7 +898,8 @@ var wpNavMenu;
addItemToMenu : function(menuItem, processMethod, callback) {
var menu = $('#menu').val(),
- nonce = $('#menu-settings-column-nonce').val();
+ nonce = $('#menu-settings-column-nonce').val(),
+ params;
processMethod = processMethod || function(){};
callback = callback || function(){};
@@ -923,13 +933,13 @@ var wpNavMenu;
* @param string menuMarkup The text server response of menu item markup.
* @param object req The request arguments.
*/
- addMenuItemToBottom : function( menuMarkup, req ) {
+ addMenuItemToBottom : function( menuMarkup ) {
$(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
api.refreshKeyboardAccessibility();
api.refreshAdvancedAccessibility();
},
- addMenuItemToTop : function( menuMarkup, req ) {
+ addMenuItemToTop : function( menuMarkup ) {
$(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
api.refreshKeyboardAccessibility();
api.refreshAdvancedAccessibility();
@@ -940,7 +950,7 @@ var wpNavMenu;
api.registerChange();
});
- if ( 0 != $('#menu-to-edit').length || 0 != $('.menu-location-menus select').length ) {
+ if ( 0 !== $('#menu-to-edit').length || 0 !== $('.menu-location-menus select').length ) {
window.onbeforeunload = function(){
if ( api.menusChanged )
return navMenuL10n.saveAlert;
@@ -1008,10 +1018,10 @@ var wpNavMenu;
placeholder = document.createElement('div'),
wrap = document.createElement('div');
- if ( ! metaBoxData['markup'] || ! toReplace )
+ if ( ! metaBoxData.markup || ! toReplace )
return;
- wrap.innerHTML = metaBoxData['markup'] ? metaBoxData['markup'] : '';
+ wrap.innerHTML = metaBoxData.markup ? metaBoxData.markup : '';
toReplace.parentNode.insertBefore( placeholder, toReplace );
placeholder.parentNode.removeChild( toReplace );
@@ -1034,7 +1044,7 @@ var wpNavMenu;
if ( matchedSection && matchedSection[1] ) {
settings = $('#'+matchedSection[1]);
item = settings.parent();
- if( 0 != item.length ) {
+ if( 0 !== item.length ) {
if( item.hasClass('menu-item-edit-inactive') ) {
if( ! settings.data('menu-item-data') ) {
settings.data( 'menu-item-data', settings.getItemData() );
@@ -1060,7 +1070,7 @@ var wpNavMenu;
return false;
},
- eventOnClickMenuSave : function(clickedEl) {
+ eventOnClickMenuSave : function() {
var locs = '',
menuName = $('#menu-name'),
menuNameVal = menuName.val();
@@ -1081,9 +1091,9 @@ var wpNavMenu;
return true;
},
- eventOnClickMenuDelete : function(clickedEl) {
+ eventOnClickMenuDelete : function() {
// Delete warning AYS
- if ( confirm( navMenuL10n.warnDeleteMenu ) ) {
+ if ( window.confirm( navMenuL10n.warnDeleteMenu ) ) {
window.onbeforeunload = null;
return true;
}
@@ -1108,7 +1118,7 @@ var wpNavMenu;
var matched, newID,
takenIDs = {},
form = document.getElementById('nav-menu-meta'),
- pattern = new RegExp('menu-item\\[(\[^\\]\]*)', 'g'),
+ pattern = /menu-item[(\[^]\]*/,
$items = $('
').html(resp).find('li'),
$item;
@@ -1154,7 +1164,7 @@ var wpNavMenu;
var ins = $('#menu-instructions');
el.remove();
children.shiftDepthClass( -1 ).updateParentMenuItemDBId();
- if( 0 == $( '#menu-to-edit li' ).length ) {
+ if ( 0 === $( '#menu-to-edit li' ).length ) {
$( '.drag-instructions' ).hide();
ins.removeClass( 'menu-instructions-inactive' );
}
diff --git a/wp-admin/js/nav-menu.min.js b/wp-admin/js/nav-menu.min.js
index e9bf60da30..b7aafab2d0 100644
--- a/wp-admin/js/nav-menu.min.js
+++ b/wp-admin/js/nav-menu.min.js
@@ -1 +1 @@
-var wpNavMenu;!function(a){var b=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11},menuList:void 0,targetList:void 0,menusChanged:!1,isRTL:!("undefined"==typeof isRtl||!isRtl),negateIfRTL:"undefined"!=typeof isRtl&&isRtl?-1:1,init:function(){b.menuList=a("#menu-to-edit"),b.targetList=b.menuList,this.jQueryExtensions(),this.attachMenuEditListeners(),this.setupInputWithDefaultTitle(),this.attachQuickSearchListeners(),this.attachThemeLocationsListeners(),this.attachTabsPanelListeners(),this.attachUnsavedChangesListener(),b.menuList.length&&this.initSortables(),menus.oneThemeLocationNoMenus&&a("#posttype-page").addSelectedToMenu(b.addMenuItemToBottom),this.initManageLocations(),this.initAccessibility(),this.initToggles()},jQueryExtensions:function(){a.fn.extend({menuItemDepth:function(){var a=b.isRTL?this.eq(0).css("margin-right"):this.eq(0).css("margin-left");return b.pxToDepth(a&&-1!=a.indexOf("px")?a.slice(0,-2):0)},updateDepthClass:function(b,c){return this.each(function(){var d=a(this);c=c||d.menuItemDepth(),a(this).removeClass("menu-item-depth-"+c).addClass("menu-item-depth-"+b)})},shiftDepthClass:function(b){return this.each(function(){var c=a(this),d=c.menuItemDepth();a(this).removeClass("menu-item-depth-"+d).addClass("menu-item-depth-"+(d+b))})},childMenuItems:function(){var b=a();return this.each(function(){for(var c=a(this),d=c.menuItemDepth(),e=c.next();e.length&&e.menuItemDepth()>d;)b=b.add(e),e=e.next()}),b},shiftHorizontally:function(b){return this.each(function(){var c=a(this),d=c.menuItemDepth(),e=d+b;c.moveHorizontally(e,d)})},moveHorizontally:function(b,c){return this.each(function(){var d=a(this),e=d.childMenuItems(),f=b-c,g=d.find(".is-submenu");d.updateDepthClass(b,c).updateParentMenuItemDBId(),e&&e.each(function(){var b=a(this),c=b.menuItemDepth(),d=c+f;b.updateDepthClass(d,c).updateParentMenuItemDBId()}),0===b?g.hide():g.show()})},updateParentMenuItemDBId:function(){return this.each(function(){var b=a(this),c=b.find(".menu-item-data-parent-id"),d=parseInt(b.menuItemDepth()),e=d-1,f=b.prevAll(".menu-item-depth-"+e).first();0==d?c.val(0):c.val(f.find(".menu-item-data-db-id").val())})},hideAdvancedMenuItemFields:function(){return this.each(function(){var b=a(this);a(".hide-column-tog").not(":checked").each(function(){b.find(".field-"+a(this).val()).addClass("hidden-field")})})},addSelectedToMenu:function(c){return 0==a("#menu-to-edit").length?!1:this.each(function(){var d=a(this),e={},f=menus.oneThemeLocationNoMenus&&0==d.find(".tabs-panel-active .categorychecklist li input:checked").length?d.find('#page-all li input[type="checkbox"]'):d.find(".tabs-panel-active .categorychecklist li input:checked"),g=new RegExp("menu-item\\[([^\\]]*)");return c=c||b.addMenuItemToBottom,f.length?(d.find(".spinner").show(),a(f).each(function(){var d=a(this),f=g.exec(d.attr("name")),h="undefined"==typeof f[1]?0:parseInt(f[1],10);this.className&&-1!=this.className.indexOf("add-to-top")&&(c=b.addMenuItemToTop),e[h]=d.closest("li").getItemData("add-menu-item",h)}),b.addItemToMenu(e,c,function(){f.removeAttr("checked"),d.find(".spinner").hide()}),void 0):!1})},getItemData:function(a,b){a=a||"menu-item";var c,d={},e=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"];return b||"menu-item"!=a||(b=this.find(".menu-item-data-db-id").val()),b?(this.find("input").each(function(){var f;for(c=e.length;c--;)"menu-item"==a?f=e[c]+"["+b+"]":"add-menu-item"==a&&(f="menu-item["+b+"]["+e[c]+"]"),this.name&&f==this.name&&(d[e[c]]=this.value)}),d):d},setItemData:function(b,c,d){return c=c||"menu-item",d||"menu-item"!=c||(d=a(".menu-item-data-db-id",this).val()),d?(this.find("input").each(function(){var e,f=a(this);a.each(b,function(a,b){"menu-item"==c?e=a+"["+d+"]":"add-menu-item"==c&&(e="menu-item["+d+"]["+a+"]"),e==f.attr("name")&&f.val(b)})}),this):this}})},countMenuItems:function(b){return a(".menu-item-depth-"+b).length},moveMenuItem:function(c,d){var e=a("#menu-to-edit li");switch(menuItemsCount=e.length,thisItem=c.parents("li.menu-item"),thisItemChildren=thisItem.childMenuItems(),thisItemData=thisItem.getItemData(),thisItemDepth=parseInt(thisItem.menuItemDepth()),thisItemPosition=parseInt(thisItem.index()),h=thisItem.next(),i=h.childMenuItems(),nextItemDepth=parseInt(h.menuItemDepth())+1,prevItem=thisItem.prev(),prevItemDepth=parseInt(prevItem.menuItemDepth()),prevItemId=prevItem.getItemData()["menu-item-db-id"],d){case"up":var f=thisItemPosition-1;if(0===thisItemPosition)break;if(0===f&&0!==thisItemDepth&&thisItem.moveHorizontally(0,thisItemDepth),0!==prevItemDepth&&thisItem.moveHorizontally(prevItemDepth,thisItemDepth),thisItemChildren){var g=thisItem.add(thisItemChildren);g.detach().insertBefore(e.eq(f)).updateParentMenuItemDBId()}else thisItem.detach().insertBefore(e.eq(f)).updateParentMenuItemDBId();break;case"down":if(thisItemChildren){var g=thisItem.add(thisItemChildren),h=e.eq(g.length+thisItemPosition),i=0!==h.childMenuItems().length;if(i){var j=parseInt(h.menuItemDepth())+1;thisItem.moveHorizontally(j,thisItemDepth)}if(menuItemsCount===thisItemPosition+g.length)break;g.detach().insertAfter(e.eq(thisItemPosition+g.length)).updateParentMenuItemDBId()}else{if(0!==i.length&&thisItem.moveHorizontally(nextItemDepth,thisItemDepth),menuItemsCount===thisItemPosition+1)break;thisItem.detach().insertAfter(e.eq(thisItemPosition+1)).updateParentMenuItemDBId()}break;case"top":if(0===thisItemPosition)break;if(thisItemChildren){var g=thisItem.add(thisItemChildren);g.detach().insertBefore(e.eq(0)).updateParentMenuItemDBId()}else thisItem.detach().insertBefore(e.eq(0)).updateParentMenuItemDBId();break;case"left":if(0===thisItemDepth)break;thisItem.shiftHorizontally(-1);break;case"right":if(0===thisItemPosition)break;if(thisItemData["menu-item-parent-id"]===prevItemId)break;thisItem.shiftHorizontally(1)}c.focus(),b.registerChange(),b.refreshKeyboardAccessibility(),b.refreshAdvancedAccessibility()},initAccessibility:function(){b.refreshKeyboardAccessibility(),b.refreshAdvancedAccessibility(),a(".menus-move-up").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"up"),c.preventDefault()}),a(".menus-move-down").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"down"),c.preventDefault()}),a(".menus-move-top").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"top"),c.preventDefault()}),a(".menus-move-left").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"left"),c.preventDefault()}),a(".menus-move-right").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"right"),c.preventDefault()})},refreshAdvancedAccessibility:function(){a(".menu-item-settings .field-move a").css("display","none"),a(".item-edit").each(function(){var b=a(this),c=b.closest("li.menu-item").first(),d=c.menuItemDepth(),e=0===d,f=b.closest(".menu-item-handle").find(".menu-item-title").text(),g=parseInt(c.index()),h=e?d:parseInt(d-1),i=c.prevAll(".menu-item-depth-"+h).first().find(".menu-item-title").text(),j=c.prevAll(".menu-item-depth-"+d).first().find(".menu-item-title").text(),k=a("#menu-to-edit li").length,l=c.nextAll(".menu-item-depth-"+d).length;if(0!==g){var m=c.find(".menus-move-up");m.prop("title",menus.moveUp).css("display","inline")}if(0!==g&&e){var m=c.find(".menus-move-top");m.prop("title",menus.moveToTop).css("display","inline")}if(g+1!==k&&0!==g){var m=c.find(".menus-move-down");m.prop("title",menus.moveDown).css("display","inline")}if(0===g&&0!==l){var m=c.find(".menus-move-down");m.prop("title",menus.moveDown).css("display","inline")}if(!e){var m=c.find(".menus-move-left"),n=menus.outFrom.replace("%s",i);m.prop("title",menus.moveOutFrom.replace("%s",i)).html(n).css("display","inline")}if(0!==g&&c.find(".menu-item-data-parent-id").val()!==c.prev().find(".menu-item-data-db-id").val()){var m=c.find(".menus-move-right"),n=menus.under.replace("%s",j);m.prop("title",menus.moveUnder.replace("%s",j)).html(n).css("display","inline")}if(e)var o=a(".menu-item-depth-0"),p=o.index(c)+1,k=o.length,q=menus.menuFocus.replace("%1$s",f).replace("%2$d",p).replace("%3$d",k);else{var r=c.prevAll(".menu-item-depth-"+parseInt(d-1)).first(),s=r.find(".menu-item-data-db-id").val(),t=r.find(".menu-item-title").text(),u=a('.menu-item .menu-item-data-parent-id[value="'+s+'"]'),p=a(u.parents(".menu-item").get().reverse()).index(c)+1;q=menus.subMenuFocus.replace("%1$s",f).replace("%2$d",p).replace("%3$s",t)}b.prop("title",q).html(q)})},refreshKeyboardAccessibility:function(){a(".item-edit").off("focus").on("focus",function(){a(this).off("keydown").on("keydown",function(c){var d=a(this);if((37==c.which||38==c.which||39==c.which||40==c.which)&&(d.off("keydown"),1!==a("#menu-to-edit li").length)){var e={38:"up",40:"down",37:"left",39:"right"};switch(a("body").hasClass("rtl")&&(e={38:"up",40:"down",39:"left",37:"right"}),e[c.which]){case"up":b.moveMenuItem(d,"up");break;case"down":b.moveMenuItem(d,"down");break;case"left":b.moveMenuItem(d,"left");break;case"right":b.moveMenuItem(d,"right")}return a("#edit-"+thisItemData["menu-item-db-id"]).focus(),!1}})})},initToggles:function(){postboxes.add_postbox_toggles("nav-menus"),columns.useCheckboxesForHidden(),columns.checked=function(b){a(".field-"+b).removeClass("hidden-field")},columns.unchecked=function(b){a(".field-"+b).addClass("hidden-field")},b.menuList.hideAdvancedMenuItemFields(),a(".hide-postbox-tog").click(function(){var b=a(".accordion-container li.accordion-section").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",hidden:b,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:"nav-menus"})})},initSortables:function(){function c(a){var c;j=a.placeholder.prev(),k=a.placeholder.next(),j[0]==a.item[0]&&(j=j.prev()),k[0]==a.item[0]&&(k=k.next()),l=j.length?j.offset().top+j.height():0,m=k.length?k.offset().top+k.height()/3:0,h=k.length?k.menuItemDepth():0,i=j.length?(c=j.menuItemDepth()+1)>b.options.globalMaxDepth?b.options.globalMaxDepth:c:0}function d(a,b){a.placeholder.updateDepthClass(b,q),q=b}function e(){if(!s[0].className)return 0;var a=s[0].className.match(/menu-max-depth-(\d+)/);return a&&a[1]?parseInt(a[1]):0}function f(c){var d,e=t;if(0!==c){if(c>0)d=p+c,d>t&&(e=d);else if(0>c&&p==t)for(;!a(".menu-item-depth-"+e,b.menuList).length&&e>0;)e--;s.removeClass("menu-max-depth-"+t).addClass("menu-max-depth-"+e),t=e}}var g,h,i,j,k,l,m,n,o,p,q=0,r=b.menuList.offset().left,s=a("body"),t=e();0!=a("#menu-to-edit li").length&&a(".drag-instructions").show(),r+=b.isRTL?b.menuList.width():0,b.menuList.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(e,f){var h,i,j,k,l;b.isRTL&&(f.item[0].style.right="auto"),o=f.item.children(".menu-item-transport"),g=f.item.menuItemDepth(),d(f,g),j=f.item.next()[0]==f.placeholder[0]?f.item.next():f.item,k=j.childMenuItems(),o.append(k),h=o.outerHeight(),h+=h>0?1*f.placeholder.css("margin-top").slice(0,-2):0,h+=f.helper.outerHeight(),n=h,h-=2,f.placeholder.height(h),p=g,k.each(function(){var b=a(this).menuItemDepth();p=b>p?b:p}),i=f.helper.find(".menu-item-handle").outerWidth(),i+=b.depthToPx(p-g),i-=2,f.placeholder.width(i),l=f.placeholder.next(),l.css("margin-top",n+"px"),f.placeholder.detach(),a(this).sortable("refresh"),f.item.after(f.placeholder),l.css("margin-top",0),c(f)},stop:function(a,c){var d,e=q-g;d=o.children().insertAfter(c.item);var h=c.item.find(".item-title .is-submenu");q>0?h.show():h.hide(),0!=e&&(c.item.updateDepthClass(q),d.shiftDepthClass(e),f(e)),b.registerChange(),c.item.updateParentMenuItemDBId(),c.item[0].style.top=0,b.isRTL&&(c.item[0].style.left="auto",c.item[0].style.right=0),b.refreshKeyboardAccessibility(),b.refreshAdvancedAccessibility()},change:function(a,d){d.placeholder.parent().hasClass("menu")||(j.length?j.after(d.placeholder):b.menuList.prepend(d.placeholder)),c(d)},sort:function(e,f){var g=f.helper.offset(),j=b.isRTL?g.left+f.helper.width():g.left,o=b.negateIfRTL*b.pxToDepth(j-r);o>i||g.top
o&&(o=h),o!=q&&d(f,o),m&&g.top+n>m&&(k.after(f.placeholder),c(f),a(this).sortable("refreshPositions"))}})},initManageLocations:function(){a("#menu-locations-wrap form").submit(function(){window.onbeforeunload=null}),a(".menu-location-menus select").on("change",function(){var b=a(this).closest("tr").find(".locations-edit-menu-link");a(this).find("option:selected").data("orig")?b.show():b.hide()})},attachMenuEditListeners:function(){var b=this;a("#update-nav-menu").bind("click",function(a){if(a.target&&a.target.className){if(-1!=a.target.className.indexOf("item-edit"))return b.eventOnClickEditLink(a.target);if(-1!=a.target.className.indexOf("menu-save"))return b.eventOnClickMenuSave(a.target);if(-1!=a.target.className.indexOf("menu-delete"))return b.eventOnClickMenuDelete(a.target);if(-1!=a.target.className.indexOf("item-delete"))return b.eventOnClickMenuItemDelete(a.target);if(-1!=a.target.className.indexOf("item-cancel"))return b.eventOnClickCancelLink(a.target)}}),a('#add-custom-links input[type="text"]').keypress(function(b){13===b.keyCode&&(b.preventDefault(),a("#submit-customlinkdiv").click())})},setupInputWithDefaultTitle:function(){var b="input-with-default-title";a("."+b).each(function(){var c=a(this),d=c.attr("title"),e=c.val();if(c.data(b,d),""==e)c.val(d);else{if(d==e)return;c.removeClass(b)}}).focus(function(){var c=a(this);c.val()==c.data(b)&&c.val("").removeClass(b)}).blur(function(){var c=a(this);""==c.val()&&c.addClass(b).val(c.data(b))}),a(".blank-slate .input-with-default-title").focus()},attachThemeLocationsListeners:function(){var b=a("#nav-menu-theme-locations"),c={};c.action="menu-locations-save",c["menu-settings-column-nonce"]=a("#menu-settings-column-nonce").val(),b.find('input[type="submit"]').click(function(){return b.find("select").each(function(){c[this.name]=a(this).val()}),b.find(".spinner").show(),a.post(ajaxurl,c,function(){b.find(".spinner").hide()}),!1})},attachQuickSearchListeners:function(){var c;a(".quick-search").keypress(function(d){var e=a(this);return 13==d.which?(b.updateQuickSearchResults(e),!1):(c&&clearTimeout(c),c=setTimeout(function(){b.updateQuickSearchResults(e)},400),void 0)}).attr("autocomplete","off")},updateQuickSearchResults:function(c){var d,e,f=2,g=c.val();g.length'}),a("#update-nav-menu").append(c),b.menuList.find(".menu-item-data-position").val(function(a){return a+1}),window.onbeforeunload=null,!0):(d.parent().addClass("form-invalid"),!1)},eventOnClickMenuDelete:function(){return confirm(navMenuL10n.warnDeleteMenu)?(window.onbeforeunload=null,!0):!1},eventOnClickMenuItemDelete:function(c){var d=parseInt(c.id.replace("delete-",""),10);return b.removeMenuItem(a("#menu-item-"+d)),b.registerChange(),!1},processQuickSearchQueryResponse:function(b,c,d){var e,f,g,h={},i=document.getElementById("nav-menu-meta"),j=new RegExp("menu-item\\[([^\\]]*)","g"),k=a("").html(b).find("li");return k.length?(k.each(function(){if(g=a(this),e=j.exec(g.html()),e&&e[1]){for(f=e[1];i.elements["menu-item["+f+"][menu-item-type]"]||h[f];)f--;h[f]=!0,f!=e[1]&&g.html(g.html().replace(new RegExp("menu-item\\["+e[1]+"\\]","g"),"menu-item["+f+"]"))}}),a(".categorychecklist",d).html(k),a(".spinner",d).hide(),void 0):(a(".categorychecklist",d).html("
"+navMenuL10n.noResultsFound+"
"),a(".spinner",d).hide(),void 0)},removeMenuItem:function(b){var c=b.childMenuItems();b.addClass("deleting").animate({opacity:0,height:0},350,function(){var d=a("#menu-instructions");b.remove(),c.shiftDepthClass(-1).updateParentMenuItemDBId(),0==a("#menu-to-edit li").length&&(a(".drag-instructions").hide(),d.removeClass("menu-instructions-inactive"))})},depthToPx:function(a){return a*b.options.menuItemDepthPerLevel},pxToDepth:function(a){return Math.floor(a/b.options.menuItemDepthPerLevel)}};a(document).ready(function(){wpNavMenu.init()})}(jQuery);
\ No newline at end of file
+var wpNavMenu;!function(a){var b;b=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11},menuList:void 0,targetList:void 0,menusChanged:!1,isRTL:!("undefined"==typeof isRtl||!isRtl),negateIfRTL:"undefined"!=typeof isRtl&&isRtl?-1:1,init:function(){b.menuList=a("#menu-to-edit"),b.targetList=b.menuList,this.jQueryExtensions(),this.attachMenuEditListeners(),this.setupInputWithDefaultTitle(),this.attachQuickSearchListeners(),this.attachThemeLocationsListeners(),this.attachTabsPanelListeners(),this.attachUnsavedChangesListener(),b.menuList.length&&this.initSortables(),menus.oneThemeLocationNoMenus&&a("#posttype-page").addSelectedToMenu(b.addMenuItemToBottom),this.initManageLocations(),this.initAccessibility(),this.initToggles()},jQueryExtensions:function(){a.fn.extend({menuItemDepth:function(){var a=b.isRTL?this.eq(0).css("margin-right"):this.eq(0).css("margin-left");return b.pxToDepth(a&&-1!=a.indexOf("px")?a.slice(0,-2):0)},updateDepthClass:function(b,c){return this.each(function(){var d=a(this);c=c||d.menuItemDepth(),a(this).removeClass("menu-item-depth-"+c).addClass("menu-item-depth-"+b)})},shiftDepthClass:function(b){return this.each(function(){var c=a(this),d=c.menuItemDepth();a(this).removeClass("menu-item-depth-"+d).addClass("menu-item-depth-"+(d+b))})},childMenuItems:function(){var b=a();return this.each(function(){for(var c=a(this),d=c.menuItemDepth(),e=c.next();e.length&&e.menuItemDepth()>d;)b=b.add(e),e=e.next()}),b},shiftHorizontally:function(b){return this.each(function(){var c=a(this),d=c.menuItemDepth(),e=d+b;c.moveHorizontally(e,d)})},moveHorizontally:function(b,c){return this.each(function(){var d=a(this),e=d.childMenuItems(),f=b-c,g=d.find(".is-submenu");d.updateDepthClass(b,c).updateParentMenuItemDBId(),e&&e.each(function(){var b=a(this),c=b.menuItemDepth(),d=c+f;b.updateDepthClass(d,c).updateParentMenuItemDBId()}),0===b?g.hide():g.show()})},updateParentMenuItemDBId:function(){return this.each(function(){var b=a(this),c=b.find(".menu-item-data-parent-id"),d=parseInt(b.menuItemDepth(),10),e=d-1,f=b.prevAll(".menu-item-depth-"+e).first();0===d?c.val(0):c.val(f.find(".menu-item-data-db-id").val())})},hideAdvancedMenuItemFields:function(){return this.each(function(){var b=a(this);a(".hide-column-tog").not(":checked").each(function(){b.find(".field-"+a(this).val()).addClass("hidden-field")})})},addSelectedToMenu:function(c){return 0===a("#menu-to-edit").length?!1:this.each(function(){var d=a(this),e={},f=menus.oneThemeLocationNoMenus&&0===d.find(".tabs-panel-active .categorychecklist li input:checked").length?d.find('#page-all li input[type="checkbox"]'):d.find(".tabs-panel-active .categorychecklist li input:checked"),g=/menu-item\[([^]\]*)/;return c=c||b.addMenuItemToBottom,f.length?(d.find(".spinner").show(),a(f).each(function(){var d=a(this),f=g.exec(d.attr("name")),h="undefined"==typeof f[1]?0:parseInt(f[1],10);this.className&&-1!=this.className.indexOf("add-to-top")&&(c=b.addMenuItemToTop),e[h]=d.closest("li").getItemData("add-menu-item",h)}),b.addItemToMenu(e,c,function(){f.removeAttr("checked"),d.find(".spinner").hide()}),void 0):!1})},getItemData:function(a,b){a=a||"menu-item";var c,d={},e=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"];return b||"menu-item"!=a||(b=this.find(".menu-item-data-db-id").val()),b?(this.find("input").each(function(){var f;for(c=e.length;c--;)"menu-item"==a?f=e[c]+"["+b+"]":"add-menu-item"==a&&(f="menu-item["+b+"]["+e[c]+"]"),this.name&&f==this.name&&(d[e[c]]=this.value)}),d):d},setItemData:function(b,c,d){return c=c||"menu-item",d||"menu-item"!=c||(d=a(".menu-item-data-db-id",this).val()),d?(this.find("input").each(function(){var e,f=a(this);a.each(b,function(a,b){"menu-item"==c?e=a+"["+d+"]":"add-menu-item"==c&&(e="menu-item["+d+"]["+a+"]"),e==f.attr("name")&&f.val(b)})}),this):this}})},countMenuItems:function(b){return a(".menu-item-depth-"+b).length},moveMenuItem:function(c,d){var e,f,g,h=a("#menu-to-edit li"),i=h.length,j=c.parents("li.menu-item"),k=j.childMenuItems(),l=j.getItemData(),m=parseInt(j.menuItemDepth(),10),n=parseInt(j.index(),10),o=j.next(),p=o.childMenuItems(),q=parseInt(o.menuItemDepth(),10)+1,r=j.prev(),s=parseInt(r.menuItemDepth(),10),t=r.getItemData()["menu-item-db-id"];switch(d){case"up":if(f=n-1,0===n)break;0===f&&0!==m&&j.moveHorizontally(0,m),0!==s&&j.moveHorizontally(s,m),k?(e=j.add(k),e.detach().insertBefore(h.eq(f)).updateParentMenuItemDBId()):j.detach().insertBefore(h.eq(f)).updateParentMenuItemDBId();break;case"down":if(k){if(e=j.add(k),o=h.eq(e.length+n),p=0!==o.childMenuItems().length,p&&(g=parseInt(o.menuItemDepth(),10)+1,j.moveHorizontally(g,m)),i===n+e.length)break;e.detach().insertAfter(h.eq(n+e.length)).updateParentMenuItemDBId()}else{if(0!==p.length&&j.moveHorizontally(q,m),i===n+1)break;j.detach().insertAfter(h.eq(n+1)).updateParentMenuItemDBId()}break;case"top":if(0===n)break;k?(e=j.add(k),e.detach().insertBefore(h.eq(0)).updateParentMenuItemDBId()):j.detach().insertBefore(h.eq(0)).updateParentMenuItemDBId();break;case"left":if(0===m)break;j.shiftHorizontally(-1);break;case"right":if(0===n)break;if(l["menu-item-parent-id"]===t)break;j.shiftHorizontally(1)}c.focus(),b.registerChange(),b.refreshKeyboardAccessibility(),b.refreshAdvancedAccessibility()},initAccessibility:function(){b.refreshKeyboardAccessibility(),b.refreshAdvancedAccessibility(),a(".menus-move-up").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"up"),c.preventDefault()}),a(".menus-move-down").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"down"),c.preventDefault()}),a(".menus-move-top").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"top"),c.preventDefault()}),a(".menus-move-left").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"left"),c.preventDefault()}),a(".menus-move-right").on("click",function(c){b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"),"right"),c.preventDefault()})},refreshAdvancedAccessibility:function(){a(".menu-item-settings .field-move a").css("display","none"),a(".item-edit").each(function(){var b,c,d,e,f,g,h,i,j,k=a(this),l=k.closest("li.menu-item").first(),m=l.menuItemDepth(),n=0===m,o=k.closest(".menu-item-handle").find(".menu-item-title").text(),p=parseInt(l.index(),10),q=n?m:parseInt(m-1,10),r=l.prevAll(".menu-item-depth-"+q).first().find(".menu-item-title").text(),s=l.prevAll(".menu-item-depth-"+m).first().find(".menu-item-title").text(),t=a("#menu-to-edit li").length,u=l.nextAll(".menu-item-depth-"+m).length;0!==p&&(b=l.find(".menus-move-up"),b.prop("title",menus.moveUp).css("display","inline")),0!==p&&n&&(b=l.find(".menus-move-top"),b.prop("title",menus.moveToTop).css("display","inline")),p+1!==t&&0!==p&&(b=l.find(".menus-move-down"),b.prop("title",menus.moveDown).css("display","inline")),0===p&&0!==u&&(b=l.find(".menus-move-down"),b.prop("title",menus.moveDown).css("display","inline")),n||(b=l.find(".menus-move-left"),c=menus.outFrom.replace("%s",r),b.prop("title",menus.moveOutFrom.replace("%s",r)).html(c).css("display","inline")),0!==p&&l.find(".menu-item-data-parent-id").val()!==l.prev().find(".menu-item-data-db-id").val()&&(b=l.find(".menus-move-right"),c=menus.under.replace("%s",s),b.prop("title",menus.moveUnder.replace("%s",s)).html(c).css("display","inline")),n?(d=a(".menu-item-depth-0"),e=d.index(l)+1,t=d.length,f=menus.menuFocus.replace("%1$s",o).replace("%2$d",e).replace("%3$d",t)):(g=l.prevAll(".menu-item-depth-"+parseInt(m-1,10)).first(),h=g.find(".menu-item-data-db-id").val(),i=g.find(".menu-item-title").text(),j=a('.menu-item .menu-item-data-parent-id[value="'+h+'"]'),e=a(j.parents(".menu-item").get().reverse()).index(l)+1,f=menus.subMenuFocus.replace("%1$s",o).replace("%2$d",e).replace("%3$s",i)),k.prop("title",f).html(f)})},refreshKeyboardAccessibility:function(){a(".item-edit").off("focus").on("focus",function(){a(this).off("keydown").on("keydown",function(c){var d,e=a(this),f=e.parents("li.menu-item"),g=f.getItemData();if((37==c.which||38==c.which||39==c.which||40==c.which)&&(e.off("keydown"),1!==a("#menu-to-edit li").length)){switch(d={38:"up",40:"down",37:"left",39:"right"},a("body").hasClass("rtl")&&(d={38:"up",40:"down",39:"left",37:"right"}),d[c.which]){case"up":b.moveMenuItem(e,"up");break;case"down":b.moveMenuItem(e,"down");break;case"left":b.moveMenuItem(e,"left");break;case"right":b.moveMenuItem(e,"right")}return a("#edit-"+g["menu-item-db-id"]).focus(),!1}})})},initToggles:function(){postboxes.add_postbox_toggles("nav-menus"),columns.useCheckboxesForHidden(),columns.checked=function(b){a(".field-"+b).removeClass("hidden-field")},columns.unchecked=function(b){a(".field-"+b).addClass("hidden-field")},b.menuList.hideAdvancedMenuItemFields(),a(".hide-postbox-tog").click(function(){var b=a(".accordion-container li.accordion-section").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",hidden:b,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:"nav-menus"})})},initSortables:function(){function c(a){var c;j=a.placeholder.prev(),k=a.placeholder.next(),j[0]==a.item[0]&&(j=j.prev()),k[0]==a.item[0]&&(k=k.next()),l=j.length?j.offset().top+j.height():0,m=k.length?k.offset().top+k.height()/3:0,h=k.length?k.menuItemDepth():0,i=j.length?(c=j.menuItemDepth()+1)>b.options.globalMaxDepth?b.options.globalMaxDepth:c:0}function d(a,b){a.placeholder.updateDepthClass(b,q),q=b}function e(){if(!s[0].className)return 0;var a=s[0].className.match(/menu-max-depth-(\d+)/);return a&&a[1]?parseInt(a[1],10):0}function f(c){var d,e=t;if(0!==c){if(c>0)d=p+c,d>t&&(e=d);else if(0>c&&p==t)for(;!a(".menu-item-depth-"+e,b.menuList).length&&e>0;)e--;s.removeClass("menu-max-depth-"+t).addClass("menu-max-depth-"+e),t=e}}var g,h,i,j,k,l,m,n,o,p,q=0,r=b.menuList.offset().left,s=a("body"),t=e();0!==a("#menu-to-edit li").length&&a(".drag-instructions").show(),r+=b.isRTL?b.menuList.width():0,b.menuList.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(e,f){var h,i,j,k,l;b.isRTL&&(f.item[0].style.right="auto"),o=f.item.children(".menu-item-transport"),g=f.item.menuItemDepth(),d(f,g),j=f.item.next()[0]==f.placeholder[0]?f.item.next():f.item,k=j.childMenuItems(),o.append(k),h=o.outerHeight(),h+=h>0?1*f.placeholder.css("margin-top").slice(0,-2):0,h+=f.helper.outerHeight(),n=h,h-=2,f.placeholder.height(h),p=g,k.each(function(){var b=a(this).menuItemDepth();p=b>p?b:p}),i=f.helper.find(".menu-item-handle").outerWidth(),i+=b.depthToPx(p-g),i-=2,f.placeholder.width(i),l=f.placeholder.next(),l.css("margin-top",n+"px"),f.placeholder.detach(),a(this).sortable("refresh"),f.item.after(f.placeholder),l.css("margin-top",0),c(f)},stop:function(a,c){var d,e,h=q-g;d=o.children().insertAfter(c.item),e=c.item.find(".item-title .is-submenu"),q>0?e.show():e.hide(),0!==h&&(c.item.updateDepthClass(q),d.shiftDepthClass(h),f(h)),b.registerChange(),c.item.updateParentMenuItemDBId(),c.item[0].style.top=0,b.isRTL&&(c.item[0].style.left="auto",c.item[0].style.right=0),b.refreshKeyboardAccessibility(),b.refreshAdvancedAccessibility()},change:function(a,d){d.placeholder.parent().hasClass("menu")||(j.length?j.after(d.placeholder):b.menuList.prepend(d.placeholder)),c(d)},sort:function(e,f){var g=f.helper.offset(),j=b.isRTL?g.left+f.helper.width():g.left,o=b.negateIfRTL*b.pxToDepth(j-r);o>i||g.top
o&&(o=h),o!=q&&d(f,o),m&&g.top+n>m&&(k.after(f.placeholder),c(f),a(this).sortable("refreshPositions"))}})},initManageLocations:function(){a("#menu-locations-wrap form").submit(function(){window.onbeforeunload=null}),a(".menu-location-menus select").on("change",function(){var b=a(this).closest("tr").find(".locations-edit-menu-link");a(this).find("option:selected").data("orig")?b.show():b.hide()})},attachMenuEditListeners:function(){var b=this;a("#update-nav-menu").bind("click",function(a){if(a.target&&a.target.className){if(-1!=a.target.className.indexOf("item-edit"))return b.eventOnClickEditLink(a.target);if(-1!=a.target.className.indexOf("menu-save"))return b.eventOnClickMenuSave(a.target);if(-1!=a.target.className.indexOf("menu-delete"))return b.eventOnClickMenuDelete(a.target);if(-1!=a.target.className.indexOf("item-delete"))return b.eventOnClickMenuItemDelete(a.target);if(-1!=a.target.className.indexOf("item-cancel"))return b.eventOnClickCancelLink(a.target)}}),a('#add-custom-links input[type="text"]').keypress(function(b){13===b.keyCode&&(b.preventDefault(),a("#submit-customlinkdiv").click())})},setupInputWithDefaultTitle:function(){var b="input-with-default-title";a("."+b).each(function(){var c=a(this),d=c.attr("title"),e=c.val();if(c.data(b,d),""===e)c.val(d);else{if(d==e)return;c.removeClass(b)}}).focus(function(){var c=a(this);c.val()==c.data(b)&&c.val("").removeClass(b)}).blur(function(){var c=a(this);""===c.val()&&c.addClass(b).val(c.data(b))}),a(".blank-slate .input-with-default-title").focus()},attachThemeLocationsListeners:function(){var b=a("#nav-menu-theme-locations"),c={};c.action="menu-locations-save",c["menu-settings-column-nonce"]=a("#menu-settings-column-nonce").val(),b.find('input[type="submit"]').click(function(){return b.find("select").each(function(){c[this.name]=a(this).val()}),b.find(".spinner").show(),a.post(ajaxurl,c,function(){b.find(".spinner").hide()}),!1})},attachQuickSearchListeners:function(){var c;a(".quick-search").keypress(function(d){var e=a(this);return 13==d.which?(b.updateQuickSearchResults(e),!1):(c&&clearTimeout(c),c=setTimeout(function(){b.updateQuickSearchResults(e)},400),void 0)}).attr("autocomplete","off")},updateQuickSearchResults:function(c){var d,e,f=2,g=c.val();g.length'}),a("#update-nav-menu").append(c),b.menuList.find(".menu-item-data-position").val(function(a){return a+1}),window.onbeforeunload=null,!0):(d.parent().addClass("form-invalid"),!1)},eventOnClickMenuDelete:function(){return window.confirm(navMenuL10n.warnDeleteMenu)?(window.onbeforeunload=null,!0):!1},eventOnClickMenuItemDelete:function(c){var d=parseInt(c.id.replace("delete-",""),10);return b.removeMenuItem(a("#menu-item-"+d)),b.registerChange(),!1},processQuickSearchQueryResponse:function(b,c,d){var e,f,g,h={},i=document.getElementById("nav-menu-meta"),j=/menu-item[(\[^]\]*/,k=a("").html(b).find("li");return k.length?(k.each(function(){if(g=a(this),e=j.exec(g.html()),e&&e[1]){for(f=e[1];i.elements["menu-item["+f+"][menu-item-type]"]||h[f];)f--;h[f]=!0,f!=e[1]&&g.html(g.html().replace(new RegExp("menu-item\\["+e[1]+"\\]","g"),"menu-item["+f+"]"))}}),a(".categorychecklist",d).html(k),a(".spinner",d).hide(),void 0):(a(".categorychecklist",d).html("
"+navMenuL10n.noResultsFound+"
"),a(".spinner",d).hide(),void 0)},removeMenuItem:function(b){var c=b.childMenuItems();b.addClass("deleting").animate({opacity:0,height:0},350,function(){var d=a("#menu-instructions");b.remove(),c.shiftDepthClass(-1).updateParentMenuItemDBId(),0===a("#menu-to-edit li").length&&(a(".drag-instructions").hide(),d.removeClass("menu-instructions-inactive"))})},depthToPx:function(a){return a*b.options.menuItemDepthPerLevel},pxToDepth:function(a){return Math.floor(a/b.options.menuItemDepthPerLevel)}},a(document).ready(function(){wpNavMenu.init()})}(jQuery);
\ No newline at end of file