My GreaseMonkey Script: craigslist spam buttons

Last weekend I wrote my first GreaseMonkey script. If you are unfamiliar with GreaseMonkey, its a FireFox extension that lets you run specific JavaScripts on specifc webpages. This is incredibly cool, you can basically bend websites to whatever you want. Everything from changing the look and feel to adding new functionality. GreaseMonkey puts you back in control of your browsing experience. A neat example is the GM script that, when you are browsing Amazon, will put a link to the book at your local library and indicate if its available there.

The GreaseMonkey script I wrote works with Craigslist.org. Craigslist is a popular free classifieds site. Craigslist’s posts are not moderated, so anyone can post an ad. That includes spammers. Craigslist spam is mostly controlled by craigslist users themselves. See an ad thats spam? Click the spam button. If enough people mark it as such, it automatically gets taken down. I really like CL, so I do my part by flagging any spam I see. To do this you must click on the item title from the list, then click the spam button on the detailed listing. But I can often identify spam just from the title. Posts like “FREE 4gb ipod nano!!” and “Take Your New Pair of Uggs!” are obvious spam.

So my script adds the flag-as-spam buttons to the listing page, so you don’t have to click onto the detail page of each item to flag it.

You can get my script from userscripts.org, an archive of GreaseMonkey scripts. Here is what it looks like:

Before:
Before GreaseMonkey script

After:
After GreaseMonkey script

And the great news that I discovered while writing this is that a lot of GreaseMonkey scripts run in Opera, my favorite web browser. So I made sure to write this one in a way that worked in Opera. To use this in Opera, go to the Tools menu, then Preferences -> Advanced -> Content -> JavaScript options, and choose a directory for the “User Javascript files” field. Then drop my script in that directory. Thats it!

10 Responses to “My GreaseMonkey Script: craigslist spam buttons”

  1. Greg Says:

    Awesome job man!… now If someone would create a widget for Opera I would be so happy

  2. Ryan Stille Says:

    Greg, the script does work in Opera. Or were you referring to something else? Like a full fledged GreaseMonkey plugin for Opera?

  3. Greg Says:

    It works in Opera - Now I’m Happy :) Great idea man!
    Thank You!

  4. Manny Says:

    I’m stuck at directory. I clicked on Javascript options and a window opened. Where it says user javascript files I chose C:programs\Opera I then went to the Opera folder and pasted the 7399 file in the opera folder. I tried different folders too but none seemed to work.

  5. Ryan Stille Says:

    Manny, I think the filename may have to be in a special format. It sounds like you are leaving the file named ‘7399′. Try naming it something like ‘craigslist-spam-btns.user.js’. I think the key is the name must end with .js, or perhaps .user.js.

  6. Ryan Stille Says:

    FYI, I’ve updated the script. See this post:
    http://www.stillnetstudios.com/2007/11/08/greasemonkey-craigslist-spam/

  7. Greg Says:

    Thanks for the update Ryan. I am on CL often, and this is very handy

    Clicking “Install Script” only open a page where the code is displayed. I had to right click and select “Save Target As”

    No big deal, but others may not know.

  8. Bob G Says:

    I have d-loaded the script and installed firefox AND Greesemonkey, but after including the script into greesmonkey, it just doesn’t seem to work.

    The name space when adding a script is the web page that the script is to be run against, right?

    Well, it won’t run at all. What am I doing wrong?

    Thanks!

  9. Paul Says:

    Dude, this script rock!!! I post it all of the CL Feedback forums and people always thank me for it.

    However, in today’s CL spam madness the script needs to be further automated.

    We truly need the ‘SpamBomb’ button to mark all of the posts on a page as spam. Right now, so many categories are entirely spam it’s just not even funny. The w4m postings in the SF Bay Area are completely filled up with spam to the point where it is tiresome to spend hours clicking spam next to each posting. I’m not kidding, HOURS. There are over 1300 w4m ads with pics and I think maybe there used to be max 150.

  10. Newfoundland Geek Says:

    Thats gr8. But craigslist is blocking some posting by detecting the IP address

Leave a Reply