Long ago (about three weeks ago to be correct) I still had lots of free time and no university lectures yet, so I decided to look at all - I repeat: at all 1000-something - Cyanide & Happiness comic strips on www.explosm.net and make a collection of the ones that I liked the most. Of course my collection isn’t complete and I got pretty tired at the end but I still think I’ve found quite a few gems among the strips.
I’ve stored them as a list of links in a raw txt file (it can be found here, if you want take a look a it) and it wasn’t really usable the way it was. I wanted to put it on my blog though to let others view it in a comfortable way but since I didn’t have enough time I postponed it… till yesterday. Yesterday I’ve finally found enough time to sit down and think and code something nice to let you (and myself, too) browse through my favorites.
You can find the final page here: http://data.blog.blackhc.net/explosm/explosmviewer.html
How does it work?
It uses AJAX! Well actually it only uses XMLHttpRequest to query the .dat file that stores a preprocessed list of C&H links (plus the respective image links) and uses that data to let you browse my favorites dynamically but it contains the code to create the said .dat file out of my raw .txt file.
Consequently if I ever update my list, I can do so simply by updating the .txt file with a few links and regenerate the .dat file with all additional information.
I’m mostly using some RegExp to parse the Explosm pages and my .txt and .dat files. If you want to try the code out yourself, mind that you need to uncomment the compileList( true ); line and use Internet Explorer to run it because FireFox doesn’t allow cross-domain access which is naturally needed if you want to parse the pages on explosm.net. The result is copied into the clipboard and can be then saved and uploaded to the webspace of choice (if you adapt the links in the script, too).
Enjoy :-)
Cheers,
Andreas