O'Reilly logo

Greasemonkey Hacks by Mark Pilgrim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #91. Warn Before Buying an Album

Find out whether an album is produced by a record label that supports the RIAA.

There are people in the world who dislike the Recording Industry Association of America (RIAA) because of their simultaneous disregard for both artists' rights (cheating artists with lopsided contracts) and customers' rights (suing fans and treating them like thieves). I am not one of those people, but I still like this hack, because it demonstrates Greasemonkey's role in enabling what I call passive activism.

My theory is that there is a small group of activists who will go out of their way to boycott the RIAA. But there is a much larger group of people who would like to boycott, but they don't actually get around to doing the necessary research when they're about to buy something. This hack helps that larger group, by adding an icon next to an album title on Amazon.com that shows whether this album is produced by a record label that supports the RIAA. It doesn't prevent you from buying the album; it just reminds you that you once cared enough to install a script that would remind you to think about this issue before buying.

The Code

This user script runs on all Amazon.com pages. It parses the URL to get the ASIN—a globally unique identifier that identifies the album you're browsing—and then uses the GM_xmlhttpRequest function to check the Magnetbox (http://www.magnetbox.com) database to determine whether this album is produced by a company that supports the RIAA. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required