schnitz81/rt-magnet — pull request #6 by atquick (2012-07-02 22:21:19+00:00)
Title: Cleaner usage of Javascript (large)

Also so: Cleaner usage of Javascript (small)

This is an implementation of javascript that doesn't take it's existence for granted. Rather than assuming we have javascript running, and start removing access to parts of our page, the javascript based features will only come in play if javascript is running.

The show/hide button is only shown as the browser starts processing the script tag (and thus running the interpreter, if it has one), and it will only hide the directory listing if it successfully runs the interpreter, successfully binds the toggle event, and if the toggle event fires correctly. This makes it self correcting, so if there are some issue with the javascript, it won't completely remove the access to the list.

This is a larger implementation of another pull request, and has a number of fixes to make sure that it works on multiple platforms. It contains way Internet Explorer does things (which I haven't actually tried), how most other browsers do things, and inlining the events for those that does neither (even if we can't be sure that they will fire).

This is the "correct" implementation, while the small one is for simplicity (and it should work on most browsers).