WordPress.org

Make WordPress Core

Ticket #20614: 20614.7-tabs.2.diff

File 20614.7-tabs.2.diff, 4.0 KB (added by SergeyBiryukov, 7 months ago)

Additional tab fixes

  • wp-admin/js/common.js

     
    211211                                el.addClass('opensub'); 
    212212                        } 
    213213                }); 
    214         } else { 
    215                 menu.find('li.wp-has-submenu').hoverIntent({ 
    216                         over: function(e){ 
    217                                 var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 ); 
     214        } 
    218215 
    219                                 if ( isNaN(top) || top > -5 ) // meaning the submenu is visible 
    220                                         return; 
     216        menu.find('li.wp-has-submenu').hoverIntent({ 
     217                over: function(e){ 
     218                        var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 ); 
    221219 
    222                                 menutop = $(this).offset().top; 
    223                                 wintop = $(window).scrollTop(); 
    224                                 maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar 
     220                        if ( isNaN(top) || top > -5 ) // meaning the submenu is visible 
     221                                return; 
    225222 
    226                                 b = menutop + m.height() + 1; // Bottom offset of the menu 
    227                                 h = $('#wpwrap').height(); // Height of the entire page 
    228                                 o = 60 + b - h; 
    229                                 f = $(window).height() + wintop - 15; // The fold 
     223                        menutop = $(this).offset().top; 
     224                        wintop = $(window).scrollTop(); 
     225                        maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar 
    230226 
    231                                 if ( f < (b - o) ) 
    232                                         o = b - f; 
     227                        b = menutop + m.height() + 1; // Bottom offset of the menu 
     228                        h = $('#wpwrap').height(); // Height of the entire page 
     229                        o = 60 + b - h; 
     230                        f = $(window).height() + wintop - 15; // The fold 
    233231 
    234                                 if ( o > maxtop ) 
    235                                         o = maxtop; 
     232                        if ( f < (b - o) ) 
     233                                o = b - f; 
    236234 
    237                                 if ( o > 1 ) 
    238                                         m.css('margin-top', '-'+o+'px'); 
    239                                 else 
    240                                         m.css('margin-top', ''); 
     235                        if ( o > maxtop ) 
     236                                o = maxtop; 
    241237 
    242                                 menu.find('li.menu-top').removeClass('opensub'); 
    243                                 $(this).addClass('opensub'); 
    244                         }, 
    245                         out: function(){ 
    246                                 $(this).removeClass('opensub').find('.wp-submenu').css('margin-top', ''); 
    247                         }, 
    248                         timeout: 200, 
    249                         sensitivity: 7, 
    250                         interval: 90 
    251                 }); 
     238                        if ( o > 1 ) 
     239                                m.css('margin-top', '-'+o+'px'); 
     240                        else 
     241                                m.css('margin-top', ''); 
    252242 
    253                 menu.on('focus.adminmenu', '.wp-submenu a', function(e){ 
    254                         $(e.target).closest('li.menu-top').addClass('opensub'); 
    255                 }).on('blur.adminmenu', '.wp-submenu a', function(e){ 
    256                         $(e.target).closest('li.menu-top').removeClass('opensub'); 
    257                 }); 
    258         } 
     243                        menu.find('li.menu-top').removeClass('opensub'); 
     244                        $(this).addClass('opensub'); 
     245                }, 
     246                out: function(){ 
     247                        $(this).removeClass('opensub').find('.wp-submenu').css('margin-top', ''); 
     248                }, 
     249                timeout: 200, 
     250                sensitivity: 7, 
     251                interval: 90 
     252        }); 
    259253 
     254        menu.on('focus.adminmenu', '.wp-submenu a', function(e){ 
     255                $(e.target).closest('li.menu-top').addClass('opensub'); 
     256        }).on('blur.adminmenu', '.wp-submenu a', function(e){ 
     257                $(e.target).closest('li.menu-top').removeClass('opensub'); 
     258        }); 
     259 
    260260        // Move .updated and .error alert boxes. Don't move boxes designed to be inline. 
    261261        $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); 
    262262        $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') ); 
  • wp-includes/js/admin-bar.js

     
    3030                                        el.addClass('hover'); 
    3131                                } 
    3232                        }); 
    33                 } else { 
    34                         adminbar.find('li.menupop').hoverIntent({ 
    35                                 over: function(e){ 
    36                                         $(this).addClass('hover'); 
    37                                 }, 
    38                                 out: function(e){ 
    39                                         $(this).removeClass('hover'); 
    40                                 }, 
    41                                 timeout: 180, 
    42                                 sensitivity: 7, 
    43                                 interval: 100 
    44                         }); 
    4533                } 
    4634 
     35                adminbar.find('li.menupop').hoverIntent({ 
     36                        over: function(e){ 
     37                                $(this).addClass('hover'); 
     38                        }, 
     39                        out: function(e){ 
     40                                $(this).removeClass('hover'); 
     41                        }, 
     42                        timeout: 180, 
     43                        sensitivity: 7, 
     44                        interval: 100 
     45                }); 
     46 
    4747                $('#wp-admin-bar-get-shortlink').click(function(e){ 
    4848                        e.preventDefault(); 
    4949                        $(this).addClass('selected').children('.shortlink-input').blur(function(){