From 2e7e7d3259edb0967ab5aa34a765ab893538a381 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Mon, 11 Jun 2018 14:12:46 -0700 Subject: [PATCH] Only render table of contents on pages with a table of contents Bug: T193517 Change-Id: I0ed0255280f525d7726d2e09ceab15a76e2d6026 --- resources/skins.minerva.tablet.scripts/toc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/skins.minerva.tablet.scripts/toc.js b/resources/skins.minerva.tablet.scripts/toc.js index b7811d0..80f851a 100644 --- a/resources/skins.minerva.tablet.scripts/toc.js +++ b/resources/skins.minerva.tablet.scripts/toc.js @@ -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() ); }