A little bit of AJAX (scrub scrub scrub)
Photo widget ajaxified
First of all the photo widget is dynammically written by a javascript ajax callback, based on a list of 23hq photo ids that come from a script on my server (which in turn caches a list of ids that it gets via the 23hq REST api).
The main driver for doing this is that the photo widget was adding a significant delay to page rendering - especially if you were the first visitor to arrive after the cache timed out at the server end. Now if you are that lucky person, you will see a spinning wheel in place of the photos until the data is ready (and even that is quicker as well). The widget is built dynamically from 3 randomly chosen photos out of the full list of ids so that you will get a fresh set on reload even if you're sitting behind a hugely aggressive proxy named Roger.
Google ad box optimised
The other slight change to the front page is that the rendering of the Google ads is left to the bottom of the page, again to stop any delay in rendering the main content. Once the ads have downloaded and rendered (into a div with display:none) the rendered html content is copied up into the usual place.
Comments form buffed
I have also played with making the comment submission ajax-based like in typo. Yes I know I've made disparaging comments about the typo ajax comments interface. I still think it's totally unnecessary. This was really just a simple exercise for me rather than something I think is actually beneficial. You'll only see the new interface when you use the add comments link at the bottom of a blog entry which already has at least one comment. The normal add comment links are untouched.
Results?
Ajax type jazz is remarkably easy with fantastic libraries like prototype. The prototype library not only makes the asynchronous fetching and form processing easy, it has a whole load of really useful javascript helper classes. I want to play with script.aculo.us next, so don't be surprised to see some reflections under the photo widget next time you visit.
09:20 PM, 08 May 2006 by Mark Aufflick Permalink | Short Link







