sources.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 gcalFeed = $.fullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");
  11. var jsonFeed = "../examples/json-events.php";
  12. var staticEvents = [
  13. {
  14. id: 1,
  15. title: "Long Event",
  16. date: new Date(y, m, 6), //!
  17. end: new Date(y, m, 10),
  18. className: 'red-event'
  19. },
  20. {
  21. id: 2,
  22. title: "Repeating",
  23. start: new Date(y, m, 2)
  24. },
  25. {
  26. id: 2,
  27. title: "Repeating",
  28. start: new Date(y, m, 9)
  29. },
  30. {
  31. id: 3,
  32. title: "Meeting",
  33. start: new Date(y, m, 20, 9, 0),
  34. end: new Date(y, m, 21, 0, 0),
  35. allDay: false,
  36. //className: 'yellow-event black-text-event',
  37. className: ['yellow-event', 'black-text-event'],
  38. editable: true
  39. },
  40. {
  41. id: 4,
  42. title: "Click for Facebook",
  43. start: new Date(y, m, 27),
  44. end: new Date(y, m, 28),
  45. url: "http://facebook.com/"
  46. },
  47. {
  48. id: 5,
  49. title: "timed event1",
  50. start: new Date (y, m, 31, 17, 30),
  51. allDay: false
  52. },
  53. {
  54. id: 6,
  55. title: "timed event1",
  56. start: new Date (y, m+1, 2, 14, 15),
  57. allDay: false
  58. },
  59. {
  60. id: 7,
  61. title: "timed event1",
  62. start: new Date (y, m+1, 4, 15, 00),
  63. end: new Date(y, m+1, 4, 17, 00),
  64. allDay: false
  65. }
  66. ];
  67. var customSource = function(start, end, callback) {
  68. callback([
  69. {
  70. title: 'FIRST',
  71. start: start
  72. },
  73. {
  74. title: 'LAST',
  75. start: new Date(end - 1)
  76. }
  77. ]);
  78. };
  79. $(document).ready(function() {
  80. cal = $('#calendar').fullCalendar({
  81. editable: true,
  82. header: {
  83. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  84. },
  85. //events: staticEvents,
  86. eventSources: [
  87. staticEvents,
  88. jsonFeed,
  89. gcalFeed,
  90. customSource
  91. ],
  92. loading: function(bool) {
  93. if (bool) {
  94. $('#loading').show();
  95. }else{
  96. $('#loading').hide();
  97. }
  98. }
  99. /*
  100. ,
  101. startParam: 'mystart',
  102. endParam: 'myend',
  103. cacheParam: 'uniq'
  104. */
  105. });
  106. });
  107. </script>
  108. <style>
  109. .red-event a {
  110. background: red;
  111. }
  112. .yellow-event a {
  113. background: yellow;
  114. }
  115. .black-text-event a {
  116. color: #000;
  117. }
  118. button {
  119. font-size: 11px;
  120. }
  121. </style>
  122. </head>
  123. <body style='font-size:12px'>
  124. <div id='loading' style='position:absolute;top:0;left:0;display:none'>loading...</div>
  125. <p>
  126. <button onclick="cal.fullCalendar('refetchEvents')">refetch</button>
  127. </p>
  128. <div id='calendar' style='width:900px;margin:20px auto 0;font-family:arial'></div>
  129. </body>
  130. </html>