Completion #3

I’ve been working on the JavaDoc API gadget over Christmas. I know, it’s as if I just don’t understand the concept of “holidays”. Anyway.

The UI now works perfectly in firefox and safari (at least as far as I can tell), in opera with just a single glitch and reasonably well in IE as long as you don’t resize the browser window. I have also fixed a few bugs, including some issues with inner classes, and implemented a feature several people have been asking for: pressing in the text field now takes you to the top item on the list.

A less visible improvement is that a lot less data now has to be transferred to the gadget when you start to write in the text field — the class index is down from 60K to 20K in browsers that support gzipped content (which these days turns out to be pretty much any of them).

The downside is that the code is now pretty atrocious. I quickly realized that having just one HTML document and one javascript file for all the different browsers was no good. Instead, I now generate different files for each of firefox, safari, opera and explorer. In fact the files are being generated using the most stone-age technique imaginable: cpp. Here’s an actual piece of code from the implementation:

function KeyEventMatches(e, r) {
#ifdef EXPLORER
var c = window.event.keyCode;
#else
var c = e.which;
#endif
return String.fromCharCode(c).match(r);
}

I know, absolutely terrible but it actually works pretty well and, most importantly, requires no resources at runtime.

Oh, and I’ve moved the gadget here:


Add to Google

The old location will disappear shortly.

I hope to clear up the last outstanding bugs, especially the thing with resizing in explorer, this week.

6 Responses to Completion #3

Leave a Reply

Your email address will not be published. Required fields are marked *


*