Showing posts with label mootools. Show all posts
Showing posts with label mootools. Show all posts

Dynamically loading Javascript files

The little snippet below lets you load JS files dynamically, making it easier to load jQuery or mootools for scripts like GreaseMonkey or within Firebug.

var jsfile = document.createElement("script");
jsfile.setAttribute("type", "text/javascript");
jsfile.setAttribute("src", "
http://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools.js");
document.getElementsByTagName("head")[0].appendChild(jsfile);

Using Firebug, I used the following mootools code to hide some elements as a test to see if the script actually loaded.

$each($$('.saveType, .perType'), function(item) {
  item.setStyle('display', 'none');
});

Offline documentation for Mootools

There are alot of times when I need documentation while working on something but don't have internet connectivity, such as when I'm on a train.

Previously, I have been using a CHM file for MooTools v1.11 and it was great! I also found docs for v1.2.0 and settled with that, which was quite sufficient for what I was doing.

Scouring the net over and over for months yeilded little results when trying to find docs for the latest MooTools v1.2.1.

But alas, I needed to stop relying on others so much. I needed to know how to generate my own!

Thanks to some help from Aaron Newton from ClientCide, I've managed to get started on the documentation generation.

Once the code was cleaned up, I quickly got the documentation to output files rather than to a browser.

It was tricky trying to get the files to point to each other, rather than use the markdown style defined for the server such as "/Native/Hash".

After a day of tinkering with the output, I've managed to generate the MooTools v1.2.1 documentation for offline use!

I've posted the files up on SourceForge (set up by Tux).
- documentation for v1.2.1. (07/03/2009)
- documentation for v1.2.3. (05/07/2009)
- documentation for v1.2.4. (27/12/2009)
- documentation generator (last updated 27/12/2009)

Hopefully this technique will also work for future MooTools releases.

The SourceForge project page is at http://sourceforge.net/projects/mootoolsdocgen
 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog