Ahhh… Javascript… (plus how to detect iPhone viewing of your site)
The insult generation obsession renewed and continued… I cleaned up the javascript code for both the classic and iPhone versions of the Textual Abuse page. It was seriously ugly to get around some really old misbehavior of random numbers in Netscape and because I was a doofus when I originally wrote it. Ok, still a doofus, but now at least one with some pride. Besides, de-dumbassing the code, I also added a method of emailing the insult, thus making this quite possibly the most useful application I’ve ever written. Now with just a couple of taps of your finger, you can send a classy message like this to your fat, ugly, stupid republican female friends in just seconds:
You vermin-ridden, Huckabee-loving, obtuse, bovine, vomit-inspiring, hog-humping hag!!!!
My next task is to actually improve the insults a bit, they’re still pretty lame and very much in the mentality of me as a 26 year old. I’m older and dirtier now… I also have to improve that icon…
I also spent some time researching a javascript method of detecting the iPhone (and iPod Touch) users when they come to the “classic” version of the Textual Abuse page. Most methods I found depend on finding the string “iPhone” in the user agent string. This is a problem now because of the iPod Touch users – certainly wouldn’t want to lock them out of the fun. So the solution can be found at the Apple-hosted, open source WebKit development project, where they’ve put together a nice javascript library for just this purpose. Apple has more info on this subject and the user agent at their developer site as well.
