-
-
Save rdallaire/749becb5285909efad04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var calID = "", | |
key = "", | |
target = "", | |
date = new Date; | |
console.log(document.referrer); | |
var url = "https://www.googleapis.com/calendar/v3/calendars/" + calID + "/events?singleEvents=true&orderBy=startTime&maxResults=10&timeMin=" + date.toISOString() + "&key=" + key; | |
$(target).append("<ul></ul>"); | |
var eventLists; | |
$.getJSON(url, function(b) { | |
for (i in b.items) { | |
item = b.items[i]; | |
formattedStart = moment(item.start.dateTime).format("MMM Do h:mm"); | |
formattedEnd = moment(item.end.dateTime).format("h:mm"); | |
var a = "", | |
a = a + '<span class="startDate">', | |
a = a + formattedStart, | |
a = a + "-", | |
a = a + formattedEnd, | |
a = a + "</span>", | |
a = a + '<span class="title">', | |
a = a + item.summary, | |
a = a + "</span>"; | |
item.description && (item.htmlLink && (a += '<a href="', a += item.htmlLink, a += '" title="link to the individual event" >'), a += '<span class="description">', a += item.description, | |
a += "</span>", item.htmlLink && (a += "</a>")); | |
eventLists += a; | |
} | |
$(target + " ul").append(eventLists); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment