miércoles, 15 de agosto de 2007

AJAX Labels: Updated

Posted by Deepak on Sunday, December 17, 2006 at 3:11 PM
Sorted into: AJAX , Beta Hacks , Blogger
This version is outdated. A newer (and better) version is present here.



What if you can view the posts having a particular label without leaving the current page? What if you can do your bit of reading and other stuff and keep clicking away without wasting your time while the labels are loaded in the background and displayed when they are ready? (Okay, enough of that. I see some people rolling their eyes now. )

AJAX labels does just the same... It opens a block of text just above all the posts, showing snippets of posts having the label you selected. Click on any of the categories on the right sidebar to see the hack in action.

INTRODUCTION
I had this hack in my personal blog about a month back. It had some really rigorous logic to parse the RSS feed, and hence was not very fast. Now that Google has implemented JSON feeds in their GData structure, my job becomes easier. I also decided to open this hack for the public.

My earlier implementation was in AJAX, i.e. I had used the XMLHttpRequest function for asynchronous procurement of the RSS data and XML DOM parsing to display it. Needless to say, JSON cuts down most of the logic, because of its inherent nature. (I could have used Singpolyma's excellent Outline Converter application, but it would simply have added to the overhead. Also, I don't like NING because they take the website offline too frequently. )
If you are interested, here is the link to my original script to parse the XML feed.

This looks strikingly similar to Aditya's ABC Index, but the similarity ends there. The ABC Index was for old Blogger which didn't have the category support or JSON feeds. So he had to make use of del.icio.us categories. Also, the implementation did not use the XMLHttpRequest, but was nevertheless asynchronously loaded. But the XMLHttpRequest gives the best asynchronous experience.
The idea of showing the categories in a block was originally Aditya's, so I should give him due credit.

So much for the intro babble. Lets get on with the hack, shall we?

THE HACK
1. First things first. You should get yourself a copy of the prototype JS framework for this hack to work. Host it in a place of your convenience, maybe your Google Pages, since you already have a Google account. Otherwise, you can get one from here.

Snap Shots

Get Free Shots from Snap.com

Datos personales