User:TheDragonFire300/common.js

// Code imported from Rethering (Script) RPG, one of my JS projects. // Thanks to nickf. // https://stackoverflow.com/questions/1586330/access-get-directly-from-javascript var parts = window.location.search.substr(1).split("&"); var $_GET = {}; for (var i = 0; i < parts.length; i++) { var temp = parts[i].split("="); $_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]); }

addOnloadHook(function {	var elems = document.getElementsByClassName('editsection');	for (i = 0; i < elems.length; i++) {		var span = document.createElement('span');		var link = document.createElement('a');		link.href = '#top';		link.appendChild(document.createTextNode('back to top'));		span.appendChild(document.createTextNode('['));		span.appendChild(link);		span.appendChild(document.createTextNode('] '));		elems[i].insertBefore(span, elems[i].firstChild);	} });

// Auto-check checkboxes if needed. if ($_GET["autocheck"] === "yes") { var wikilinks = document.getElementsByTagName('input'); for (var wikilinknumber = 0; wikilinknumber < wikilinks.length; wikilinknumber++) { if (wikilinks[wikilinknumber].type === "checkbox") { wikilinks[wikilinknumber].setAttribute("checked", "checked"); }   } }

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:DannyS712/Readonly.js&action=raw&ctype=text/javascript');