After a few months (sorry!) of downtime, my SFGate-NoComments Greasemonkey script is back up at Userscripts.
I realize the previous sentence makes very little sense to anyone but me, so I’ll expand it:
After a few months (sorry!) of downtime
You saw my to-do list(s), right?
The “comments” sections in SFGate (San Francisco Chronicle’s Web site) articles are disgusting, horrible, rude, homophobic (?!), racist and in every other way awful. I wanted a way to read stories on SFGate without even having to force myself not to look at the comments section.
Greasemonkey is a mechanism by which arbitrary code can be injected into Web pages during load or after they are completely loaded. It’s available for almost every modern browser*. Some common uses for Greasemonkey scripts are adjusting font sizes and colors on pages where the Web developer apparently worked on a 30″ inch screen and has 20/10 uncorrected vision and the color sense of a three year old, removing page elements and otherwise enhancing usability of Web pages.
Userscripts.org is an online repository of thousands of user-submitted Greasemonkey scripts. I placed my script there when I first wrote it early this year.
How does it work, you ask? Pretty simple in concept, a real hair-tearer in execution. Using Greasemonkey scripts’ ability to access the structural elements of a Web page, and knowing (from examining the page source code) how comments sections are named and placed, my code goes through the DOM looking for specific items. When it finds them, it makes them disappear. This was made more difficult by the fact that SFGate is now using a third-party comments solution which loads after most of the rest of the page has already finished loading, so I had to make my code wait until the page, including comments, had fully loaded before executing. The result is that the comments links and sections do show for a second before disappearing, but I find that acceptable considering the outcome.
This was an interesting challenge for me and as usual, it was impossible until it became easy. I would be willing to look at extending or duplicating it for other sites with similarly offensive comments sections. Let me know in the comments below if you’re interested. Yes, I realize the irony.
- Safari/Mac: Greasekit** or NinjaKit. I haven’t tried NinjaKit yet.
- Opera: Enable user scripts and point it to the directory where you’ve downloaded your scripts.
- Chrome: Native support, just click “Install” from Userscripts pages.
- IE: See links here. I haven’t tried any of these because I use IE only under extreme duress.
**Use this version of GreaseKit if you are on OS X Leopard. The current posted version was compiled for Snow Leopard.