User:JeevesMkII/monobook.js

/*function awayPeskyFloatingBox { var divs = document.getElementsByTagName("div"); for (var i = 0; i < divs.length; ++i) { if (hasClass(divs[i], "plainlinks")) { divs[i].style.display = "none"; }	} }

addOnloadHook(awayPeskyFloatingBox);

function annoy_with_internet_meme {	document.body.innerHTML = " "; }

//addOnloadHook(annoy_with_internet_meme);

var wigoThreshold = -5;

function awayCrappyWigos { var divs = document.getElementsByTagName("span"); for (var i = 0; i < divs.length; ++i) { if (divs[i].id.substring(0, 4) == "wigo") { var voteCount = parseInt(divs[i].innerHTML); // traverse up the tree four times, and check we've hit the table var row = divs[i].parentNode.parentNode.parentNode.parentNode; if (row.tagName == "TABLE" && voteCount <= wigoThreshold) { row.style.display = "none"; }		}	} }

addOnloadHook(awayCrappyWigos);

function gettoken_api { var api = sajax_init_object; api.open('GET', wgServer + wgScriptPath + '/api.php?format=json&action=query&prop=info&indexpageids=1&intoken=edit&titles=Whatever', false); api.send(null); if(api.status==200) { var response = eval('(' + api.responseText + ')'); var token = response['query']['pages'][response['query']['pageids'][0]]['edittoken']; } else { alert('The token query returned an error.'); } return token; } function hotban(target) { var req = sajax_init_object; req.open('POST', wgServer + wgScriptPath + '/index.php?title=Special:Block&action=submit&wpBlockAddress=' + encodeURIComponent(target) + '&wpBlockExpiry=3%20seconds&wpAnonOnly=0&wpEnableAutoblock=0&wpCreateAccount=0&wpBlockReasonList=other&wpBlockReason=Quick-banning%20(using%20HotBan)&wpEditToken=' + encodeURIComponent(gettoken_api), true); req.onreadystatechange = function { if(req.readyState==4) { if(req.status==200) { /*alert('B&');*/ } else { alert('Oh noes! ' + req.responseText); }   }  };  req.send(null); } function qbonc(stuff,target, func) { stuff.onclick = function {func(target);} } function setuphotban { var anchors = document.getElementsByTagName('a'); for ( i in anchors ) { if (anchors[i].title != undefined && anchors[i].title.indexOf("Special:Block/") != -1) { target = anchors[i].title.substring(14,anchors[i].title.length); var qba = document.createElement('a'); qba.innerHTML = "HotBan®"; qba.style.cursor = "not-allowed"; qbonc(qba,target,hotban); if (anchors[i].nextSibling == undefined) { anchors[i].parentNode.appendChild(document.createTextNode(" ")); anchors[i].parentNode.appendChild(qba); } else { anchors[i].parentNode.insertBefore(qba,anchors[i].nextSibling); anchors[i].parentNode.insertBefore(document.createTextNode(" "),qba); }   }  } } //addOnloadHook(setuphotban);

function hotvandal(target) {	var req = sajax_init_object; var params = "action=submit&wpVandAddress=" + encodeURIComponent(target) + "&wpAnonOnly=0&wpEnableAutoblock=0&wpCreateAccount=0&wpVandReasonList=other&wpVandReason=Quick-vandalling%20(using%20HotVandal)&wpEditToken=" + encodeURIComponent(gettoken_api); req.open("POST", wgServer + wgScriptPath + "/index.php?title=Special:VandalBrake", true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-length", params.length);

req.onreadystatechange = function {		if(req.readyState==4) {			if(200 == req.status) {				alert("Vandalised!"); } 			else {				alert('Oh noes! ' + req.responseText); }			}		};

var orly = confirm("Do you really want to vandal bin " + target + "?"); if (orly) {		req.send(params); }	}

function init_hotvandal {	var anchors = document.getElementsByTagName("a"); for (i in anchors) {		if (anchors[i].title != undefined && anchors[i].title.indexOf("Special:Block/") != -1) {			target = anchors[i].title.substring(14,anchors[i].title.length); var qba = document.createElement('a'); qba.innerHTML = "HotVandal®"; qba.style.cursor = "not-allowed"; qbonc(qba,target,hotvandal); if (anchors[i].nextSibling == undefined) {				anchors[i].parentNode.appendChild(document.createTextNode(" ")); anchors[i].parentNode.appendChild(qba) } 			else {				anchors[i].parentNode.insertBefore(qba,anchors[i].nextSibling); anchors[i].parentNode.insertBefore(document.createTextNode(" "),qba); }			}		}	}

addOnloadHook(init_hotvandal);

importScript("User:JeevesMkII/javascript/textadventure.js");