BlogCFC JS Twitter Pod

I was looking at the Twitter Badges that you can add to your site. I noticed that there was a JS implementation. I thought that would be cool because I could style it to match the rest of the site.

So, I created a new empty BlogCFC pod and pasted in the code that Twitter offered. Well, I have to say I was very un-impressed. It basically is only set up to display the current message and the time it was added. Except there's even a typo. So, it wasn't even showing the date.

After a little investigation, I got it to show the date, which turns out to be the raw date, not the "about x [min|hours|days]" that I was expecting.

Well, I took that as a challenge and began to build out similar functionality to the Flash Twitter badge in my JS Twitter badge.

It actually wasn't that bad until I got to the time stuff. First IE wouldn't use the date that Twitter sends in the Date() constructor. So, I had to manipulate the date string to make it work.

Then, it hit me that I was using JavaScript, which is client-side. Which meant timezones would effect the "about x [min|hours|days]" status display. So, I came up with a system where your offset is hard-coded in minutes and then the necessary calculations are based off of that.

I've posted the resulting pod (seen at right) for download here.

If anyone uses it I would love to hear about it. Send me a link to your blog.

Related Blog Entries

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.6.002.