A Wonderful Widget


We’ve been promising to introduce our Sunlight Labs more formally and today we’re doing that, along with the announcement of a really neat widget that we’re calling "Popup Politicians." Before you imagine the worst, like, Representative J. Dennis Hastert or Sen. John McCain or Representative John Boehner popping out of cake, take a look at what Greg Elin and Duncan Werner have developed — a web page plug-in that links the reader to information about who’s financing the lawmaker’s campaign, the lawmaker’s voting record, and their profile on Congresspedia. The widget appears as a small popup window when you mouse-over the little sun icon that appears at the end of the name.

We’re experimenting with the Popup on our site today. Check out all the technical information on the Sunlight Labs page.

What is it? Popup Politicians is an AJAX-powered widget which contacts a remote database here at Sunlight to retrieve links we’ve selected for a politician. The single Javascript that powers the mouse-over "bubbles" is served from Sunlight Labs server along with the data. When you load the page, the Javascript looks for Technorati-styled link tags for Members of Congress on the web page and then dynamically modifies found links to add the rollover action and a mouse-over bubble.

Sunlight Labs is readying various flavors of the widget for increased scalability. The basic widget can be added to a web site or blog by simply adding the Javascript and style sheet to the page’s headers and then manually adding a properly formed linked to each members of congress name where a popup is desired. Micah Sifry tried it last night on his personal blog and it worked. Other flavors include local server-side PHP code to automatically search and replace members of congress’s names with the necessary links. Sunlight has built a Drupal plugin that does this for our own site, www. sunlightfoundation.com, and also built a WordPress 2.0 plugin as well. Plugins for the major blogging and CMS platforms are planned and SunlightLabs is eager to find open source developers to help accomplish this and extend the the plugin. 

That’s beyond the extent of my knowledge. Check it out here. And email Greg Elin at gelin@sunlightfoundation.com for more information, particularly if I have left you thoroughly confused. And remember, we’re still experimenting with this, so all is not perfect yet.