Last active
August 29, 2015 14:16
-
-
Save sherzberg/79f90c71651a5e272279 to your computer and use it in GitHub Desktop.
fullcalendar RSS based events
This file contains hidden or 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
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