SOS

Shane O'Sullivan's technical blog… really ties the room together

EasyCheckboxes: dojo.query and Greasemonkey

Posted by Shane O'Sullivan on May 2, 2009

I’ve written a useful script for Firefox and Greasemonkey called EasyCheckboxes.  It makes it more convenient to work with multiple checkboxes on a page, enabling you to select, deselect or toggle groups of checkboxes. It will also work with all web pages.

See the video below for more info, or you can install it right now by clicking here, or by visiting the script homepage at http://chofter.com/apps/?n=easycheckboxes

Context Aware Selections

One of the most useful features of EasyCheckboxes is that it is context aware.  It figures out what checkboxes are related to the one you chose, and only changes the state of those. This is useful if you have multiple columns of checkboxes, and you only want to check all inputs in one column.

Of course you can also change the values of all checkboxes on the page.

Using Dojo’s query engine, Acme, in Greasemonkey

If you’re not interested in the techie details, you can stop reading now.

Since version 1.3 of the Dojo Ajax Toolkit, it provides a standalone DOM query engine called Acme.  I compressed this down to a single line of code, and inserted it in my GreaseMonkey script.   I previously tried using the Sizzle query engine, but it had too many issues with Greasemonkey, the main being that it sometimes crashed the browser.

Using it is very simple.  Simply call:

acme.query(“.someClass”, unsafeWindow.document);

And it returns an array of the matching nodes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: