Only render table of contents on pages with a table of contents

Bug: T193517
Change-Id: I0ed0255280f525d7726d2e09ceab15a76e2d6026
This commit is contained in:
jdlrobson 2018-06-11 14:12:46 -07:00 committed by Jdlrobson
parent b56e82c8a8
commit 2e7e7d3259
1 changed files with 2 additions and 1 deletions

View File

@ -31,7 +31,8 @@
}
// add a ToC only for "view" action (user is reading a page)
if ( mw.config.get( 'wgAction' ) === 'view' ) {
// provided a table of contents placeholder has been rendered
if ( mw.config.get( 'wgAction' ) === 'view' && $( '#toc' ).length > 0 ) {
init( M.getCurrentPage() );
}