Mr Speaker

Greasemonkey and WordPress

the grease monkeyGreasemonkey is enabled! Or so it says when I mouse-over the little monkey face that sits at the bottom of my browser. Greasemonkey is an extension to Mozilla Firefox that lets you apply your skillz to munging up web pages in ways that will make graphic designers cry and cause web-enabled, P2P, e-commerce, tech oriented, um, solution providing, pro-active businesses to issue cease-and-desist orders.

It will mostly be used for good however, and here, by way of demonstration, I'll do something nice and add some functionality to the WordPress blogging software.

Greasemonkey allows you to apply javascript code to a given web page every time you visit. Everything that occurs "client-side" you can now modify on-the-fly allowing a whole gamut of neat-o tricks. Some are pretty impressive - for example, a script for amazon.com allows you to mouseover the Amazon price for an item, and a price and link to the same item from Amazon's competitors will be displayed.

Another one allows you to resize any textboxes you have to type in. That's excellent - especially as web designers seem very precious about wasting space on "user input".

The one I'll show ya today adds a kind of preview functionality to the WordPress blogging software. In WordPress you can create draft posts that you can work on, until they are as good as the one you're reading now. Then you hit "publish" and the accolades pour in. I've got heaps of disorganised drafts. Heaps. It's really annoying to have to click on each one, and wait for it to load, just to see what I have or haven't written.

Sooo, I decided to make a Greasemonkey script that will help me out. When I run my mouse over the list of links for a lil' bit, a box pops up and displays what's contained within. Saves me precious seconds. Of course, it took me more than seconds to write the script, but we wont count those.

There you go. No more having to use what you're stuck with. Greasemonkey has some pretty sizeable implications for the internet, and web development. The developer and designer now have almost no say in what happens to their data once it goes client-side. Though, good developers have known this to be true since the beginning of time - so if your site gets overrun by greasemonkeys, you've got no one to blame but yourself...

Here's greasemonkey, and here's the WordPress preview script.

3 Comments

  1. You know this is going to be *perfect* for me. Will give this a go when I get the chance (maybe when I complete World of Warcraft).

    Friday, May 27, 2005 at 3:34 pm | Permalink
  2. I tried this on my WP 1.5.3 site and although the preview opened, it never displayed anything other than “Loading …”

    Saturday, August 27, 2005 at 7:34 am | Permalink
  3. Hey Steve,

    Ill fix it asap – the problem is the new version of GreaseMonkey has changed how you use the GM_xmlHttpRequest. I’ll have to have a look at what they’ve done to it! They must be addressing security issues or something.

    UPDATE: Fixed that one. Should be good now. Strangely, it was not liking the URL I was passing it anymore – GreaseMonkey must have changed something a bit. I add to append an empty string to the URL to get it to work. Weird.

    Monday, August 29, 2005 at 8:47 am | Permalink
Captcha! Please type 'radical' here: *
How did you find this thingo? *