Make WordPress Core

Changeset 14740


Ignore:
Timestamp:
05/19/2010 08:44:28 AM (15 years ago)
Author:
markjaquith
Message:

Remove trailing tabs from nav-menu.dev.js

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/nav-menu.dev.js

    r14725 r14740  
    1212
    1313(function($) {
    14    
     14
    1515    var api = wpNavMenu = {
    16        
     16
    1717        options : {
    1818            menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead.
    1919            globalMaxDepth : 11
    2020        },
    21        
     21
    2222        menuList : undefined,   // Set in init.
    2323        targetList : undefined, // Set in init.
     
    2929
    3030            this.jQueryExtensions();
    31            
     31
    3232            this.attachMenuEditListeners();
    33        
     33
    3434            this.setupInputWithDefaultTitle();
    3535            this.attachAddMenuItemListeners();
     
    4848            this.initTabManager();
    4949        },
    50        
     50
    5151        jQueryExtensions : function() {
    5252            // jQuery extensions
     
    172172
    173173                    transport = ui.item.children('.menu-item-transport');
    174                
     174
    175175                    // Set depths. currentDepth must be set before children are located.
    176176                    originalDepth = ui.item.menuItemDepth();
    177177                    updateCurrentDepth(ui, originalDepth);
    178                
     178
    179179                    // Attach child elements to parent
    180180                    // Skip the placeholder
     
    202202                    width -= 2; // Subtract 2 for borders
    203203                    ui.placeholder.width(width);
    204                    
     204
    205205                    // Update the list of menu items.
    206206                    tempHolder = ui.placeholder.next();
     
    210210                    ui.item.after( ui.placeholder ); // reattach the placeholder.
    211211                    tempHolder.css('margin-top', 0); // reset the margin
    212                    
     212
    213213                    // Now that the element is complete, we can update...
    214214                    updateSharedVars(ui);
     
    219219                    // Return child elements to the list
    220220                    children = transport.children().insertAfter(ui.item);
    221                
     221
    222222                    // Update depth classes
    223223                    if( depthChange != 0 ) {
     
    247247                    if( depth != currentDepth )
    248248                        updateCurrentDepth(ui, depth);
    249                        
     249
    250250                    // If we overlap the next element, manually shift downwards
    251251                    if( nextThreshold && offset.top + helperHeight > nextThreshold ) {
     
    259259            function updateSharedVars(ui) {
    260260                var depth;
    261                
     261
    262262                prev = ui.placeholder.prev();
    263263                next = ui.placeholder.next();
     
    332332        attachAddMenuItemListeners : function() {
    333333            var form = $('#nav-menu-meta');
    334        
     334
    335335            form.find('.add-to-menu input').click(function(){
    336336                $(this).trigger('wp-add-menu-item', [api.addMenuItemToBottom]);
     
    344344            });
    345345        },
    346        
     346
    347347        attachThemeLocationsListeners : function() {
    348348            var loc = $('#nav-menu-theme-locations'),
     
    360360            });
    361361        },
    362    
     362
    363363        attachQuickSearchListeners : function() {
    364364            var searchTimer;
    365            
     365
    366366            $('.quick-search').keypress(function(e){
    367367                var t = $(this);
    368                
     368
    369369                if( 13 == e.which ) {
    370370                    api.updateQuickSearchResults( t );
    371371                    return false;
    372372                }
    373                
     373
    374374                if( searchTimer ) clearTimeout(searchTimer);
    375                
     375
    376376                searchTimer = setTimeout(function(){
    377377                    api.updateQuickSearchResults( t );
     
    379379            }).attr('autocomplete','off');
    380380        },
    381        
     381
    382382        updateQuickSearchResults : function(input) {
    383383            var panel, params,
    384384            minSearchLength = 2,
    385385            q = input.val();
    386            
     386
    387387            if( q.length < minSearchLength ) return;
    388            
     388
    389389            panel = input.parents('.tabs-panel');
    390390            params = {
     
    403403            });
    404404        },
    405    
     405
    406406        addCustomLink : function( processMethod ) {
    407407            var url = $('#custom-menu-item-url').val(),
    408408                label = $('#custom-menu-item-name').val();
    409            
     409
    410410            processMethod = processMethod || api.addMenuItemToBottom;
    411        
     411
    412412            if ( '' == url || 'http://' == url )
    413413                return false;
    414        
     414
    415415            // Show the ajax spinner
    416416            $('.customlinkdiv img.waiting').show();
     
    423423            });
    424424        },
    425    
     425
    426426        addLinkToMenu : function(url, label, processMethod, callback) {
    427427            processMethod = processMethod || api.addMenuItemToBottom;
    428428            callback = callback || function(){};
    429        
     429
    430430            api.addItemToMenu({
    431431                '-1': {
     
    436436            }, processMethod, callback);
    437437        },
    438    
     438
    439439        addItemToMenu : function(menuItem, processMethod, callback) {
    440440            var menu = $('#menu').val(),
    441441                nonce = $('#menu-settings-column-nonce').val();
    442            
     442
    443443            processMethod = processMethod || function(){};
    444444            callback = callback || function(){};
    445        
     445
    446446            params = {
    447447                'action': 'add-menu-item',
     
    450450                'menu-item': menuItem
    451451            };
    452        
     452
    453453            $.post( ajaxurl, params, function(menuMarkup) {
    454454                processMethod(menuMarkup, params);
     
    466466            $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
    467467        },
    468    
     468
    469469        addMenuItemToTop : function( menuMarkup, req ) {
    470470            $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
    471471        },
    472    
     472
    473473        attachHomeLinkListener : function() {
    474474            $('.add-home-link', '.customlinkdiv').click(function(e) {
     
    482482                var selectAreaMatch, activePanel, panelId, wrapper, items,
    483483                    target = $(e.target);
    484                
     484
    485485                if ( target.hasClass('nav-tab-link') ) {
    486486                    panelId = /#(.*)$/.exec(e.target.href);
     
    489489                    else
    490490                        return false;
    491                        
     491
    492492                    wrapper = target.parents('.inside').first();
    493493
    494494                    // upon changing tabs, we want to uncheck all checkboxes
    495495                    $('input', wrapper).removeAttr('checked');
    496                    
     496
    497497                    $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive');
    498498                    $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active');
     
    707707            items = resp.match(/<li>.*<\/li>/g);
    708708
    709             if( ! items ) {             
     709            if( ! items ) {
    710710                $('.categorychecklist', panel).html( '<li><p>' + navMenuL10n.noResultsFound + '</p></li>' );
    711711                $('img.waiting', panel).hide();
Note: See TracChangeset for help on using the changeset viewer.