User:Anakin101/toplinks.js

/* Script to add a [top] link beside the [edit] link on section headings */

addOnloadHook(function {	var spans = document.getElementsByTagName('span');	for (var i = spans.length; i--;) {		if (spans[i].getAttribute('class') == 'mw-headline') {			var toplink = document.createElement('span');			toplink.setAttribute('class', 'editsection');			toplink.innerHTML = ' [top] ';			spans[i].parentNode.insertBefore(toplink, spans[i]);		}	} });