Make WordPress Core

Ticket #32814: 32814.7.diff

File 32814.7.diff, 5.6 KB (added by adamsilverstein, 10 years ago)
  • wp-admin/js/customize-nav-menus.js

     
    16471647                                                return;
    16481648                                        }
    16491649                                        var select = widgetControl.container.find( 'select' );
    1650                                         if ( select.find( 'option[value=' + String( menuId ) + ']' ).length === 0 ) {
     1650                                        if ( 0 === select.find( 'option[value=' + String( menuId ) + ']' ).length ) {
    16511651                                                select.append( new Option( name, menuId ) );
    16521652                                        }
    16531653                                } );
    1654                                 $( '#available-widgets-list .widget-inside:has(input.id_base[value=nav_menu]) select:first' ).append( new Option( name, menuId ) );
     1654                                // Add the menu to the widget template.
     1655                                var template = $( '#available-widgets-list .widget-inside:has( input.id_base[ value=nav_menu ] ) select:first' );
     1656
     1657                                // Avoid duplicate insertion.
     1658                                if ( 0 === template.find( 'option[value=' + String( menuId ) + ']' ).length ) {
     1659                                                template.append(new Option(name, menuId));
     1660                                }
    16551661                        }
    16561662                },
    16571663
     
    16951701                                                var select = widgetControl.container.find( 'select' );
    16961702                                                select.find( 'option[value=' + String( menuId ) + ']' ).text( name );
    16971703                                        });
    1698                                         $( '#available-widgets-list .widget-inside:has(input.id_base[value=nav_menu]) select:first option[value=' + String( menuId ) + ']' ).text( name );
    16991704                                }
    17001705                        } );
    17011706
     
    17671772                                                menuItemControl.setting.set( setting );
    17681773                                        });
    17691774                                });
     1775
    17701776                        });
    1771 
    17721777                        control.isReordering = false;
    17731778
    17741779                        /**
     
    18351840                                }
    18361841                                select.find( 'option[value=' + String( menuId ) + ']' ).remove();
    18371842                        });
    1838                         $( '#available-widgets-list .widget-inside:has(input.id_base[value=nav_menu]) select:first option[value=' + String( menuId ) + ']' ).remove();
     1843
    18391844                },
    18401845
    18411846                // Setup theme location checkboxes.
     
    22322237
    22332238                        // Focus on the new menu section.
    22342239                        api.section( customizeId ).focus(); // @todo should we focus on the new menu's control and open the add-items panel? Thinking user flow...
     2240
     2241                        // Fix an issue with extra space at top immediately after creating new menu.
     2242                        $( '#menu-to-edit' ).css( 'margin-top', 0 );
    22352243                }
    22362244        });
    22372245
     
    23702378                                        }
    23712379                                } );
    23722380
     2381                                /**
     2382                                 * Update the saved menu in any custom menu widgets.
     2383                                 * If the previous_term_id item is selected, reselect the
     2384                                 * item with the updated term_id.
     2385                                 */
     2386                                api.control.each( function( setting ) {
     2387                                        // Only act on nav_menu widgets.
     2388                                        if ( ! setting.extended( api.controlConstructor.widget_form ) ||
     2389                                                'nav_menu' !== setting.params.widget_id_base ) {
     2390                                                return;
     2391                                        }
     2392                                        var select, oldMenuOption, oldMenuSelected, newMenuOption;
     2393                                        select          = setting.container.find( 'select' );
     2394                                        oldMenuOption   = select.find( 'option[value=' + String( update.previous_term_id ) + ']' );
     2395                                        oldMenuSelected = select.find( 'option[value=' + String( update.previous_term_id ) + ']:selected' );
     2396                                        newMenuOption   = select.find( 'option[value=' + String( update.term_id ) + ']' );
     2397
     2398                                        // Adjust menu options matching the old ID, setting them to the new ID.
     2399                                        if ( oldMenuSelected.length !== 0 && newMenuOption !== 0 ) {
     2400                                                // Remove the old option.
     2401                                                oldMenuOption.remove();
     2402                                                // Select the new option.
     2403                                                newMenuOption.attr( 'selected', true ).trigger( 'change' );
     2404                                        }
     2405
     2406
     2407                                } );
     2408
    23732409                                if ( oldSection.expanded.get() ) {
    23742410                                        // @todo This doesn't seem to be working.
    23752411                                        newSection.expand();
  • wp-admin/js/customize-widgets.js

     
    10411041                        params.wp_customize = 'on';
    10421042                        params.nonce = api.Widgets.data.nonce;
    10431043                        params.theme = api.settings.theme.stylesheet;
     1044                        params.customized = wp.customize.previewer.query().customized;
    10441045
    10451046                        data = $.param( params );
    10461047                        $inputs = this._getInputs( $widgetContent );
  • wp-admin/js/user-profile.js

     
    3838
    3939                parentform.on('submit', function(){
    4040                        pw_field2.val( pw_field.val() );
    41                         pw_field.attr('type', 'password');
     41                        pw_field.each(function () { this.type = "password"; });
    4242                });
    4343
    4444
     
    9393                pw_togglebtn.on( 'click', function() {
    9494                        var show = pw_togglebtn.attr( 'data-toggle' );
    9595                        if ( show == 1 ) {
    96                                 pw_field.attr( 'type', 'text' );
     96                                pw_field.each(function () { this.type = "text"; });
    9797                                pw_togglebtn.attr( 'data-toggle', 0 )
    9898                                        .find( '.text' )
    9999                                                .text( 'hide' )
    100100                                ;
    101101                        } else {
    102                                 pw_field.attr( 'type', 'password' );
     102                                pw_field.each(function () { this.type = "password"; });
    103103                                pw_togglebtn.attr( 'data-toggle', 1 )
    104104                                        .find( '.text' )
    105105                                                .text( 'show' )
  • wp-includes/nav-menu.php

     
    1212 *
    1313 * @since 3.0.0
    1414 *
    15  * @param string $menu Menu ID, slug, or name.
     15 * @param string $menu Menu ID, slug, or name - or the menu object.
    1616 * @return object|false False if $menu param isn't supplied or term does not exist, menu object if successful.
    1717 */
    1818function wp_get_nav_menu_object( $menu ) {
    1919        $menu_obj = false;
    20         if ( $menu ) {
     20
     21        if ( is_object( $menu ) ) {
     22                $menu_obj = $menu;
     23        }
     24
     25        if ( $menu && ! $menu_obj ) {
    2126                $menu_obj = get_term( $menu, 'nav_menu' );
    2227
    2328                if ( ! $menu_obj ) {