I'm Aza Raskin @azaaza. I make shiny things. I simplify.

I'm the Creative Lead for Firefox.

 

Rapid Prototyping with Greasemonkey

Sponsored by

I recently was admiring the slick keyboard interface for Dropular, a sort of communal blog for sharing interesting finds on the net. It has that Swiss-minimalism-meets-interaction-design feel, which is enhanced by a modernist legend explaining how to operate the thing (although I wish the legend faded away after I got the hang of it). The interaction is simple: you use the arrow keys to automatically animate to the next/previous item.

I passed the link around, and my friends over at Weardrobe.com thought the interaction would make a good match for their homepage. They wanted to try it out, and since they haven’t seen the light of jQuery yet, I thought it would be fun to rapidly prototype it for them. For the unexpected fun the interaction yields, it doesn’t take much code to make it happen.

I was tempted to break out the pageLoad ability of Ubiquity, but decided instead to do a the project using Greasemonkey as a comparative experience. Half an hour later, the prototype was working and ready for them to play with. To try it out:

(1) Install Greasemonkey (you’ll need to be using Firefox).
(2) Install this Greasmonkey script.

(3) Head over to Weardrobe and use the up/down keys. Try using down-arrow at the very bottom of the page.

It turns out that while Greasemonkey was fairly painless, I wasn’t able to find an easy way to work with jQuery. I’d have gotten that for free with Ubiquity. The end-user installation process is also a bit more humane with Ubiquity.

I don’t know if Weardrobe will add the keyboard navigation aid to their site, but if they decide to, the hard work has already been done — it would be a matter of minutes to integrate the code.

In general, using the browser’s run-time as a prototyping environment enables ridiculously fast rapid prototyping. There are no deployment steps to worry about, changes are reflected instantly, and all changes are dog-foodable from the get-go. Prototyping is also entirely decoupled and parallelizable: that’s especially powerful when you don’t have access to the site for which you are making a live-patch, the backend code is obtuse, or when you multiple have competing ideas for changes you’d like to make. We actually use the same technique for prototyping new behaviors for the the Ubiquity code repository.

The next time you want to try out a new design or feature, break open Greasemonkey or Ubiquity to get a hands-on feel. You’ll be glad that you did. I know that we’ll be using the technique more here at Mozilla Labs.

RT @azaaza Rapid Prototyping with Greasemonkey | Follow @azaaza on Twitter | All blog posts

View all 10 comments


Great use of greasemonkey — I love the Dropular nav.

With Artzilla we’ve mucked a bit with using jQuery in userscripts and threw up some notes here:
http://wiki.artzilla.org/using_jquery_with_greasemonkey

Not perfect — load order presents issues with noconflict()


Actually, I prefer Ffffound’s navigation to Dropular’s. The lack of animation gives it a much snappier feel. Perfect for flipping through the pictures. Also, it respects the current scroll position and jumps to the next picture from there (unlike Dropular, where if you jump, scroll and jump again, it jumps back).


I also like that Ffffound loads the next page of pictures, once you’re at the bottom and want to go further down. Dropular just displays “End” and requires you to go to the next page manually.

I think none of the Ffffound clones actually comes close to it’s superb navigation interaction, reduction to essential features, and good recommendations of related pictures. Unfortunately I don’t have an account there. But this is getting slightly off topic :)


Loading a JavaScript library with Greasemonkey is fairly easy since version 0.8. The best way to include jQuery in a user-script is to use the @require metadata (http://wiki.greasespot.net/Metadata_block#.40require). Further explanations are provided on the wiki: http://wiki.greasespot.net/Code_snippets#jQuery_in_Greasemonkey_scripts_using_the_metadata_key_.40require
I sent a mail to tell Karl Swedberg to update the tutorial on learningjquery.com but seems like he didn’t find the time to do it unfortunately.


In Greasemonkey 0.8, the @require field was introduced. So you can do something like this in the header:

// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js

And the $ object will just be there.



kraki5525

If you are using a newer version of greasemonkey (0.8.0+), you can use the @require key to include third party javascript files, see the wiki for more info ( http://wiki.greasespot.net/Metadata_block#.40require ). I use it all the time to include the jQuery files hosted on Google when I’m writing userscripts.

This is an type of use of jQuery doesn’t get a lot of attention. Which is a shame, because its amazing the stuff you can do with the power of jQuery.


Excellent thoughts. We’ve used this exact technique with clients – to great success.


In talking to Mark Pilgrim at Etech in ‘03, I told him of using GM to do feature mockups at MSN Search. He said that he’d had several folks from large corporations tell him they did this.

I just did some hackery on feeds.mozilla.com with GM: http://surfmind.com/muzings/?p=267


Nature has this one figured out. Imagine if sex started with the orgasm. Oh, wait, that does happen to some guys.


I also like that Ffffound loads the next page of pictures, once you’re at the bottom and want to go further down. Dropular just displays “End” and requires you to go to the next page manually.


Leave a Comment