sources.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link href='../build/out/fullcalendar.css' rel='stylesheet' />
  5. <link href='../build/out/fullcalendar.print.css' rel='stylesheet' media='print' />
  6. <script src='../lib/jquery/jquery.js'></script>
  7. <script src='../lib/jquery-ui/ui/jquery-ui.js'></script>
  8. <script src='../lib/moment/moment.js'></script>
  9. <script src='../build/out/fullcalendar.js'></script>
  10. <script src='../build/out/gcal.js'></script>
  11. <script>
  12. var cal;
  13. var date = new Date();
  14. var d = date.getDate();
  15. var m = date.getMonth();
  16. var y = date.getFullYear();
  17. var gcalFeed = $.fullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");
  18. var jsonFeed = "../demos/json-events.php";
  19. var staticEvents = [
  20. {
  21. title: 'All Day Event',
  22. start: new Date(y, m, 1)
  23. },
  24. {
  25. title: 'Long Event',
  26. start: new Date(y, m, d-5),
  27. end: new Date(y, m, d-2)
  28. },
  29. {
  30. title: 'Event with \n newline',
  31. start: new Date(y, m, d),
  32. end: new Date(y, m, d)
  33. },
  34. {
  35. title: 'T event',
  36. start: y + '-06-06T10:20:00',
  37. allDay: false
  38. },
  39. {
  40. title: 'No T event',
  41. start: y + '-06-06 11:30:00',
  42. allDay: false
  43. },
  44. {
  45. title: 'O event',
  46. start: y + '-06-06T10:20:00-02:00',
  47. allDay: false
  48. },
  49. {
  50. title: 'U event',
  51. start: y + '-06-06T14:30:00Z',
  52. allDay: false
  53. },
  54. {
  55. id: 999,
  56. title: 'Repeating Event',
  57. start: new Date(y, m, d-3, 16, 0),
  58. allDay: false
  59. },
  60. {
  61. id: 999,
  62. title: 'Repeating Event',
  63. start: new Date(y, m, d+4, 16, 0),
  64. allDay: false
  65. },
  66. {
  67. title: 'Meeting',
  68. start: new Date(y, m, d, 10, 30),
  69. allDay: false
  70. },
  71. {
  72. id: 777,
  73. title: 'Lunch',
  74. start: new Date(y, m, d, 12, 0),
  75. end: new Date(y, m, d, 14, 0),
  76. allDay: false,
  77. //className: 'yellow-event black-text-event'
  78. className: ['yellow-event', 'black-text-event']
  79. },
  80. {
  81. title: 'Birthday Party',
  82. start: new Date(y, m, d+1, 19, 0),
  83. end: new Date(y, m, d+1, 22, 30),
  84. allDay: false
  85. },
  86. {
  87. title: 'Click for Google',
  88. start: new Date(y, m, 28),
  89. end: new Date(y, m, 29),
  90. url: 'http://google.com/'
  91. },
  92. {
  93. title: 'Float String Timestamp Event',
  94. start: '1295078400.0'
  95. }
  96. ];
  97. var customSource = function(start, end, callback) {
  98. callback([
  99. {
  100. title: 'FIRST',
  101. start: start
  102. },
  103. {
  104. title: 'LAST',
  105. start: new Date(end - 1)
  106. }
  107. ]);
  108. };
  109. /* TODO: doesn't work anymore
  110. $.ajaxSetup({
  111. cache: true // should NOT insert an extra _ parameter
  112. });
  113. */
  114. $(document).ready(function() {
  115. cal = $('#calendar').fullCalendar({
  116. ignoreTimezone: false,
  117. //lazyFetching: false,
  118. editable: true,
  119. header: {
  120. left: 'prev,next today',
  121. center: 'title',
  122. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  123. },
  124. //events: staticEvents,
  125. eventSources: [
  126. staticEvents,
  127. jsonFeed,
  128. gcalFeed,
  129. customSource
  130. ],
  131. loading: function(bool) {
  132. if (bool) {
  133. $('#loading').show();
  134. }else{
  135. $('#loading').hide();
  136. }
  137. }
  138. /*
  139. ,
  140. startParam: 'mystart',
  141. endParam: 'myend'
  142. */
  143. });
  144. });
  145. </script>
  146. <style>
  147. .red-event {
  148. background: red !important;
  149. }
  150. .yellow-event {
  151. background: yellow !important;
  152. }
  153. .black-text-event {
  154. color: #000 !important;
  155. }
  156. button {
  157. font-size: 11px;
  158. }
  159. </style>
  160. </head>
  161. <body style='font-size:12px'>
  162. <div id='loading' style='position:absolute;top:0;left:0;display:none'>loading...</div>
  163. <p>
  164. <button onclick="cal.fullCalendar('refetchEvents')">refetch</button>
  165. </p>
  166. <div id='calendar' style='width:900px;margin:20px auto 0;font-family:arial'></div>
  167. </body>
  168. </html>