mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-27 17:50:55 +00:00
fix: jumping to a tabber when no hash specified (#63)
Sorry for this oversight on my end.
This commit is contained in:
parent
f9983fb7a0
commit
787fede532
|
@ -349,18 +349,19 @@ function initTabber( tabber, count ) {
|
|||
* Retrieve target hash and trigger show panel
|
||||
* If no targetHash is invalid, use the first panel
|
||||
*
|
||||
* @param {boolean} isInitialLoad
|
||||
* @param {boolean} scrollIntoView
|
||||
*/
|
||||
function switchTab( isInitialLoad ) {
|
||||
function switchTab( scrollIntoView ) {
|
||||
var targetHash = new mw.Uri( location.href ).fragment;
|
||||
|
||||
// Switch to the first tab if no targetHash or no tab is detected
|
||||
// Switch to the first tab if no targetHash or no tab is detected and do not scroll to it
|
||||
// TODO: Remove the polyfill with CSS.escape when we are dropping IE support
|
||||
if ( !targetHash || !tabList.querySelector( '#tab-' + targetHash.replace( /[^a-zA-Z0-9-_]/g, '\\$&' ) ) ) {
|
||||
targetHash = tabList.firstElementChild.getAttribute( 'id' ).substring( 4 );
|
||||
scrollIntoView = false;
|
||||
}
|
||||
|
||||
showPanel( targetHash, false, isInitialLoad );
|
||||
showPanel( targetHash, false, scrollIntoView );
|
||||
}
|
||||
|
||||
switchTab( true );
|
||||
|
|
Loading…
Reference in a new issue