Created
February 11, 2016 15:13
-
-
Save codedcontainer/c716092deebb13854f89 to your computer and use it in GitHub Desktop.
Creates a new instance of FullCalendar from an XML file (example)
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 fullCalendar() | |
{ | |
$('#calendar').fullCalendar( | |
{ | |
eventBackgroundColor: '#7A1705', | |
eventBorderColor: '#7A1705', | |
header: | |
{ | |
left: 'title', | |
center: '', | |
right: 'today prev, next', | |
}, | |
buttonIcons: | |
{ | |
prev: 'left-single-arrow', | |
}, | |
eventClick: function(event, jsEvent, view) | |
{ | |
$('.myModal3 .title').text(event.title); | |
$('.myModal3 .date').text(event.start.format('MMM Do YYYY @ h:mm:ss a')); | |
$('.myModal3 .modal-body').text(event.desc); | |
$('.myModal3 .modal-body').append("<a href='" + event.link + "' target='_blank'>Learn More</a>"); | |
$('.myModal3').css('display', 'block'); | |
$('.myModal3.fade').css('opacity', '1'); | |
}, | |
events: function(start, end, timezone, callback) | |
{ | |
$.ajax( | |
{ | |
url: '', | |
dataType: 'xml', | |
data: | |
{ | |
start: start.unix(), | |
end: end.unix() | |
}, | |
success: function(doc) | |
{ | |
var events = []; | |
$(doc).find('event').each(function(e, a) | |
{ | |
var time = $(a).find('start-date-time').text(); | |
//Wed, 16 Sep 2015 10:00:00 EDT | |
var formatTime = moment(time).format(); | |
html = $.parseHTML($(a).find('description').text()); | |
events.push( | |
{ | |
title: $(a).find('summary').text(), | |
link: $(a).find('event-url').text(), | |
start: formatTime, | |
desc: $($.parseHTML($(a).find('description').text())).html() | |
}); | |
}); | |
callback(events); | |
} | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment