Saturday, October 2, 2010

GreaseMonkey, Part 1 - 4chan



If you are a regular at 4chan, then you know that /b/ has those annoying XXX covering the post numbers, it may now be a big deal, but it gets me everytime. so if you hate those masked post ids, keep reading.

Needed before:
a) if you are using Chrome, you do not need anything.
b) if you use firefox, you need to install Greasemonkey addon beforehand.
c) if you use internet explorer, shame on you =(


I made a small jQuery/Greasemonkey script to unmask topic and post id. Explained below

jQuery("a[class=quotejs]").each(function() {
    if(jQuery(this).html() == "No.") {
        jQuery(this).next().html(jQuery(this).attr("href").split('#')[1]);
    }
});
Basically, it will look for all the instances where the numbers are masked, then, it will look on the actual link, which does contain the complete number, and replace the masked number with the complete one. it is a little crude, but it gets the job done.
If you do read the code, you may notice it also contains a function called addJQuery(), what this function does is adding the jquery library to the script, this used to be just imported on the header of the script, but since chrome does not support most of greasemonkey headers, it has to be added this way.

Everything needed, is to download Greasemonkey addon for Firefox before pressing the install button., Chrome does NOT need any addon to use this script, simply pressing this install button will do. Thanks for reading!!



4 comments: