sources.html 3.1 KB

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