fullcalendar/tests/methods.html

167 lines
5.2 KiB
HTML
Raw Normal View History

2009-09-17 08:30:10 +02:00
<!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, staticEvents;
2009-09-17 08:30:10 +02:00
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
2009-09-17 08:30:10 +02:00
$(document).ready(function() {
cal = $('#calendar').fullCalendar({
editable: true,
2009-11-01 00:51:30 +01:00
weekends: false,
2009-09-17 08:30:10 +02:00
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
2009-09-17 08:30:10 +02:00
},
2009-09-21 12:11:08 +02:00
loading: function(bool) {
if (bool) {
$('#loading').show();
}else{
$('#loading').hide();
}
},
2009-09-17 08:30:10 +02:00
events: staticEvents = [
{
title: 'All Day Event',
start: new Date(y, m, 1)
2009-09-17 08:30:10 +02:00
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
2009-09-17 08:30:10 +02:00
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
2009-09-17 08:30:10 +02:00
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
2009-09-17 08:30:10 +02:00
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
2009-09-17 08:30:10 +02:00
},
{
id: 777,
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
2009-09-17 08:30:10 +02:00
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
2009-09-17 08:30:10 +02:00
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
2009-09-17 08:30:10 +02:00
}
]
});
});
function updateEventStart() {
var event = cal.fullCalendar('clientEvents', 777)[0];
2009-10-19 10:53:07 +02:00
event.start = new Date(y, m, d, 13, 30);
event.end = new Date(y, m, d, 14, 50);
//event.start = new Date(y, m, 25, 10, 30); // move big days
//event.end = new Date(y, m, 26);
2009-09-21 12:11:08 +02:00
//event.allDay = true;
2009-09-17 08:30:10 +02:00
cal.fullCalendar('updateEvent', event);
}
function updateRepeatingEvent() {
var event = cal.fullCalendar('clientEvents', 999)[0];
2009-09-17 08:30:10 +02:00
event.start = new Date(y, m, 4, 13, 30);
2009-09-21 12:11:08 +02:00
event.end = new Date(y, m, 5, 2, 0);
2009-10-19 10:53:07 +02:00
event.allDay = true;
2009-09-17 08:30:10 +02:00
event.title = "repeat yo";
2009-09-21 12:11:08 +02:00
//event.editable = false;
event.url = "http://google.com/";
2009-09-17 08:30:10 +02:00
cal.fullCalendar('updateEvent', event);
2009-09-21 12:11:08 +02:00
//console.log(cal.fullCalendar('clientEvents', 2));
2009-09-17 08:30:10 +02:00
}
function renderEvent(stick) {
cal.fullCalendar('renderEvent', {
start: new Date(y, m, 16),
title: 'heyman'
}, stick);
}
var gcalFeed = $.fullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");
2009-09-21 12:11:08 +02:00
var jsonFeed = "../examples/json-events.php";
2009-09-17 08:30:10 +02:00
</script>
<style>
button {
font-size: 11px;
}
</style>
</head>
<body style='font-size:12px'>
<p>
<button onclick="cal.fullCalendar('prev')">prev</button>
<button onclick="cal.fullCalendar('next')">next</button>
<button onclick="cal.fullCalendar('today')">today</button>
<button onclick="cal.fullCalendar('gotoDate', 1999, 9, 31)">Oct 31 1999</button>
2009-10-15 08:14:21 +02:00
<button onclick="cal.fullCalendar('gotoDate', new Date(1999, 9, 30))">Oct 30 1999 (Date)</button>
2009-09-21 12:11:08 +02:00
<button onclick="cal.fullCalendar('incrementDate', 1, 1, 1)">+1 +1 +1</button>
<button onclick="cal.fullCalendar('incrementDate', -1, -1, -1)">-1 -1 -1</button>
2009-09-17 08:30:10 +02:00
<button onclick="updateEventStart()">update event start</button>
<button onclick="updateRepeatingEvent()">update repeating event</button>
<button onclick="renderEvent(false)">render new event</button>
<button onclick="renderEvent(true)">render new sticky event</button>
<br />
<button onclick="cal.fullCalendar('removeEvents')">remove all</button>
<button onclick="cal.fullCalendar('removeEvents', 999)">remove repeating events</button>
2009-09-17 08:30:10 +02:00
<button onclick="cal.fullCalendar('removeEvents', function(e){return !e.allDay})">remove timed events</button>
<button onclick="console.log(cal.fullCalendar('clientEvents'))">log events</button>
<button onclick="console.log(cal.fullCalendar('clientEvents', '999'))">log repeating events</button>
2009-09-17 08:30:10 +02:00
<button onclick="console.log(cal.fullCalendar('clientEvents', function(e){return e.allDay}))">log all-day events</button>
<br />
<button onclick="cal.fullCalendar('addEventSource', staticEvents)">+ static events</button>
<button onclick="cal.fullCalendar('removeEventSource', staticEvents)">- static events</button>
<button onclick="cal.fullCalendar('addEventSource', gcalFeed)">+ gcal</button>
<button onclick="cal.fullCalendar('removeEventSource', gcalFeed)">- gcal</button>
<button onclick="cal.fullCalendar('addEventSource', jsonFeed)">+ json</button>
<button onclick="cal.fullCalendar('removeEventSource', jsonFeed)">- json</button>
<button onclick="cal.fullCalendar('rerenderEvents')">rerender</button>
<button onclick="cal.fullCalendar('refetchEvents')">refetch</button>
2009-10-01 07:39:02 +02:00
<br />
<button onclick="cal.fullCalendar('changeView', 'month')">change to month</button>
<button onclick="cal.fullCalendar('changeView', 'basicWeek')">change to basicWeek</button>
<button onclick="cal.fullCalendar('changeView', 'basicDay')">change to basicDay</button>
<button onclick="cal.fullCalendar('render')">render</button>
2009-09-17 08:30:10 +02:00
</p>
2009-09-21 12:11:08 +02:00
<div id='loading' style='position:absolute;display:none'>loading...</div>
2009-09-17 08:30:10 +02:00
<div id='calendar' style='width:900px;margin:20px auto 0;font-family:arial'></div>
</body>
2009-09-14 12:28:23 +02:00
</html>