Periscope updated with bit.ly support

Summary As a result of a live-coding session at this year's beCamp, Periscope has been updated to v.0.2.2 and now provides bit.ly support.

This weekend I attended beCamp2009, where I gave several talks. One of them was on the excellent Greasemonkey plugin for Firefox and its flexibility and power as a scripting environment. Part of the demo was to add bit.ly support to Periscope in a live-coding session.

I was pleased at how remarkably easy it was, especially since I was a little nervous about touching code I hadn't seen in a while. As for whether this means that Periscope is well-designed or if it's just those energy drinks temporarily increasing my focus -- well, I'll leave that for you to decide.

But for other curious hackers, the special sauce is in the handler map:


// For each domain, we provide a domain handler that
// understands how to provide a meaningful title for the
// periscoped link. We optionally provide an id handler that
// knows how to transform the identifier of each periscoped
// link so that it's easier to find what we're looking for.

// [other handlers elided]
handlerMap["is.gd"]          = {domainHandler: handleIsGd, idHandler: null};
handlerMap["bit.ly"]         = {domainHandler: handleGetTitle, idHandler: null};
handlerMap[""]               = {domainHandler: handleUnknown, idHandler: null};

Each of the handlerMap lines maps a particular domain name identified from one of the document's links. In this case, when you mouseover a particular bit.ly link, you'll now see the additional information provided by the handleGetTitle handler. Hovering over, say, http://bit.ly/GH4Cn thus lets you know that this goes to Google's search page.

In a future article I'll show how to write your own handlers. Thanks again to everyone at beCamp2009 for attending my talk. If you have any questions, feel free to drop me a line using my contact page.

Trackbacks (none)

TrackBack URL: http://distilledb.com/mt/mt-tb.cgi/43

leave new comment