All pastes #252913 Raw Edit

Anonymous

public javascript v1 · immutable
#252913 ·published 2006-11-20 02:27 UTC
rendered paste body
// ==UserScript==// @name Ignore people on Planet// @author Faux// @namespace http://faux.uwcs.co.uk/// @version 0.1// @description Adds ignore buttons to planet that collapse the user in question's posts.// add excluded sites here (if the script causes problems on those sites)// @exclude http://www.some.example.com/*// @include http://planet.uwcs.co.uk/*// ==/UserScript==var prefix = 'zomgfauxplanet';// I hate you, javascript.var trackedelems /*Nick => (index => element)*/ = Array();// On load, add all the buttons.window.opera.addEventListener('BeforeEvent.load',function (e){	if( e.event.target instanceof Document )	{		var eders = document.getElementsByTagName('h3');		var ael,count;		for (var i=0; i<eders.length; i++)			// ignore planet lameness			if (ael = eders[i].getElementsByTagName('a')[0])			{				// Add the button.				var uname = ael.innerHTML;				eders[i].innerHTML =				'<input ' +				'name="checkbox' + prefix + ++count + '" ' +				'type="button" ' +				'value="ignore: " ' +				'onclick="removeall(\'' + uname + '\');"/> ' +				eders[i].innerHTML;				// Skip the text and get to the div|the image.				var diviq = eders[i].nextSibling.nextSibling;				// If it's the image..				if (diviq.className == "face")					// Skip the text and on to the div.					diviq = diviq.nextSibling.nextSibling;				// Ensure our map exists.				if (!trackedelems[uname])					trackedelems[uname] = Array();				// Save this div.				trackedelems[uname][trackedelems[uname].length] = diviq;				// Save any proceeding ones with the right classname.				while ((diviq = diviq.nextSibling.nextSibling) && diviq.className == "entrygroup")					trackedelems[uname][trackedelems[uname].length] = diviq;			}	}}, false);// Hide the divs associated with this nick.function removeall(a){	var q = trackedelems[a];	for (var g = 0; g < q.length; ++g)		q[g].style.display = "none";}