I had to first figure out how to show the events on the given time line. This brought me to the jQuery hoverIntent plugin by Brian Cherne. This is the same exact syntax as using jQuery's hover function except one crucial thing.
$('.ms-acal-summary-dayrow td').hoverIntent( config ); var config = { over: DisplayCalendar, interval: 300, timeout: 100000, out: CloseCalendar }
I followed the same approach as my last post, SharePoint, Setting the Status Bar Notifcation From a List. I will describe what is happening below.
window.setInterval(function () { $('.ms-acal-summary-dayrow td').hoverIntent( config ); }, 500); $('#calendarClose').click( function () { $('#calendarDisplay').hide(); }); var config = { over: DisplayCalendar, interval: 300, timeout: 100000, out: CloseCalendar } $('.ms-acal-summary-dayrow td').hoverIntent( config ); function DisplayCalendar() { $('.middleTD').filter( function () { $(this).html(''); }); $('#calendarDisplay').addClass('calendarDisplayCSS').show(); // get date from CalendarWP - add to top header of table var date = $(this).attr('date'); $('#calendarDate').text(date); date = Date.parse(date).toString('yyyy-MM-dd'); var soapEnv = " \ \ \ CorporateCalendar \ \ \ \ \ \ 500 \ \ \ "; // Call web service $.ajax({ url: "http://YourServer/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, complete: test, contentType: "text/xml; charset=\"utf-8\"" }); function test(xData, status) { //alert(xData.responseText); return false; var calendarList = []; var startTime = ""; var endTime = ""; var calDate = ""; var index = 0; var startTimeNum = ""; var dateNum = ""; $(xData.responseXML).find("z\\:row").each(function () { // get date from calendar calDate = Date.parse($(this).attr("ows_EventDate")).toString('yyyy-MM-dd'); // check if calendar date is equal to date of mouse hover if (calDate == date) { calendarData = {}; calendarData.Title = $(this).attr("ows_Title"); // get time only from "EventDate" (start) startTime = Date.parse($(this).attr("ows_EventDate").substring($(this).attr("ows_EventDate").indexOf(' '))).toString('h:mm tt'); calendarData.StartTime = startTime; // get time only from "EndDate" (end) endTime = Date.parse($(this).attr("ows_EndDate").substring($(this).attr("ows_EndDate").indexOf(' '))).toString('h:mm tt'); calendarData.EndTime = endTime; calendarList.push(calendarData); } }); for (var i = 0; i < calendarList.length; i++) { startTimeMin = Date.parse(calendarList[i].StartTime).toString('mm'); $('#cal-holder td').filter( function () { // startTime is 8:00am, 9:00am, etc. if (startTimeMin == "00") { startTime = Date.parse(calendarList[i].StartTime).toString('htt').toLowerCase(); if ($(this).html() == startTime) { endTime = Date.parse(calendarList[i].EndTime).toString('htt').toLowerCase(); $(this).next().append(' ' + calendarList[i].Title + ' ' + startTime + " - " + endTime + ''); } } // startTime is 8:30am, 9:30am, etc. else { startTimeNum = Date.parse(calendarList[i].StartTime).toString('htt'); dateNum = $(this).html().toUpperCase(); if (startTimeNum == dateNum) { startTime = Date.parse(calendarList[i].StartTime).toString('h:mmtt').toLowerCase(); endTime = Date.parse(calendarList[i].EndTime).toString('h:mmtt').toLowerCase(); $(this).parent().next().children().next().append(' ' + calendarList[i].Title + ' ' + startTime + " - " + endTime + ''); } } }); } } } function CloseCalendar() { $('#calendarDisplay').hide(); }
Here is the final look of the day viewer being populated by the events hovered over May 4th:
Anything in here will be replaced on browsers that support the canvas element