Skip to content

Instantly share code, notes, and snippets.

@sherzberg
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sherzberg/79f90c71651a5e272279 to your computer and use it in GitHub Desktop.
Save sherzberg/79f90c71651a5e272279 to your computer and use it in GitHub Desktop.
fullcalendar RSS based events
function parseRSS(url, callback) {
var fullpath = document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url);
console.log(fullpath);
jQuery.ajax({
url: fullpath,
dataType: 'jsonp',
success: function (data) {
console.log(data);
callback(data.responseData.feed);
}
});
}
function responseToEvents(response) {
var events = [];
for (i in response.entries) {
var item = response.entries[i];
events.push({
title: item.contentSnippet,
start: item.publishedDate,
url: item.link
});
}
return events;
}
function getEvents(start, end, timezone, callback) {
parseRSS('https://eventsfeed.constantcontact.com/calendar/rss?eso=001UZDecOAU7_KiXOoHy8wnzw==', function (response) {
callback(responseToEvents(response))
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment