forked from fullcalendar/fullcalendar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
methods.html
188 lines (167 loc) · 5.96 KB
/
methods.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!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='../src/_loader.js?debug'></script>
<script type='text/javascript' src='../src/gcal/_loader.js'></script>
<script type='text/javascript'>
var cal, staticEvents;
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$(document).ready(function() {
cal = $('#calendar').fullCalendar({
editable: true,
weekends: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
},
loading: function(bool) {
if (bool) {
$('#loading').show();
}else{
$('#loading').hide();
}
},
events: staticEvents = [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
id: 777,
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});
});
function updateEventStart() {
var event = cal.fullCalendar('clientEvents', 777)[0];
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);
//event.allDay = true;
cal.fullCalendar('updateEvent', event);
}
function updateRepeatingEvent() {
var event = cal.fullCalendar('clientEvents', 999)[0];
event.start = new Date(y, m, 4, 13, 30);
event.end = new Date(y, m, 5, 2, 0);
event.allDay = true;
event.title = "repeat yo";
//event.editable = false;
event.url = "http://google.com/";
event.color = 'red';
event.textColor = 'green';
cal.fullCalendar('updateEvent', event);
//console.log(cal.fullCalendar('clientEvents', 2));
}
function renderEvent(stick) {
cal.fullCalendar('renderEvent', {
start: new Date(y, m, 17),
title: 'heyman'
}, stick);
}
function getView() {
var view = cal.fullCalendar('getView');
console.log(view.start + ' --- ' + view.end + ' "' + view.title + '"');
}
function getDate() {
console.log(cal.fullCalendar('getDate'));
}
function optionGetter() {
console.log(cal.fullCalendar('option', 'editable'));
}
var gcalFeed = $.fullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");
var jsonFeed = "../demos/json-events.php";
</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>
<button onclick="cal.fullCalendar('gotoDate', new Date(1999, 9, 30))">Oct 30 1999 (Date)</button>
<button onclick="cal.fullCalendar('incrementDate', 1, 1, 1)">+1 +1 +1</button>
<button onclick="cal.fullCalendar('incrementDate', -1, -1, -1)">-1 -1 -1</button>
<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>
<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>
<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 events</button>
<button onclick="cal.fullCalendar('refetchEvents')">refetch events</button>
<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="getView()">getView</button>
<button onclick="getDate()">getDate</button>
<button onclick="optionGetter()">option getter</button>
<button onclick="cal.width(1100)">change width (passive)</button>
<button onclick="cal.fullCalendar('render')">render</button>
<button onclick="cal.fullCalendar('option', 'height', 1000)">change height</button>
</p>
<div id='loading' style='position:absolute;display:none'>loading...</div>
<div id='calendar' style='width:70%;margin:20px auto 0;font-family:arial'></div>
</body>
</html>