Wednesday, November 02, 2005 2:51 AM
jcmaslan
Windows Live Gadget for Bay Area Traffic
Since Jeff stayed up late getting www.microsoftgadgets.com ready for today's announcement of Windows Live, I thought I'd give gadgets a try. Remembering back in the day at Inktomi when major portals were reluctant to allow a 3rd party to control anything other than a GIF file served up to a high traffic page, I'm a bit amazed that we're finally able to offer near total customization. My first gadget is just a current map of Bay Area Traffic that refreshes itself every 60 seconds. From the Windows Live sidebar, select "Add Content / Advanced Options / Add a Gadget by URL" using http://www.maslan.org/bayareatrafficmap/bayareatrafficmap.xml. The javascript source is derived from the Clock sample on www.microsoftgadgets.com:
registerNamespace("Gadget");
Gadget.BayAreaTrafficMap = function(p_elSource, p_args, p_namespace)
{
Gadget.BayAreaTrafficMap.initializeBase(this, arguments);
var mapHTML = '<img src="http://traffic.511.org/homepage.gif">';
var legendHTML = '<img src="http://traffic.511.org/images/color-legend.gif">';
var objClock;
function UpdateTraffic()
{
p_elSource.innerHTML = "As of " + new Date() +
"<BR>" + mapHTML +
"<BR>" + legendHTML;
}
this.initialize = function(p_objScope)
{
Gadget.BayAreaTrafficMap.getBaseMethod(this, "initialize", "Web.Bindings.Base").call(this, p_objScope);
UpdateTraffic();
objClock = setInterval(UpdateTraffic, 60000);
}
this.dispose = function(p_blnUnload)
{
Gadget.BayAreaTrafficMap.getBaseMethod(this, "dispose", "Web.Bindings.Base").call(this, p_blnUnload);
clearInterval(objClock);
}
}
Gadget.BayAreaTrafficMap.registerClass("Gadget.BayAreaTrafficMap", "Web.Bindings.Base");