Twitter links in Tumblr

JP’s a Dad now 😳 May 20, 2009
Source

When writing a post the other day[^1], I wanted to be able to use the tumblr chat where the participants were twitter users. Tumblr doesn’t support HTML in chat usernames, so I wrote a tiny javascript chunk to automatically troll any elements you give it and replace @twitter-username with a link to their account. (You can see it in action on the aforementioned post[^2]) You can find the code in this github gist, all you need to do is link in mootools (you only need to have the selectors part available, for now) and this script in the head of your template like this:

Then add a small javascript section at the end of your template (inside the body):

Where span.label is the CSS Selector for the elements you wish to scan. You can link to these files from my web server if you like[^3] (check the source of any of these pages), but if you have your own hosting please use that instead, I only have limited bandwidth!

[^1]: Import note: this post was originally written on Tumblr, which feels like a pretty crucial piece of information for this post to make sense! [^2]: Sadly you can't! See the footnote above. [^3]: I doubt that you'd still want to, but that server doesn't exist any more. You can always load directly from the raw gist on Github.

Discussion in the ATmosphere

Loading comments...