WordPress.org

Make WordPress Core

Ticket #21273: ticket.21273.3.diff

File ticket.21273.3.diff, 1.5 KB (added by ptahdunbar, 11 months ago)

removes hash when closing help screen

  • wp-admin/js/common.dev.js

     
    131131                        $('.screen-meta-toggle').css('visibility', ''); 
    132132                        panel.parent().hide(); 
    133133                }); 
     134 
     135                screenMeta.updateHash(); 
     136        }, 
     137 
     138        updateHash: function( hash ) { 
     139                hash = hash || ''; 
     140                window.location.hash = hash; 
    134141        } 
    135142}; 
    136143 
    137144/** 
    138145 * Help tabs. 
    139146 */ 
     147$(document).ready(function(){ 
     148        var panel = window.location.hash; 
     149 
     150        if ( panel && $(panel).length ) { 
     151                link = $('a[href='+ panel +']'), panel = $( panel ); 
     152 
     153                // Active the correct panel. 
     154                $('.contextual-help-tabs .active').removeClass('active'); 
     155                link.parent('li').addClass('active'); 
     156                $('.help-tab-content').not( panel ).removeClass('active').hide(); 
     157                panel.addClass('active').show(); 
     158 
     159                // Scroll back to the top. 
     160                $('html, body').animate({ scrollTop: 0 }, 'fast'); 
     161 
     162                // Open the help panel. 
     163                if ( $('#contextual-help-wrap').is(':visible') ) 
     164                        screenMeta.close( $('#contextual-help-wrap'), $('#contextual-help-link') ); 
     165                else 
     166                        screenMeta.open( $('#contextual-help-wrap'), $('#contextual-help-link') ); 
     167        }; 
     168}); 
     169 
    140170$('.contextual-help-tabs').delegate('a', 'click focus', function(e) { 
    141171        var link = $(this), 
    142172                panel; 
     
    153183 
    154184        panel = $( link.attr('href') ); 
    155185 
     186        screenMeta.updateHash( $(panel).attr('id') ); 
     187 
    156188        // Panels 
    157189        $('.help-tab-content').not( panel ).removeClass('active').hide(); 
    158190        panel.addClass('active').show();