methods.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html>
  3. <head>
  4. <script type='text/javascript' src='loader.js'></script>
  5. <script type='text/javascript'>
  6. var cal, staticEvents;
  7. var date = new Date();
  8. var d = date.getDate();
  9. var m = date.getMonth();
  10. var y = date.getFullYear();
  11. $(document).ready(function() {
  12. cal = $('#calendar').fullCalendar({
  13. editable: true,
  14. header: {
  15. left: 'prev,next today',
  16. center: 'title',
  17. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  18. },
  19. loading: function(bool) {
  20. if (bool) {
  21. $('#loading').show();
  22. }else{
  23. $('#loading').hide();
  24. }
  25. },
  26. events: staticEvents = [
  27. {
  28. title: 'All Day Event',
  29. start: new Date(y, m, 1)
  30. },
  31. {
  32. title: 'Long Event',
  33. start: new Date(y, m, d-5),
  34. end: new Date(y, m, d-2)
  35. },
  36. {
  37. id: 999,
  38. title: 'Repeating Event',
  39. start: new Date(y, m, d-3, 16, 0),
  40. allDay: false
  41. },
  42. {
  43. id: 999,
  44. title: 'Repeating Event',
  45. start: new Date(y, m, d+4, 16, 0),
  46. allDay: false
  47. },
  48. {
  49. title: 'Meeting',
  50. start: new Date(y, m, d, 10, 30),
  51. allDay: false
  52. },
  53. {
  54. id: 777,
  55. title: 'Lunch',
  56. start: new Date(y, m, d, 12, 0),
  57. end: new Date(y, m, d, 14, 0),
  58. allDay: false
  59. },
  60. {
  61. title: 'Birthday Party',
  62. start: new Date(y, m, d+1, 19, 0),
  63. end: new Date(y, m, d+1, 22, 30),
  64. allDay: false
  65. },
  66. {
  67. title: 'Click for Google',
  68. start: new Date(y, m, 28),
  69. end: new Date(y, m, 29),
  70. url: 'http://google.com/'
  71. }
  72. ]
  73. });
  74. });
  75. function updateEventStart() {
  76. var event = cal.fullCalendar('clientEvents', 777)[0];
  77. event.start = new Date(y, m, d, 13, 30);
  78. event.end = new Date(y, m, d, 14, 50);
  79. //event.start = new Date(y, m, 25, 10, 30); // move big days
  80. //event.end = new Date(y, m, 26);
  81. //event.allDay = true;
  82. cal.fullCalendar('updateEvent', event);
  83. }
  84. function updateRepeatingEvent() {
  85. var event = cal.fullCalendar('clientEvents', 999)[0];
  86. event.start = new Date(y, m, 4, 13, 30);
  87. event.end = new Date(y, m, 5, 2, 0);
  88. event.allDay = true;
  89. event.title = "repeat yo";
  90. //event.editable = false;
  91. event.url = "http://google.com/";
  92. cal.fullCalendar('updateEvent', event);
  93. //console.log(cal.fullCalendar('clientEvents', 2));
  94. }
  95. function renderEvent(stick) {
  96. cal.fullCalendar('renderEvent', {
  97. start: new Date(y, m, 16),
  98. title: 'heyman'
  99. }, stick);
  100. }
  101. var gcalFeed = $.fullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");
  102. var jsonFeed = "../examples/json-events.php";
  103. </script>
  104. <style>
  105. button {
  106. font-size: 11px;
  107. }
  108. </style>
  109. </head>
  110. <body style='font-size:12px'>
  111. <p>
  112. <button onclick="cal.fullCalendar('prev')">prev</button>
  113. <button onclick="cal.fullCalendar('next')">next</button>
  114. <button onclick="cal.fullCalendar('today')">today</button>
  115. <button onclick="cal.fullCalendar('gotoDate', 1999, 9, 31)">Oct 31 1999</button>
  116. <button onclick="cal.fullCalendar('gotoDate', new Date(1999, 9, 30))">Oct 30 1999 (Date)</button>
  117. <button onclick="cal.fullCalendar('incrementDate', 1, 1, 1)">+1 +1 +1</button>
  118. <button onclick="cal.fullCalendar('incrementDate', -1, -1, -1)">-1 -1 -1</button>
  119. <button onclick="updateEventStart()">update event start</button>
  120. <button onclick="updateRepeatingEvent()">update repeating event</button>
  121. <button onclick="renderEvent(false)">render new event</button>
  122. <button onclick="renderEvent(true)">render new sticky event</button>
  123. <br />
  124. <button onclick="cal.fullCalendar('removeEvents')">remove all</button>
  125. <button onclick="cal.fullCalendar('removeEvents', 999)">remove repeating events</button>
  126. <button onclick="cal.fullCalendar('removeEvents', function(e){return !e.allDay})">remove timed events</button>
  127. <button onclick="console.log(cal.fullCalendar('clientEvents'))">log events</button>
  128. <button onclick="console.log(cal.fullCalendar('clientEvents', '999'))">log repeating events</button>
  129. <button onclick="console.log(cal.fullCalendar('clientEvents', function(e){return e.allDay}))">log all-day events</button>
  130. <br />
  131. <button onclick="cal.fullCalendar('addEventSource', staticEvents)">+ static events</button>
  132. <button onclick="cal.fullCalendar('removeEventSource', staticEvents)">- static events</button>
  133. <button onclick="cal.fullCalendar('addEventSource', gcalFeed)">+ gcal</button>
  134. <button onclick="cal.fullCalendar('removeEventSource', gcalFeed)">- gcal</button>
  135. <button onclick="cal.fullCalendar('addEventSource', jsonFeed)">+ json</button>
  136. <button onclick="cal.fullCalendar('removeEventSource', jsonFeed)">- json</button>
  137. <button onclick="cal.fullCalendar('rerenderEvents')">rerender</button>
  138. <button onclick="cal.fullCalendar('refetchEvents')">refetch</button>
  139. <br />
  140. <button onclick="cal.fullCalendar('changeView', 'month')">change to month</button>
  141. <button onclick="cal.fullCalendar('changeView', 'basicWeek')">change to basicWeek</button>
  142. <button onclick="cal.fullCalendar('changeView', 'basicDay')">change to basicDay</button>
  143. <button onclick="cal.fullCalendar('render')">render</button>
  144. </p>
  145. <div id='loading' style='position:absolute;display:none'>loading...</div>
  146. <div id='calendar' style='width:900px;margin:20px auto 0;font-family:arial'></div>
  147. </body>
  148. </html>