Fix: always show table of contents
Do not conditionally render the table of contents. Note: the underlying condition, MFTOC, appears to still be used by MobileFormatter so it was unchanged. Bug: T189699 Change-Id: I7088ccad75c2a8504bf435418d7dd62238b2135d
This commit is contained in:
parent
180b55d13b
commit
e8b4559f5b
|
@ -1285,8 +1285,6 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin {
|
||||||
$vars = [
|
$vars = [
|
||||||
'wgMinervaDownloadNamespaces' => $this->getConfig()->get( 'MinervaDownloadNamespaces' ),
|
'wgMinervaDownloadNamespaces' => $this->getConfig()->get( 'MinervaDownloadNamespaces' ),
|
||||||
'wgMinervaMenuData' => $this->getMenuData(),
|
'wgMinervaMenuData' => $this->getMenuData(),
|
||||||
// Expose for skins.minerva.tablet.scripts
|
|
||||||
'wgMinervaTocEnabled' => $out->getProperty( 'MFTOC' ),
|
|
||||||
'wgMFDescription' => $out->getProperty( 'wgMFDescription' ),
|
'wgMFDescription' => $out->getProperty( 'wgMFDescription' ),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -12,24 +12,21 @@
|
||||||
function init( page ) {
|
function init( page ) {
|
||||||
var toc,
|
var toc,
|
||||||
sections = page.getSections(),
|
sections = page.getSections(),
|
||||||
$toc = $( '#toc' ),
|
$toc = $( '#toc' );
|
||||||
enableToc = mw.config.get( 'wgMinervaTocEnabled' );
|
|
||||||
|
|
||||||
if ( enableToc ) {
|
toc = new TableOfContents( {
|
||||||
toc = new TableOfContents( {
|
sections: sections
|
||||||
sections: sections
|
} );
|
||||||
} );
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-new
|
// eslint-disable-next-line no-new
|
||||||
new Toggler( toc.$el, 'toc-', null, true );
|
new Toggler( toc.$el, 'toc-', null, true );
|
||||||
// if there is a toc already, replace it
|
// if there is a toc already, replace it
|
||||||
if ( $toc.length > 0 ) {
|
if ( $toc.length > 0 ) {
|
||||||
// don't show toc at end of page, when no sections there
|
// don't show toc at end of page, when no sections there
|
||||||
$toc.replaceWith( toc.$el );
|
$toc.replaceWith( toc.$el );
|
||||||
} else {
|
} else {
|
||||||
// otherwise append it to the lead section
|
// otherwise append it to the lead section
|
||||||
toc.appendTo( page.getLeadSectionElement() );
|
toc.appendTo( page.getLeadSectionElement() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue