Posts tagged: JAVASCRIPT

Sort tables with sorttable.js

I’ve been enjoying listening to the “Audible Ajax” podcasts from Ajaxian lately. One of the older shows was a talk by Lugradio’s Stuart Langridge in which, in an aside, he mentioned a table sorting widget he had written. It sounded cool. When I got home I fired up the browser and found it: sorttable.js.

Even though it’s over two years old and doubtless there are a bazillion Ajax (tm) toolkits that include supersets of this functionality, I find it to be a very elegant thing. Largely that’s because of its utterly configuration-free operation. As long has you’ve put <th> headers on your table, you just include the script in your page, and set class="sortable" and a unique id on each of your table(s); clicking on a table header re-sorts the table by that column, without any action on the server side at all.

TrimPath Junction: a pure Javascript clone of Rails

I won’t ask “why?” because I think it’s kind of neat – TrimPath Junction is an unabashed Javascript clone of Ruby on Rails that was released earlier this year. Requires a Javascript interpreter on your server of course. (For bonus points run it on a Javascript web server too.)

I have to admit that until looking at the Junction example code I had never realized that though Javascript has objects, it has no classes. That sent me off reading more about prototype-oriented languages (that Lua just keeps popping up).

The MySpace worm

Via Rafe I learned of an astounding Javascript hack done by a MySpace user. Excerpts from the summary, allegedly written by the creator:

…anyone who viewed my profile who wasn’t already on my friends list would inadvertently add me as a friend. Without their permission.

8:35 am: You have 74 friends and 221 friend requests. Woah. I did not expect this much. I’m surprised it even worked. 200 people have been infected in 8 hours. That means I’ll have 600 new friends added every day. Woah.

Tiddlywiki

TiddlyWiki is one of the most impressive Javascript apps I’ve ever seen. It’s a pure client-side wiki. You can edit navigation, do live searching, and save to disk. There are some rough edges, mostly due to the awkwardness of using a browser as a document editor. But wow.