• 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.

Hide Forum Threads - A Tampermonkey script for hiding unwanted GAF threads

JeTmAn81

Member
Ever get tired of all those uninteresting threads clogging up your GAF screen (Destiny, I'm thinking of you)? I certainly do, and I always wished there was a way to get rid of the threads I don't care about and only see the ones that are new or interest me. So I wrote a script to do it.

To hide a thread, hover near the GAF symbol on the left of the thread and you'll get an X. Click that X and it will disappear. You'll never see it again unless you select Show Ignored Only or Show All from the select list next to the Post New Thread button at the top of the page. You will also get an X when viewing the ignored list. Thanks to lednerg for the CSS to do this. Clicking that will redeem it from its shadowy banishment and return it to the list of normally viewable threads.

I've updated the thread filtering process to search up to 5 additional pages for threads. If it can't find 40 unignored threads on the page you're on, it will look at the next page, and the next, etc. to find threads which you haven't ignored either explicitly or through word or user filtering, and will load them in at the bottom of the page. This should allow you to keep a full page of threads you're interested in.

dMXtETM.jpg




There is a filter CP (control panel) button next to the filter select list. Clicking that will open up three tabs:

Word Filter- This will let you filter thread titles by word. You can use * to indicate wild cards in plain text entries, or you can enter a full regular expression. You can also choose to apply word filtering to only gaming or only off-topic if you wish.

YARz7vH.jpg




Ignored List - This will show you the threads you've ignored, starting with the most recent. The titles are links to the threads. You can click a button to redeem any of them. The main thread list will refresh when you close the filter control panel.

FvTv5AQ.jpg




Settings - You can choose if you want the hide link option to show up as an X that appears when you hover over a thread/user, or if you want a specific hide/show link to show up next to each thread at all times.

You can also turn on or off the option to search additional pages for non-filtered threads. It's recommended to turn this on as it will help keep a whole displayed page full of interesting threads.

You can also choose the option to have threads expire from filtering after a certain amount of time. That means that threads which are explicitly ignored can come off the ignore list automatically. If you don't want threads to ever come back (unless you un-ignore them), don't select this option.

Lastly, you can enable cloud syncing. Click the generate button to create a new cloud sync key. Enter that same key in other browsers/computers to keep your data
synced up. You have the option to sync data instantly (every time a change is made), or every 1/5/10 minute(s).
Note that cloud sync frequency is set individually per instance, and is not saved to the cloud, so you'll have to set it
to what you want. Default is 5 minutes.

tXOqKnM.png





Down sides:

1. No mobile version

2. It makes the page load a little slower.

And finally here's the script. I am lousy with Javascript so feel free to make modifications or point out inefficiencies. Let me know if it seem useful to you! I've been dreaming about having the ability to do this for a long time so it's quite satisfying to finally be able to zap away all those pesky threads I'll never be interested in. I've now hosted the script on GreasyFork:

https://greasyfork.org/en/scripts/7106-hide-forum-threads

If you already have a user script plugin for your browser, you can just hit the install button. If not, hit the question mark next to the install button and it should link you to user script plugin/extensions for various browser types. After you've installed one of those, then you can go back and hit the install button.

edit: The code has been updated to version 0.2. The code has been cleaned up and a word filtering option has been added. The word filter button appears next to the filter list and allows you to filter by plain text (with optional * wildcard) or regular expression. The thread listing is updated as soon as you close the word filter box.

edit 2: Version 0.3 released. Adds filter control panel offering settings and list of ignored threads. Searches additional pages for unignored threads in an effort to display 40 threads on a page. Hide thread link display type updated.

edit 3: Version 0.4 released. Bug in Firefox causing thread filter selection to go blank fixed. Updated UI to display X's next to the GAF logo for each thread in Chrome, Firefox and Opera. Clicking the X ignores the thread. Ignore user ability added, an X will now appear next to the starter of a thread. Clicking the X will ignore all threads posted by that user. Does not extend into thread view itself, so you would still see posts by that user if you didn't ignore them through GAF itself.

edit 4: Update - v5.0 Released

Cloud sync - Cloud syncing has been enabled. By default it is turned off. You may enable it on the settings tab of the control panel.

Link styling - You now have the option to have the hide thread/user links show up the normal way (an X appears when
you hover over the NeoGAF logo for threads or the user's name for users) or to have Hide/Show specific links show up.
Defaults to "X". This can be changed on the settings tab.

Word filter area - You now have the option to apply a word filter only to gaming or off-topic sections. By default, word filtering
will apply to all areas, but you can make it specific when you add a new word now.

Bug fix(es) - Fixed the issue where the control panel was enlarging every time it was opened. Should now default to
60% of screen size.

edit 5: Update - v6.0

Minor bugfixes to get rid of the issue with repeated thread listings and also an issue preventing any more additional threads from being retrieved after 5 threads had been hidden in one session.
The last thing to do would be a mobile version. I've got a basic version working, but it's somewhat slow and buggy so it may not work out until there are better tools for running user scripts on Android/iOS. Have currently tested with TamperMonkey for Android and Dolphin on Android.

edit 6: Update - v7.0

Added the thread expiration setting. You can set threads to be automatically removed from the filter after a certain amount of days. This only applies to threads which have been explicitly ignored (as opposed to ignored via word or user filtering).

The main thread filtering process has been updated to use binary search rather than linear search. This reduces much of the processing time from linear to logarithmic. Now let's learn a little about time complexity!

If you've hidden 1,000 threads, a linear process would potentially have to search all 1,000 records for each thread which might be displayed in order to check and make sure the thread that GAF wants to show you isn't in the ignore list. By contrast, a logarithmic process can do that same search by checking only 10 records. That's about 10,000% more efficient! What's more, if your hidden thread list doubled to 2,000, the linear method could still need as many as 2,000 checks to make sure a thread should be shown, whereas the logarithmic method would only need to check one more record (for a total of 11 checks).

Ok, end learning time. The bottom line is that very large ignored thread lists should now get processed a lot more quickly.

As always, let me know if you spot any bugs as I've made quite a few changes.
 

ponpo

( ≖‿≖)
Thank you!

Awaiting the automatic word filter option. I got my blacklist ready

NSFW
G/A/F/?
Pop*
Ariana Grande
Iggy
Nicki
WorldStar
OT
Do you*
Help me*
bug
...
Florida
GAF, I just*
LTTP
# (devilhawk suggestion)

Edit: Time for comfy posting

CfNqbxd.png
 

JeTmAn81

Member
Lol, more filtering would be great but I'll need to figure out how to pull threads from subsequent pages first.
 
How is this not getting more attention? It works flawlessly and I can finally hide a shitton of threads that I have no interest in
 

terrisus

Member
Meh, tried the newer version of Opera, which this works with, and I don't like it (the newer version of Opera that is. This script is nifty)

Any way to get this to work with Violentmonkey, or otherwise work with Opera 12.17?
 

CheesecakeRecipe

Stormy Grey
Now I might be able to enjoy OT a little more knowing I can click away disturbing news threads! Would like to see if someone could figure out a cleaner way to add the "hide" option, like an additional column or something. Still, thanks for taking the time out to make this actually happen!
 
Now I might be able to enjoy OT a little more knowing I can click away disturbing news threads! Would like to see if someone could figure out a cleaner way to add the "hide" option, like an additional column or something. Still, thanks for taking the time out to make this actually happen!

Exactly my sentiments too.

Another forum I am on has a similar script but has a little trash can icon on the end of the subject line.

Thanks for this OP. Great work!
 
why'd you have to build sIgnoreThreadFunction like that?

I've only made a couple of minor chrome extensions for things at work, but I feel like there may be much more straightforward ways of doing things than that. If I have some time later this week maybe I'll take a whack at it.
 

JeTmAn81

Member
Got a mobile version working (swipe to hide). It's buggy and inefficient so I'll need to work on it a while more before posting.

good work, op!
a word filter to go along with your thread filter would improve this forum tenfold.

I'll look into this. It shouldn't be difficult.

why'd you have to build sIgnoreThreadFunction like that?

I've only made a couple of minor chrome extensions for things at work, but I feel like there may be much more straightforward ways of doing things than that. If I have some time later this week maybe I'll take a whack at it.

Well, as mentioned in OP I'm not great with Javascript. I've also never used Tampermonkey before this but the impression I get from it is that the code in the script only gets run when you initially load the page. For instance, there's a require statement which lets me import the jQuery library and use it inside the main script, but if I wanted to add statements to the page that would be able to use jQuery, I also had to add a jQuery script reference to the page or otherwise it wouldn't work. So I felt I had to add all the tools needed for continuous operations (hide thread, change show thread filter, etc.) to the page itself.

If there's a better way to do it I'd definitely be interested in learning about that.

Anyone else using Opera 12.17 (and/or ViolentMonkey) with a way to get this to work on it? >.>

I'll look into this. It's just pretty standard Javascript (and jQuery) so it should work on just about anything that lets your browser run the script.
 

terrisus

Member
I'll look into this. It's just pretty standard Javascript (and jQuery) so it should work on just about anything that lets your browser run the script.

That would be really, really, really awesome if you could get it to work with that.
I would be extremely thankful.
 

terrisus

Member
As an edit to my above post - I tried manually editing this into a ViolentMonkey script, and...
It worked!

Yay!
I'm happy =)
 
Also I need to learn Java because I can't understand the code very much at all.

The += are basically you just breaking it down into separate lines and then just combing them in the end right? Rather than typing out the entire function on one looooooooooong line.

edit: I'm also dumb. How do I get this working on Firefox with greasemonkey?

edit: Got it working.
 

terrisus

Member
For some reason this seems to be making all of the threads in my Subscribed Threads page disappear >.>

EDIT: I found the issue. Apparently if you have it set to "Show Ignored Only" when on one of the boards, it stays on that when on your Subscribed Threads, despite not having a choice for that option anywhere there. So, have to go onto one of the boards and switch that off again.
 

JeTmAn81

Member
For some reason this seems to be making all of the threads in my Subscribed Threads page disappear >.>

EDIT: I found the issue. Apparently if you have it set to "Show Ignored Only" when on one of the boards, it stays on that when on your Subscribed Threads, despite not having a choice for that option anywhere there. So, have to go onto one of the boards and switch that off again.

I think I can adjust it to only work on the 4 main forums.
 

terrisus

Member
Yeah, not like it really matters to me now that I figured out why it was doing that, but probably something good to straighten out anyway.

Man, this thing is making reading these boards so much easier...
 

JeTmAn81

Member
Change

Code:
// @include http://www.neogaf.com/forum/*

to

Code:
// @include http://www.neogaf.com/forum/forumdisplay.php?f=*

and it will only act on the main forums.
 

JeTmAn81

Member
Also I need to learn Java because I can't understand the code very much at all.

The += are basically you just breaking it down into separate lines and then just combing them in the end right? Rather than typing out the entire function on one looooooooooong line.

edit: I'm also dumb. How do I get this working on Firefox with greasemonkey?

edit: Got it working.

Well it's Javascript which is a way different thing from Java, but when I use the += operator I'm adding new information to a string. I'm building a bunch of Javascript functions in that string before finally adding it to the page with this line:

$("body").append(sIgnoreThreadFunction);

It is just for convenience. You're right that you could make it all one long string but it makes for easier reading this way. A lot of programming conventions are designed to keep code easily readable by humans.

Someone walk me through hiding this thread.

Download a tool that lets you integrate user scripts into your browser (e.g. Tampermonkey which works with Chrome, it's linked in the OP), create a new script with it and paste in the code from the OP. Open up the OT thread listing page, find this thread and click the hide link next to it. Done and dusted.
 

Foaloal

Member
Nobody has ever made an extension like this before?

Seems like people have been asking for this as long as I've been posting here.

I personally will hold off on using it until you or someone else is able to figure out how to pull threads from other pages, but either way I appreciate that somebody finally got started on a much needed feature.

I'm not experienced at javascript or programming in general, but just in pseudocode it seems like you could do something like:

Code:
While var nThreadCount < 40
Pull unhidden thread titles/links from [url]http://www.neogaf.com/forum/forumdisplay.php?f=3&order=desc&page=[/url]var nCurrentPage
var nCurrentPage = var nCurrentPage+ 1
Loop
Add pulled thread titles/links to list of wanted thread titles links

I'm guessing your extension works solely by hiding unwanted threads though, and so you'd probably need to write/rewrite some code so that you were actually manually displaying wanted threads rather than just hiding unwanted ones. The "pull unhidden links from subsequent pages" thing also might be difficult/impossible if javascript can't pull information from pages that are not currently loaded.

Hopefully it's not too difficult, though I could imagine that if you don't already know how you would write a "display wanted threads" function or a "pull threads from pages that aren't loaded" function it will be pretty tough.

Either way, thought I'd give the thread a bump so that more people would see it and maybe somebody who knows how to help might give some advice or take your work as a template to add some features to.
 

ItIsOkBro

Member
Got a mobile version working (swipe to hide). It's buggy and inefficient so I'll need to work on it a while more before posting.



I'll look into this. It shouldn't be difficult.





Well, as mentioned in OP I'm not great with Javascript. I've also never used Tampermonkey before this but the impression I get from it is that the code in the script only gets run when you initially load the page. For instance, there's a require statement which lets me import the jQuery library and use it inside the main script, but if I wanted to add statements to the page that would be able to use jQuery, I also had to add a jQuery script reference to the page or otherwise it wouldn't work. So I felt I had to add all the tools needed for continuous operations (hide thread, change show thread filter, etc.) to the page itself.

If there's a better way to do it I'd definitely be interested in learning about that.



I'll look into this. It's just pretty standard Javascript (and jQuery) so it should work on just about anything that lets your browser run the script.

here's a quick example of adding a link that runs a regularly defined function 'ignore' every time the user clicks it

Code:
// ==UserScript==
// @name Hide Forum Threads2
// @namespace ThreadFilter
// @description Hides threads in Vbulletin boards.
// @require http://code.jquery.com/jquery-latest.min.js
// @include http://www.neogaf.com/forum/forumdisplay.php?f=*
// ==/UserScript==

$('.threadbit.alt1 div').each(function(index, value) { 
  $('<a></a>', {
  text: 'Hide',
  click: ignore
}).appendTo(value);
});

function ignore() {
  alert(this.parentNode.parentNode.id.replace('td_threadtitle_',''));
}

it alerts the thread id at the moment

6IaRPu7.jpg
 

terrisus

Member
Agreed, off to the far side would be a much more convenient location for the Hide text, since right now it's too easy to accidentally click.
 

dofry

That's "Dr." dofry to you.
Does this work somehow on Firefox? EDIT: Used GreaseMonkey to copy/paste the code there. Seems to work just fine.
How to check which threads are hidden if one accidentally hides a thread?
 

JeTmAn81

Member
here's a quick example of adding a link that runs a regularly defined function 'ignore' every time the user clicks it

Code:
// ==UserScript==
// @name Hide Forum Threads2
// @namespace ThreadFilter
// @description Hides threads in Vbulletin boards.
// @require http://code.jquery.com/jquery-latest.min.js
// @include http://www.neogaf.com/forum/forumdisplay.php?f=*
// ==/UserScript==

$('.threadbit.alt1 div').each(function(index, value) { 
  $('<a></a>', {
  text: 'Hide',
  click: ignore
}).appendTo(value);
});

function ignore() {
  alert(this.parentNode.parentNode.id.replace('td_threadtitle_',''));
}

it alerts the thread id at the moment

6IaRPu7.jpg

Thanks buddy! I've got it referencing the event handlers that way now. Much cleaner. Got that word filter about working so I'll update everything later. I'll try moving the hide/show link to the end of the thread title as requested.

How to check which threads are hidden if one accidentally hides a thread?

The filter list next to the Post Reply button lets you view only hidden threads or all threads together.
 

dofry

That's "Dr." dofry to you.
Have to say that this is the best xmas present this year. So much faster to check stuff that interest me and reaaaally convenient to hide the depressing threads (I'm looking at you "crackaddict mom flushed newborn baby in the toilet after eating the brain with a nice chianti" -threads )

Thank you so much for this!
 

terrisus

Member
Seriously, I'm just happy to be rid of these 100+ or 1000+ post threads which are basically community threads but for some reason continue to clutter up the main sections of both Gaming and OT.
 

Coreda

Member
Thought I'd share an alternate concept for the placement of the hide links I played around with while logged out.

democapturepzr17.gif


See the Stylish userstyle here. it's not linked to the Javascript so it's only for display tests, but it could be nice.
 

JeTmAn81

Member
Thought I'd share an alternate concept for the placement of the hide links I played around with while logged out.

democapturepzr17.gif


See the Stylish userstyle here. it's not linked to the Javascript so it's only for display tests, but it could be nice.

Thanks for the suggestion. I've decided to keep the hide/show link where it is for now so it's close to where the user is typically clicking (thread title) and is consistently in the same place on the page.

In addition, I've updated the script in the OP to include a word filter. It will appear as a button next to the ignore filter list. You can add plain text words (with the option to include * wildcards) or regular expressions and it should filter as soon as you close the Word Filter box. The box is still a bit wonky and the color scheme is not consistent with the chosen GAF theme, but it's functional.

Let me know what you think!
 

Coreda

Member
Thanks for the suggestion. I've decided to keep the hide/show link where it is for now so it's close to where the user is typically clicking (thread title) and is consistently in the same place on the page.

In addition, I've updated the script in the OP to include a word filter. It will appear as a button next to the ignore filter list. You can add plain text words (with the option to include * wildcards) or regular expressions and it should filter as soon as you close the Word Filter box. The box is still a bit wonky and the color scheme is not consistent with the chosen GAF theme, but it's functional.

Let me know what you think!

Awesome, the word filter is great. I've noticed displaying hidden threads is per-page, but I guess that's the easiest method. The UI is a bit crowded for my taste, but the functionality is great. If I knew JS I'd probably fork a version myself :)

You might like to check out OpenUserJS.org, which is one of the better userscript hosts since userscripts.org left us, could be easier to add the script for some with an Install button.
 

Coreda

Member
so this doesn't work with firefox? i want to ignore all threads made by that droid guy.

It does, just copy and paste the userscript in the OP to a new Greasemonkey script. Give it a name first then paste it over the template that pops up and save.
 
Top Bottom