Userscripts.org - Remove Spam Scripts

By JoeSimmons Last update Sep 27, 2013 — Installed 10,230 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 10 posts, 7 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
JoeSimmons Script's Author

You need to add them in lowercase. Sorry I'll fix that bug (and I'll fix the other bug with the removing function)
EDIT: I fixed it so you can put them in any case you want. It will work now.

 
xanderificus User

Not sure this is working. Thought I'd try it on the main page here, added "Travian" and "Ikariam" to its filter... no changes.

 
Mindeye Scriptwright

Use something like this:

function delNode(targetNode) {	
  if (targetNode) return targetNode.parentNode.removeChild(targetNode);
  return null;
}

HTMLElement in a Greasemonkey script is wrapped in an XPCNativeWrapper, so it won't let you add methods to its prototype. The "Element" in your code isn't a special object, it's a normal variable (an empty anonymous function after the assignment)

 
anonymous_user User

Thank you so much for this!!!

 
JoeSimmons Script's Author

Error: HTMLElement.prototype is undefined but I
fixed it anyways.

Although I can't use it on previousSibling...
Error: X.previousSibling.previousSibling.delete is not a function
Or this weirdly...
Error: X.delete is not a function

 
Avindra V.G. Scriptwright

thats strange... it should work in firefox 3.0.3

Try:

HTMLElement.prototype.delete=function() {
	this.parentNode.removeChild(this)
};

 
JoeSimmons Script's Author

Error: Element.prototype is undefined
Line: 28

but I fixed it with
if (!Element.prototype) {
Element = function() {};
}

 
Avindra V.G. Scriptwright

Not really going to read through it too much, but this might help (and in future scripts too):

Element.prototype.delete=function() {
	this.parentNode.removeChild(this)
};

So that once you have an element, e.g. X.parentNode.parentNode, you can simply call:

X.parentNode.parentNode.delete()

to get rid of it.