User:Mrblahblah200/toc bs.js

importStylesheet('User:Mrblahblah200/toc_bs.css');

(function(options) {	var tocContents = $('#toc > ul').clone;	// If there is no table of contents on the page, don't add anything	if (tocContents.length === 0) {		return;	}	var newTOC = $('#p-interaction').clone;	newTOC.attr('id', 'p-toc');	newTOC.attr('aria-labelledby', 'p-toc-label');	var outer = $(' ');	outer.append(newTOC);	newTOC.find('h3').text('Contents').attr('id', 'p-toc-label');	newTOC.find('.body').html(tocContents);	newTOC.find('.body').changeElementType('nav');	$('#mw-panel').append(outer);	$(function { var navSelector = '#p-toc'; Toc.init($(navSelector)); $('body').scrollspy({			target: navSelector		}); });	if (options.fixed) {		$(window).on('scroll', function { var lang = $('#p-lang'); var scrollTop = $(document).scrollTop; var langBottomRel = lang.position.top + lang.outerHeight(true) - scrollTop; // console.log('postop: ' + lang.position.top.toFixed(2) + ', outerheight: ' + lang.outerHeight(true) + ', scrollTop: ' + scrollTop); // console.log(' = ' + langBottomRel); var toc = $('#p-toc'); var toc_outer = $('#outer-p-toc'); if (langBottomRel >= 0) { // Remove fixed positioning toc.removeClass('lang-fixed'); toc_outer.removeClass('lang-fixed'); } else { // Add fixed positioning toc.addClass('lang-fixed'); toc_outer.addClass('lang-fixed'); }		});	} })({	fixed: typeof TOC_fixed === 'undefined' ? true : TOC_fixed, });