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 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, an archive of GreaseMonkey scripts. Here is what it looks like:

Before GreaseMonkey script

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!


  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:

  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?


  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

  11. Pissed off says:

    So your one of the ***** pissing everyone off by flagging every ad? Get off your high horse and go use your talent for something useful instead of removing classified ads. ******.

  12. Ryan Stille says:

    P.O. – why would you assume that? I use this for flagging Nigerian scammers and the like.

    And I’ve cleaned up your comment, I don’t appreciate that language on my site.

  13. Bob G says:

    I’m glad that Ryan Sille “cleaned up” the Comment for the knuckle-dragger who thinks it Okay to say anything you like. this is a privately run web-site, so you need to learn how to act like an adult and express yourself with more restraint and respect for the man / women / person who extends themselves for your benifit and edification.

    Really, how sophmoric.

  14. Ray says:

    Ryan, I have Firefox with greasemonkey installed, running your script on Craigslist all ads are in “blue” lettering and so it the word spam. when I click on the word spam it turns into a “red” checkmark, because i am new at this I was just curious is this thing working correctly? if so this seems like a really great and much needed program for all users.

  15. Joe C says:

    I must agree slightly with P.O. – Really, I post my products and opportunities that I am marketing on CL and find that almost EVERYTHING I post gets flagged by someone who decides they are “proprietors of relevancy on the internet.” So, Am I hurting someone by posting my Ads? No, yet they always get removed. These a RELEVANT ADS – What defines spam on CL? Isn’t it all non-opt-in solicitation? Isn’t that what it’s for? If you don’t like the ad , just move on. People are trying to make a living. Flaggers (I prefer LAMERS) just make this not a good place to market anything. I wouldn’t market a Garage Sale on CL anymore, let alone an actual product, who cares? Someone will just flag it.

  16. Bob says:

    Perhaps there IS a reason you’re getting flagged. This is the wrong place to whine about it. If you want to change this, write to the people who run Craigs List.

    There are idiots that run over innocent people every day with automobiles. Does this make detroit responsible as they made the cars?

    Blame the people who do the wrong, not others. Grow up and act like an adult. Stop baggering the programmer and go after the source of your problems.

  17. Ryan Stille says:

    Joe, I can see how that would be frustrating. Maybe your craigslist community is different than mine. I have been buying and selling many things on craigslist for a few years now, and have never had an ad flagged.

    While this really isn’t a place to debate flagging or not (CL is in charge of that, not me), I do want say that I think those who think flagging is a bad idea are missing the big picture. If there were not people flagging ads on craigslist, it would quickly become a worthless wasteland visited by no one. I believe it would become 90% spam in a short time.

  18. Joe C says:

    I don’t think flagging is a BAD idea. It’s a great one. But there should be something as far as reasoning behind it, don’t you think? Being able to flag and remove someones post, no questions asked seems to be a little bit one sided doesn’t it? Bob, all you do is tell everyone to “grow up,” yet you have undoubtedly bashed anyone with an opinion that opposed your own. Who needs to quit whining now ? I am in now way trying to bagger the programmer, and I applaud his effort. As a free lance programmer myself I recognize the need for automation. But, how would you feel if you had this script posted, and someone didn’t like it – so they had it removed at the click of a button. Gee, that’s pretty sorry huh ? What if your competition wanted to get you out of the way, so they just cry SPAM and away he goes. So, to conclude – I’m not whining OR baggering. Yes, I have tried to contact CL about the flagging regulations, with absolutely no response. So, maybe I’m just trying to put the word out there. Don’t ask for input and complain when you get it.

  19. Ryan Stille says:

    Joe, it often takes more than just one click to remove someone’s post. The algorithm that craigslist uses has never been published, but it has something to do with the popularity of an ad. Usually several people have to flag an ad before it gets taken down.

  20. Bob says:

    Joe. I didn’t write here complaining, you did. That’s the truth. I didn’t whine my posts where flagged you did, truth. Calling me a whinner when it’s your issue is purely childish. What’s next, nasty comments?

    You posted and communitcated in an inmature context and when called on it, you try to deflect it to me. Sorry, you can’t change what you post.

    The gent who hosts this web site is to be thanked, not spanked. If you don’t like Craigs list, just don’t use it. Who really cares if you like if or not? Certainly not me, and certainly not the individuals who are flagging your ads.

    Really, try to act more like an adult and stop pointing your finger at others for your own shortcomings.

  21. Mark says:

    It looks like CraigsList has changed it’s flag string. Your code says:

    But now CraigsList expects:
    where the correct URL is now of the form:
    http://***name of city****

  22. Mr D says:

    Ryan, I gotta ask you: is this thing working, or not? Because CL NYC is overwhelmed with Chinese spam — like a thousand at a time — and I’ve been using your script like crazy. Am I wasting my time?

    Thanks for your efforts.

  23. Ryan Stille says:

    Mr D, the script is not working after craigslist’s latest change. I am working on a fix.

  24. Andrew says:

    Craigslist recently stated that nearly 75% of the Ads posted are removed only by Flagged. 🙁

  25. Phil says:

    This isn’t a script but it makes the process of flagging multiple spam or prohibited ads easier by using a typical CL search query. IMO a needed tool to fend of the tide of spam/scams flowing in from China. One should also send an email to to report the offenders.

  26. Steve says:


    I saw a version 1.2 posted, but it was not working correctly and it’s difficult to tell if v1.1 works because it’s using the incorrect URL for flagging.

    I’ve fixed it properly so that it gets the city and constructs the correct URL for flagging.

    Let me know if you’d like a copy to post.


  27. Chris says:

    I have to agree with P.O. and JoeC….
    The whiners like Phil, Bob, and Ryan that feel the need to ‘police’ ads are losers with nothing else to do but hide behind their computers. Would you come up to me at my house if I had a marketing sign on my front lawn that you didn’t agree with, and try to take it down??? No, you sure wouldn’t – why?? because you’re all sissies that avoid confrontation by hiding at home trying to play internet police.

    And before one of you beaks off about ‘posting on a private site’ etc – this isn’t a PRIVATE site. It seems like pretty PUBLIC site that you can get to through a google search/link. If you want to make it private, have a LOGIN requirement

  28. Bob says:

    Well. Aren’t you special.

    I don’t whine. And for your information. I don’t avoid confrontation when it’s called for. I notice that you’re doing the very thing that you call others out on. Sitting behind your computer and talking trash with no way to back it up. You’re so busy finding fault with others you can’t see a tree through the forest. Sounds to me like you’re doing the whining little boy.

  29. Bob G says:

    Oh, one thing I forgot. Learn to read. I didn’t say it was a private site, I said it was a privately run site. learn the difference. It’s open to public, but the Sysop is running it privately. Got that?

    I doubt it,but anything is worth one good try.

  30. Ryan Stille says:

    Chris, every website that allows user generated content has some type of moderation system. Sometimes thats paid staff that looks through the content, but often the end users themselves do the moderation. Almost every single forum, review site, and classified site I visit has some type of ‘report this’ or ‘mark as inappropriate’ button. What craigslist is doing is not new. And it works, and most people find it works well. Without moderation craigslist would be useless, with most of the postings being spam.

    Also I don’t think you quite understand the concept of public and private. Having a sign on your lawn is nothing like having a posting on craigslist.

    Now I’m going to disable comments on this post because they are starting to get out of hand.

    By the way there should be a new version out of the script in a few days. 🙂

  31. Ryan Stille says:

    FYI, I’ve released a new version of the script: