Click on an event to generate an ics file (bear in mind that the timezone is UTC):
Red Sox vs Fenway Park
Fenway Park
1800 - 2100
|
Blu Sox vs Fenway Drive
Blu Park
1700 - 1900
|
Is it easier than just making a link with the data in the URL? I don't know, but it certainly seems juicier... Here's the code:
<script type="text/javascript">
function getCal(node){
node.style.background = "#999999";
var calStartDate = node.getAttribute("cal:startDate");
var calEndDate = node.getAttribute("cal:endDate");
for (var i = 0; i < node.childNodes.length; i++){
var t = node.childNodes[i];
if ( t.hasAttributes("class") ){
var c = t.getAttribute("class");
var v = t.firstChild.nodeValue;
if ( c == "cal:name" ){ var calName = v };
if ( c == "cal:location" ){ var calLocation = v };
if ( c == "cal:startTime" ){ var calStartTime = v };
if ( c == "cal:endTime" ){ var calEndTime = v };
}
}
document.location.href= "http://event.openam.com?timezone=UTC&summary=" + calName + "&start_date=" + calStartDate + "&start_time=" + calStartTime + "&stop_date=" + calEndDate + "&stop_time=" + calEndTime + "&format=.ics";
}
</script>