• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Greasemonkey script for blocking posters' avatars

Status
Not open for further replies.

wolfmat

Confirmed Asshole
Edit: hateradio made a similar, but more elegant script that doesn't need jQuery, read this: http://www.neogaf.com/forum/showpost.php?p=25163098&postcount=58

Original OP follows.

--

In case anyone else needs it, here's my Greasemonkey script for blocking posters' avatars (I used jQuery 'cause I'm lazy):
Code:
// ==UserScript==
// @name           NeoGAF Avatar Blocker
// @namespace      wmat
// @description    Block disgusting avatars on GAF
// @include        http://www.neogaf.com/forum/*
// @include        http://neogaf.com/forum*
// ==/UserScript==
var usernames   = new Array("Wraith RazieL"); // <-- The blocked guys' names

var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);

function GM_wait()
{
	if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; if(usernames.length > 0) execJQuery(); }
}
    
GM_wait();

function execJQuery()
	{
		for (var i=0; i < usernames.length; i++){
			$("a[class='bigusername']:contains('" + usernames[i] + "')").css('color', 'black').parent().parent().children().children().children("img").css('display', 'none');
		}	
	}
Add new avatars to be blocked to the "usernames" Array, like this:
Code:
var usernames   = new Array("Wraith RazieL", "wmat");

Shoutout to Zombie James; he made the GAF Highlighter, I stole his jQuery init junk and the filter.
 
Testing:

nq5i13.gif
 
i always wondered about jquery, is it possible to put the jquery source file on your local harddrive somewhere and point to that instead?
 

wolfmat

Confirmed Asshole
deadbeef said:
Can you modify it so that it blocks every avatar?
User CP -> Edit Options
2643z7r.png


out0v0rder said:
i always wondered about jquery, is it possible to put the jquery source file on your local harddrive somewhere and point to that instead?
Yeah. You'd have to have a server running though, since your Javascript would access the jQuery source by HTTP request. Well, you could write file:///something, I think, but that's just nasty.
 
I just put people on my ignore list. Like that guy with the water balloon hitting some guy's face. Fuck that ava, and I don't need to know what he wants to say enough to bear looking at that.
 

wolfmat

Confirmed Asshole
samus i am said:
It's really just for the avatar under the username. I guess otherwise, I'd have to write the image path to some variable and set "display: none;" for all occurences of img tags with said URL.
 

epmode

Member
wmat said:
User CP -> Edit Options
2643z7r.png
I've had that option checked for years. It only works for avatars hosted by GAF. Soooo it does almost nothing.

Can you modify the script so it blocks everything? Or can we just use * or something.
 
wmat said:
It's really just for the avatar under the username. I guess otherwise, I'd have to write the image path to some variable and set "display: none;" for all occurences of img tags with said URL.

It was a joke :lol


I am surprised that people would go to such lengths (even block people) because of avatars.
 

epmode

Member
samus i am said:
It was a joke :lol


I am surprised that people would go to such lengths (even block people) because of avatars.
Animated avatars in general are incredibly distracting. I disable all avatars on most other forums I visit so I'd love something like that for GAF.
 

wolfmat

Confirmed Asshole
epmode said:
I've had that option checked for years. It only works for avatars hosted by GAF. Soooo it does almost nothing.
I didn't know. That's dumb.

Here's the code for an all-avatar blocker (just the ones under usernames though):
Code:
// ==UserScript==
// @name           GAF All Avatar Blocker
// @namespace      wmat
// @description    GAF Avatars being blocked here
// @include        http://www.neogaf.com/forum/*
// @include        http://neogaf.com/forum*
// ==/UserScript==

var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
function GM_wait()
{
	if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; execJQuery(); }
}
    
GM_wait();

// Execute
////////////////////////////////////////////////
function execJQuery()
	{
		$("a[class='bigusername']").css('color', 'black').parent().parent().children().children().children("img").css('display', 'none');
	}
 

TheSeks

Blinded by the luminous glory that is David Bowie's physical manifestation.
Cowie said:
Nice! Now I can block all of the avatars with real women in them. They're distracting and disgusting.

:lol

Honestly. I wish "rip them out" premantely removed some avatars. I generally don't mind avatars, but there are some that I want to remove perma but don't want to use (IMO) useless Greasemonkey to do. :/
 

wolfmat

Confirmed Asshole
eXistor said:
Why would you want to block them? I think they liven up the place, no matter the avatar.
The thing is that Wraith RazieL has an avatar with bulging eyes, and I just can't stand that. I have a thing with eyes, I have to look away at "that" scene in Clockwork Orange, for instance. I have nothing against the dude though.
 

Chris R

Member
So, you want to live dangerously do you? Then try out my shitty hack job. New to jQuery so I know this selector is total shit and should catch more users than intended, but whatever. If someone wants to fix it so it only grabs username's Avatar then go right ahead ( I couldn't get that to work ).

Code:
function execJQuery() {
	for (var i=0; i < usernames.length; i++) {
		var srcToBlock = $("img[alt*='" + usernames[i] + "']").attr("src");
		$("img[src='" + srcToBlock + "']").css('display', 'none');
	}
}

Blocks all occurrences of blocked avatars from that source on a page. Guess it won't block if someone quotes to a new page and there isn't anything to say that src is blocked (ie if that user hasn't posted on said new page yet) but whatever. Someone take my shitty just woke up 2 mins hack job and make it shine!
 

wolfmat

Confirmed Asshole
FreezeSSC said:
finalfantasy0006.gif


did he change it cause thats not bad at all?
I guess he got a lot of requests and caved in. Time to unblock him, I guess! Just remove his name (and the quotes) from the Array :)
 

wolfmat

Confirmed Asshole
rhfb said:
Blocks all occurrences of blocked avatars from that source on a page. Guess it won't block if someone quotes to a new page and there isn't anything to say that src is blocked (ie if that user hasn't posted on said new page yet) but whatever. Someone take my shitty just woke up 2 mins hack job and make it shine!
I think it doesn't get better than that — after all, once the avatar is quoted on a new page, there's no way to dig back to a page where the user posted at all.

The "proper" way would be ABP, of course, but we don't want to block ads here, so that doesn't work out well.
 

Corran Horn

May the Schwartz be with you
wmat said:
In case anyone else needs it, here's my Greasemonkey script for blocking posters' avatars (I used jQuery 'cause I'm lazy):

Shoutout to D4Danger; he made the GAF Highlighter, I stole his jQuery init junk and the filter.


You wouldnt block my avatar???

Mandy Moore avatars unite!
 

Label

The Amiga Brotherhood
Mechanical Snowman said:
I do hate that guy Bread's avatar, but it's not annoying enough to block it.

My current avatar is pretty weird :lol I hope no one blocks it though :(

Who is that girl by the way? I keep seeing here everywhere.

Also awesome can finally get rid of all those annoying Asian girl (and band) avatars! :D
 

Chris R

Member
tokkun said:
Is there a way to automatically block all .gif avatars, but leave the others alone?
You could easily block all avatars that end with .gif, but the thing is I'm assuming you want to block all ANIMATED gifs and not all gifs. gifs can be static too, and I don't think there is an easy way to detect if a gif is static or animated.
 

wolfmat

Confirmed Asshole
rhfb said:
You could easily block all avatars that end with .gif, but the thing is I'm assuming you want to block all ANIMATED gifs and not all gifs. gifs can be static too, and I don't think there is an easy way to detect if a gif is static or animated.
You'd have to parse the .gif header to check if it's animated; that takes some effort.
D4Danger said:
that wasn't me.

Zombie James (aka _leech_) made that

http://www.neogaf.com/forum/showthread.php?t=395943
Whoops, will correct myself then. Thanks.
 

FreezeSSC

Member
Who's the user with an avatar of some guy getting what looks like dicks shoved in his mouth? i'd like to use this on him.
 

louis89

Member
I have Patrick Bateman on my ignore list for this reason... gross.

Also that guy with the avatar that's a gif from some disgusting horror movie with a guy having his head pulled off or something... wtf is that anyway?
 

Entropia

No One Remembers
Cool script and all, but are some of you guys that picky to block avatars? Christ, I never block/ignore anything on here.
 

Zeppu

Member
I also made a GAF script. Also, stolen code from zombie james. It's for chrome really but you guys could probably convert it to greasemonkey in a second.

It helps you follow the massive threads properly (and I'm the only one who uses it really).

Check it, tell me what you guys think.

Linky

Um, instructions:
click on the bulb or double click on the username when quoted.
 

Wads

Banned
Nice, I actually had one poster in mind and was looking for something like this, but I got sidetracked and gave up on it. Now I forgot what avatar it was, but now I got a solution if I see it again!
 
Status
Not open for further replies.
Top Bottom