Fun with JavaScript

Jan 13, 2007 15:35

For the past few days I've been playing around with JavaScript a bit.

When I'm learning I like to have a little project to play around with to give me some direction. I uhmed & ahhed and eventually decided it was high time to update my extremely out-dated website (it still has a fire logo for chrissakes - ugh!). So I've been rebuilding it as a ( Read more... )

javascript hack web

Leave a comment

Comments 2

2shortplanks January 13 2007, 22:39:51 UTC
How are you pulling the content from LJ? I've been planning to do the similar kind of site for a replacement for twoshortplanks.com.

I've been waiting for tom to complete his comprehensive atom/rss parser in JavaScript (based on the Python feed passing testsuite.) He's been having hardware problems though

Reply

hackity hack spurkis January 16 2007, 21:58:10 UTC
The short answer is: I hacked it.

The long answer:
* I use zimki.remote.get to fetch the atom feed as text
* I remove all the namespaces from the Atom feed to make parsing it easier.
* I create a new E4X XML object & cache it (E4X is sooo much easier to use)
* I find all the xml nodes I want & convert them to JSON both manually & using uneval()
* I know it's not bullet proof, so I cross my fingers it works properly ;-)

It's not bullet-proof -- I'd certainly prefer to use a proper Atom parser. Also, writing one wasn't my goal here.

The main bits of the code:
var blogUrl = 'http://www.livejournal.com/users/spurkis/data/atom... )

Reply


Leave a comment

Up