sources.html 3.7 KB

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