The Mootools Download Builder Bookmarklet
Tagged bookmarklet, Javascript, Mootools
Personally, I love Mootools download builder. There’s just one feature that is missing, it becomes very annoying everytime I needs the entire Mootools library. I can remember the old (?) download builder had a “check all” button, which included (checks) all Mootools components to the file I was about to download. Nowadays, the download builder doesn’t have this feature anymore. Well, actually the download builder has the functionality to check all components, but it lacks a button. I wrote a bookmarklet that let’s you do the trick.

The Mootools Download Builder
Bookmarklets
Wikipedia has the following to say about bookmarklets:
A bookmarklet is an applet, a small computer application, stored as the URL of a bookmark in a web browser or as a hyperlink on a web page.
So it’s a small piece of javascript, that can be saved as a bookmark, and executed when the bookmark is pressed.
For the Mootools Download Builder I wrote a bookmarklet that toggles all checkboxes. It looks like this:
// Name of the Download Builder function to execute ('none' or 'all').
var function_name;
// Boolean: true when all checkboxes are checked, false otherwise.
var checked_all = Download.chks.every(function(chk){
return chk.hasClass('selected')
});
// Determine which function to execute.
if(checked_all){
// All checkboxes are checked, so execute Download.none().
function_name = 'none';
}else{
// No checkboxes are checked, so execute Download.all().
function_name = 'all';
}
// Toggle all checkboxes.
Download[function_name]();
Because bookmarklets can have to be on a single line, I wrote a compact version of the code above:
// Compact version of the bookmarklet.
Download[Download.chks.every(function(chk){return chk.hasClass('selected')})?'none':'all']();
The HTML for the bookmarklet looks like this:
// HTML for the bookmarklet
<a href="javascript:Download[Download.chks.every(function(chk){return chk.hasClass('selected')})?'none':'all']();">Toggle Mootools Components</a>
To test it, bookmark the following link: Toggle Mootools Components. Then go to the Mootools Download Builder, and press the bookmarklet. You can see all components are toggled.
Mootools Download Builders
No, it’s not a typo, there are several download builder around. They’re all different.
- http://mootools.net/download/: Build Mootools using the latest stable components.
- http://mootools.net/download/tags/1-2b1: Build Mootools using the 1.2 beta1 components.
- http://mootools.net/download/trunk: Build Mootools using the latest svn revision.
[…] Possibly related The Mootools Download Builder Bookmarklet → read this1 month ago […]