triggers.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. /*
  12. TODO:
  13. this file demonstrates a bug, unrelated to triggers, where starting off in a small window,
  14. changing to week, maximizing the window, switching to month causes the last column of
  15. events to be misaligned (don't stretch all the way right)
  16. this happens due to week being taller than month before the switch back
  17. */
  18. var date = new Date();
  19. var d = date.getDate();
  20. var m = date.getMonth();
  21. var y = date.getFullYear();
  22. $(document).ready(function() {
  23. $('#calendar').fullCalendar({
  24. //weekends: false,
  25. //initialView: 'week',
  26. headerToolbar: {
  27. left: 'prev,next today',
  28. center: 'title',
  29. right: 'month,week,dayGridWeek,day,dayGridDay'
  30. },
  31. editable: true,
  32. //direction: 'rtl',
  33. viewDisplay: function(view) {
  34. console.log('viewDisplay');
  35. console.log(view.activeStart + ' - ' + view.activeEnd);
  36. console.log(view.currentStart + ' - ' + view.currentEnd);
  37. //console.log(view);
  38. //console.log(this);
  39. },
  40. _eventsPositioned: function(view) {
  41. console.log('all rendered', view);
  42. },
  43. //loading: // see sources.html
  44. windowResize: function(view) {
  45. console.log('windowResize - ' + view.title);
  46. //console.log(this);
  47. },
  48. slotMinTime: '5',
  49. slotMaxTime: '21:30',
  50. dayClick: function(dayDate, allDay, ev, view) {
  51. //alert(dayDate);
  52. console.log('dayClick - ' + dayDate + ', allDay:' + allDay + ' - ' + view.title);
  53. //console.log(ev);
  54. console.log(this);
  55. },
  56. selectable: true,
  57. select: function(start, end, allDay) {
  58. console.log('select', start, end, allDay);
  59. },
  60. unselect: function() {
  61. console.log('unselect');
  62. },
  63. eventRender: function(event, element, view) {
  64. if (event.id == 888) {
  65. return false;
  66. }
  67. else if (event.id == 777) {
  68. return $("<div style='background:green'>").text(event.title);
  69. }
  70. else if (event.id == 999) {
  71. element.css('border-color', 'red');
  72. //console.log('renderEvent (' + event.title + ') - ' + view.title);
  73. }
  74. },
  75. eventPositioned: function(event, element, view) {
  76. //console.log('after render for "' + event.title + '":');
  77. //console.log(element);
  78. },
  79. eventClick: function(event, jsEvent, view) {
  80. console.log('EVENT CLICK ' + event.title);
  81. //console.log(jsEvent);
  82. //console.log(view);
  83. //console.log(this);
  84. //return false;
  85. },
  86. eventMouseover: function(event, jsEvent, view) {
  87. console.log('MOUSEOVER ' + event.title);
  88. //console.log(jsEvent);
  89. //console.log(view);
  90. //console.log(this);
  91. },
  92. eventMouseout: function(event, jsEvent, view) {
  93. console.log('MOUSEOUT ' + event.title);
  94. //console.log(jsEvent);
  95. //console.log(view);
  96. //console.log(this);
  97. },
  98. eventDragStart: function(event, jsEvent, ui, view) {
  99. console.log('DRAG START ' + event.title);
  100. console.log(this);
  101. },
  102. eventDragStop: function(event, jsEvent, ui, view) {
  103. console.log('DRAG STOP ' + event.title);
  104. console.log(this);
  105. },
  106. eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
  107. console.log('DROP ' + event.title);
  108. console.log(dayDelta + ' days');
  109. console.log(minuteDelta + ' minutes');
  110. console.log('allday: ' + allDay);
  111. //setTimeout(function() {
  112. // revertFunc();
  113. //}, 2000);
  114. //console.log(jsEvent);
  115. //console.log(ui);
  116. //console.log(view.title);
  117. //console.log(this);
  118. },
  119. eventResizeStart: function(event, jsEvent, ui, view) {
  120. console.log('RESIZE START ' + event.title);
  121. //console.log(this);
  122. },
  123. eventResizeStop: function(event, jsEvent, ui, view) {
  124. console.log('RESIZE STOP ' + event.title);
  125. //console.log(this);
  126. },
  127. eventResize: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
  128. console.log('RESIZE!! ' + event.title);
  129. console.log(dayDelta + ' days');
  130. console.log(minuteDelta + ' minutes');
  131. //setTimeout(function() {
  132. // revertFunc();
  133. //}, 2000);
  134. //console.log(jsEvent);
  135. //console.log(ui);
  136. //console.log(view.title);
  137. //console.log(this);
  138. },
  139. /* for testing _eventsPositioned
  140. events: {
  141. url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
  142. editable: true,
  143. className: 'holiday'
  144. },
  145. */
  146. events: [
  147. {
  148. title: 'All Day Event',
  149. start: new Date(y, m, 1)
  150. },
  151. {
  152. title: 'Long Event',
  153. start: new Date(y, m, d-5),
  154. end: new Date(y, m, d-2)
  155. },
  156. {
  157. groupId: 999,
  158. title: 'Repeating Event',
  159. start: new Date(y, m, d-3, 16, 0),
  160. allDay: false
  161. },
  162. {
  163. groupId: 999,
  164. title: 'Repeating Event',
  165. start: new Date(y, m, d+4, 16, 0),
  166. allDay: false
  167. },
  168. {
  169. id: 888,
  170. title: 'Meeting',
  171. start: new Date(y, m, d, 10, 30),
  172. allDay: false
  173. },
  174. {
  175. id: 777,
  176. title: 'Lunch',
  177. start: new Date(y, m, d, 12, 0),
  178. end: new Date(y, m, d, 14, 0),
  179. allDay: false
  180. },
  181. {
  182. title: 'Birthday Party',
  183. start: new Date(y, m, d+1, 19, 0),
  184. end: new Date(y, m, d+1, 22, 30),
  185. allDay: false
  186. },
  187. {
  188. title: 'Click for Google',
  189. start: new Date(y, m, 28),
  190. end: new Date(y, m, 29),
  191. url: 'http://google.com/'
  192. }
  193. ]
  194. });
  195. });
  196. </script>
  197. </head>
  198. <body style='font-size:12px'>
  199. <div id='calendar' style='width:75%;margin:20px auto 0;font-family:arial'></div>
  200. </body>
  201. </html>