Archive

Textile JavaScript class

Posted on Sun 6 Aug, 2006

This JavaScript class requires Prototype. It displays help on Textile next to elements with a particular class, and parses the help from a Hash that you can define in the constructor.

I’ve been using it to add help next to textareas that accept textile. All I have to do is create textareas with the class “show-textile-help”, and they get a little div full of useful information. The help text is hidden until the user clicks on the link:

AFTER A CLICK BY THE INTRIGUED USER:

Style it a little bit like this:

’ + element1 + ’’
})
textile_help += ’’
})
...

Continue reading → | Tagstextile, javascript, programming

Dismantling browser Ajax handling

Posted on Tue 1 Aug, 2006

I’ve been writing some fairly complex JavaScript for a small project designed by my fiancĂ© (she makes demands for features like autosave without realising the amazing trickery required), and I started thinking about threading.

When you use XMLHttpRequest to fetch or send data, you create methods or functions to act as callbacks. At some point the callbacks are run, and data magically appears into your classes. That feels a lot like threading to me, the fact it’s asynchronous. I remember reading Thomas Fuchs saying something about JavaScript being single-threaded, a quick search found …

Continue reading → | Tagsajax, javascript