event_transform.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel='stylesheet' href='../build/out/fullcalendar/fullcalendar.css' />
  5. <link rel='stylesheet' href='../build/out/fullcalendar/fullcalendar.print.css' media='print' />
  6. <script src='../build/deps.js'></script>
  7. <script src='../build/out/fullcalendar/fullcalendar.js'></script>
  8. <script>
  9. $(document).ready(function() {
  10. var date = new Date();
  11. var d = date.getDate();
  12. var m = date.getMonth();
  13. var y = date.getFullYear();
  14. $('#calendar').fullCalendar({
  15. header: {
  16. left: 'prev,next today',
  17. center: 'title',
  18. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  19. },
  20. editable: true,
  21. eventTransform: function(event) {
  22. var copy = $.extend({}, event);
  23. copy.title += "*";
  24. return copy;
  25. },
  26. events: {
  27. eventTransform: function(event) {
  28. var copy = $.extend({}, event);
  29. copy.title += "!";
  30. return copy;
  31. },
  32. events: [
  33. {
  34. title: 'All Day Event',
  35. start: new Date(y, m, 1)
  36. },
  37. {
  38. title: 'Long Event',
  39. start: new Date(y, m, d-5),
  40. end: new Date(y, m, d-2)
  41. },
  42. {
  43. id: 999,
  44. title: 'Repeating Event',
  45. start: new Date(y, m, d-3, 16, 0),
  46. allDay: false
  47. },
  48. {
  49. id: 999,
  50. title: 'Repeating Event',
  51. start: new Date(y, m, d+4, 16, 0),
  52. allDay: false
  53. },
  54. {
  55. title: 'Meeting',
  56. start: new Date(y, m, d, 10, 30),
  57. allDay: false
  58. },
  59. {
  60. title: 'Lunch',
  61. start: new Date(y, m, d, 12, 5),
  62. end: new Date(y, m, d, 14, 43),
  63. allDay: false
  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. }
  79. });
  80. });
  81. </script>
  82. <style>
  83. body {
  84. margin-top: 40px;
  85. text-align: center;
  86. font-size: 13px;
  87. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  88. }
  89. #calendar {
  90. width: 900px;
  91. margin: 0 auto;
  92. }
  93. </style>
  94. </head>
  95. <body>
  96. <div id='calendar'></div>
  97. </body>
  98. </html>