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.
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:
And it returns an array of the matching nodes.