- // Hide all links by default
- $( '.menu-item-settings .field-move a' ).css( 'display', 'none' );
-
- $( '.item-edit' ).each( function() {
- 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(), 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,
- hasSameDepthSibling = menuItem.nextAll( '.menu-item-depth-' + depth ).length;
-
- // Where can they move this menu item?
- if ( 0 !== position ) {
- thisLink = menuItem.find( '.menus-move-up' );
- thisLink.prop( 'title', menus.moveUp ).css( 'display', 'inline' );
- }