A persistent Table of Contents
A recent discussion on Wikitech-l lead to the idea of having a persistent Table of Contents on Wikipedia articles. Timo had shared the Underscore.js and Asciidoctor docs as examples but I liked Bootstrap’s the best because it collapses headings and shows you where you are. I sat down to experiment and came up with this —
You can try it by adding the following code to your common.js —
importStylesheet( 'User:Prtksxna/toc.css' ); importScript( 'User:Prtksxna/toc.js' );
The table will show up on the side once you have scrolled past the first heading. There are a few bugs and I am not collapsing headings as I am not yet sure if its necessary for Wikipedia articles. Feedback and ideas are welcome!