methods.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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;
  7. var d = new Date();
  8. var y = d.getFullYear();
  9. var m = d.getMonth();
  10. var staticEvents;
  11. $(document).ready(function() {
  12. cal = $('#calendar').fullCalendar({
  13. editable: true,
  14. header: {
  15. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  16. },
  17. loading: function(bool) {
  18. if (bool) {
  19. $('#loading').show();
  20. }else{
  21. $('#loading').hide();
  22. }
  23. },
  24. events: staticEvents = [
  25. {
  26. id: 1,
  27. title: "Long Event",
  28. start: new Date(y, m, 6),
  29. end: new Date(y, m, 10)
  30. },
  31. {
  32. id: 2,
  33. title: "Repeating",
  34. start: new Date(y, m, 2)
  35. },
  36. {
  37. id: 2,
  38. title: "Repeating",
  39. start: new Date(y, m, 9)
  40. },
  41. {
  42. id: 3,
  43. title: "Meeting",
  44. start: new Date(y, m, 20, 9, 0),
  45. end: new Date(y, m, 21, 0, 0),
  46. allDay: false
  47. },
  48. {
  49. id: 4,
  50. title: "Click for Facebook",
  51. start: new Date(y, m, 27),
  52. end: new Date(y, m, 28),
  53. url: "http://facebook.com/"
  54. },
  55. {
  56. id: 5,
  57. title: "timed event1",
  58. start: new Date (y, m, 31, 17, 30),
  59. allDay: false
  60. },
  61. {
  62. id: 6,
  63. title: "timed event1",
  64. start: new Date (y, m+1, 2, 14, 15),
  65. allDay: false
  66. },
  67. {
  68. id: 7,
  69. title: "timed event1",
  70. start: new Date (y, m+1, 4, 15, 00),
  71. end: new Date(y, m+1, 4, 17, 00),
  72. allDay: false
  73. }
  74. ]
  75. });
  76. });
  77. function updateEventStart() {
  78. var event = cal.fullCalendar('clientEvents', 3)[0];
  79. event.start = new Date(y, m, 25, 10, 30);
  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', 2)[0];
  86. event.start = new Date(y, m, 4, 13, 30);
  87. event.end = new Date(y, m, 5, 2, 0);
  88. event.allDay = false;
  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('incrementDate', 1, 1, 1)">+1 +1 +1</button>
  117. <button onclick="cal.fullCalendar('incrementDate', -1, -1, -1)">-1 -1 -1</button>
  118. <button onclick="updateEventStart()">update event start</button>
  119. <button onclick="updateRepeatingEvent()">update repeating event</button>
  120. <button onclick="renderEvent(false)">render new event</button>
  121. <button onclick="renderEvent(true)">render new sticky event</button>
  122. <br />
  123. <button onclick="cal.fullCalendar('removeEvents')">remove all</button>
  124. <button onclick="cal.fullCalendar('removeEvents', 2)">remove repeating events</button>
  125. <button onclick="cal.fullCalendar('removeEvents', function(e){return !e.allDay})">remove timed events</button>
  126. <button onclick="console.log(cal.fullCalendar('clientEvents'))">log events</button>
  127. <button onclick="console.log(cal.fullCalendar('clientEvents', '2'))">log repeating events</button>
  128. <button onclick="console.log(cal.fullCalendar('clientEvents', function(e){return e.allDay}))">log all-day events</button>
  129. <br />
  130. <button onclick="cal.fullCalendar('addEventSource', staticEvents)">+ static events</button>
  131. <button onclick="cal.fullCalendar('removeEventSource', staticEvents)">- static events</button>
  132. <button onclick="cal.fullCalendar('addEventSource', gcalFeed)">+ gcal</button>
  133. <button onclick="cal.fullCalendar('removeEventSource', gcalFeed)">- gcal</button>
  134. <button onclick="cal.fullCalendar('addEventSource', jsonFeed)">+ json</button>
  135. <button onclick="cal.fullCalendar('removeEventSource', jsonFeed)">- json</button>
  136. <button onclick="cal.fullCalendar('rerenderEvents')">rerender</button>
  137. <button onclick="cal.fullCalendar('refetchEvents')">refetch</button>
  138. <br />
  139. <button onclick="cal.fullCalendar('changeView', 'month')">change to month</button>
  140. <button onclick="cal.fullCalendar('changeView', 'basicWeek')">change to basicWeek</button>
  141. <button onclick="cal.fullCalendar('changeView', 'basicDay')">change to basicDay</button>
  142. <button onclick="cal.fullCalendar('render')">render</button>
  143. </p>
  144. <div id='loading' style='position:absolute;display:none'>loading...</div>
  145. <div id='calendar' style='width:900px;margin:20px auto 0;font-family:arial'></div>
  146. </body>
  147. </html>