fullcalendar/tests/sources.html

144 lines
2.6 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type='text/javascript' src='loader.js'></script>
<script type='text/javascript'>
var cal;
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth();
var gcalFeed = $.fullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");
var jsonFeed = "../examples/json-events.php";
var staticEvents = [
{
id: 1,
title: "Long Event",
date: new Date(y, m, 6), //!
end: new Date(y, m, 10),
className: 'red-event'
},
{
id: 2,
title: "Repeating",
start: new Date(y, m, 2)
},
{
id: 2,
title: "Repeating",
start: new Date(y, m, 9)
},
{
id: 3,
title: "Meeting",
start: new Date(y, m, 20, 9, 0),
end: new Date(y, m, 21, 0, 0),
allDay: false,
//className: 'yellow-event black-text-event',
className: ['yellow-event', 'black-text-event'],
editable: true
},
{
id: 4,
title: "Click for Facebook",
start: new Date(y, m, 27),
end: new Date(y, m, 28),
url: "http://facebook.com/"
},
{
id: 5,
title: "timed event1",
start: new Date (y, m, 31, 17, 30),
allDay: false
},
{
id: 6,
title: "timed event1",
start: new Date (y, m+1, 2, 14, 15),
allDay: false
},
{
id: 7,
title: "timed event1",
start: new Date (y, m+1, 4, 15, 00),
end: new Date(y, m+1, 4, 17, 00),
allDay: false
}
];
var customSource = function(start, end, callback) {
callback([
{
title: 'FIRST',
start: start
},
{
title: 'LAST',
start: new Date(end - 1)
}
]);
};
$(document).ready(function() {
cal = $('#calendar').fullCalendar({
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
//events: staticEvents,
eventSources: [
staticEvents,
jsonFeed,
gcalFeed,
customSource
],
loading: function(bool) {
if (bool) {
$('#loading').show();
}else{
$('#loading').hide();
}
}
/*
,
startParam: 'mystart',
endParam: 'myend',
cacheParam: 'uniq'
*/
});
});
</script>
<style>
.red-event a {
background: red;
}
.yellow-event a {
background: yellow;
}
.black-text-event a {
color: #000;
}
button {
font-size: 11px;
}
</style>
</head>
<body style='font-size:12px'>
<div id='loading' style='position:absolute;top:0;left:0;display:none'>loading...</div>
<p>
<button onclick="cal.fullCalendar('refetchEvents')">refetch</button>
</p>
<div id='calendar' style='width:900px;margin:20px auto 0;font-family:arial'></div>
</body>
</html>