Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js |
— | — | @@ -23,24 +23,29 @@ |
24 | 24 | .append( |
25 | 25 | $( '<a></a>') |
26 | 26 | .text( $(this).text() ) |
27 | | - .attr( 'href', '#prefsection-' + i ) |
| 27 | + .attr( 'id', 'preftab-' + i + '-tab' ) |
| 28 | + .attr( 'href', '#preftab-' + i ) // Use #preftab-N instead of #prefsection-N to avoid jumping on click |
28 | 29 | .mousedown( function( e ) { |
29 | 30 | $(this).parent().parent().find( 'li' ).removeClass( 'selected' ); |
30 | 31 | $(this).parent().addClass( 'selected' ); |
31 | | - e.preventDefault(); |
32 | | - return false; |
33 | 32 | } ) |
34 | 33 | .click( function( e ) { |
35 | 34 | $( '#preferences > fieldset' ).hide(); |
36 | 35 | $( '#prefsection-' + i ).show(); |
37 | | - e.preventDefault(); |
38 | | - return false; |
39 | 36 | } ) |
40 | 37 | ) |
41 | 38 | ); |
42 | 39 | } |
43 | 40 | ); |
44 | 41 | |
| 42 | +// If we've reloaded the page or followed an open-in-new-window, |
| 43 | +// make the selected tab visible. |
| 44 | +var hash = window.location.hash; |
| 45 | +if( hash.match( /^#preftab-[\d]+$/ ) ) { |
| 46 | + var tab = $( hash + '-tab' ); |
| 47 | + tab.mousedown().click(); |
| 48 | +} |
| 49 | + |
45 | 50 | /** |
46 | 51 | * Given an email validity status (true, false, null) update the label CSS class |
47 | 52 | */ |