Jump to content

User:Alexis Jazz/Vector-2022-inline-toc.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//WTFPL
var moveMenu = setInterval(function () {
	clearInterval(moveMenu); //without the delay the collapsible bits don't work. I guess they are populated after page load or something
	try{
		$('#mw-content-text .mw-headline')[0].parentElement.parentElement.insertBefore($('#mw-panel-toc')[0],$('#mw-content-text .mw-headline')[0].parentElement);
		mw.util.addCSS('.sidebar-toc-title button{display:none !important}#inline-toc{background-color:#f8f9fa;border:1px solid #a2a9b1;position:inherit !important}');
		$('#mw-panel-toc')[0].id = 'inline-toc';
	} catch (ev) {}
},2000);