fullcalendar_styling.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /* ------------------------------------------------------------------------------
  2. *
  3. * # Fullcalendar basic options
  4. *
  5. * Demo JS code for extra_fullcalendar_styling.html page
  6. *
  7. * ---------------------------------------------------------------------------- */
  8. // Setup module
  9. // ------------------------------
  10. var FullCalendarStyling = function() {
  11. //
  12. // Setup module components
  13. //
  14. // External events
  15. var _componentFullCalendarStyling = function() {
  16. if (!$().fullCalendar) {
  17. console.warn('Warning - fullcalendar.min.js is not loaded.');
  18. return;
  19. }
  20. // Add events
  21. // ------------------------------
  22. // Default events
  23. var events = [
  24. {
  25. title: 'All Day Event',
  26. start: '2014-11-01'
  27. },
  28. {
  29. title: 'Long Event',
  30. start: '2014-11-07',
  31. end: '2014-11-10'
  32. },
  33. {
  34. id: 999,
  35. title: 'Repeating Event',
  36. start: '2014-11-09T16:00:00'
  37. },
  38. {
  39. id: 999,
  40. title: 'Repeating Event',
  41. start: '2014-11-16T16:00:00'
  42. },
  43. {
  44. title: 'Conference',
  45. start: '2014-11-11',
  46. end: '2014-11-13'
  47. },
  48. {
  49. title: 'Meeting',
  50. start: '2014-11-12T10:30:00',
  51. end: '2014-11-12T12:30:00'
  52. },
  53. {
  54. title: 'Lunch',
  55. start: '2014-11-12T12:00:00'
  56. },
  57. {
  58. title: 'Meeting',
  59. start: '2014-11-12T14:30:00'
  60. },
  61. {
  62. title: 'Happy Hour',
  63. start: '2014-11-12T17:30:00'
  64. },
  65. {
  66. title: 'Dinner',
  67. start: '2014-11-12T20:00:00'
  68. },
  69. {
  70. title: 'Birthday Party',
  71. start: '2014-11-13T07:00:00'
  72. },
  73. {
  74. title: 'Click for Google',
  75. url: 'http://google.com/',
  76. start: '2014-11-28'
  77. }
  78. ];
  79. // Event colors
  80. var eventColors = [
  81. {
  82. title: 'All Day Event',
  83. start: '2014-11-01',
  84. color: '#EF5350'
  85. },
  86. {
  87. title: 'Long Event',
  88. start: '2014-11-07',
  89. end: '2014-11-10',
  90. color: '#26A69A'
  91. },
  92. {
  93. id: 999,
  94. title: 'Repeating Event',
  95. start: '2014-11-09T16:00:00',
  96. color: '#26A69A'
  97. },
  98. {
  99. id: 999,
  100. title: 'Repeating Event',
  101. start: '2014-11-16T16:00:00',
  102. color: '#5C6BC0'
  103. },
  104. {
  105. title: 'Conference',
  106. start: '2014-11-11',
  107. end: '2014-11-13',
  108. color: '#546E7A'
  109. },
  110. {
  111. title: 'Meeting',
  112. start: '2014-11-12T10:30:00',
  113. end: '2014-11-12T12:30:00',
  114. color: '#546E7A'
  115. },
  116. {
  117. title: 'Lunch',
  118. start: '2014-11-12T12:00:00',
  119. color: '#546E7A'
  120. },
  121. {
  122. title: 'Meeting',
  123. start: '2014-11-12T14:30:00',
  124. color: '#546E7A'
  125. },
  126. {
  127. title: 'Happy Hour',
  128. start: '2014-11-12T17:30:00',
  129. color: '#546E7A'
  130. },
  131. {
  132. title: 'Dinner',
  133. start: '2014-11-12T20:00:00',
  134. color: '#546E7A'
  135. },
  136. {
  137. title: 'Birthday Party',
  138. start: '2014-11-13T07:00:00',
  139. color: '#546E7A'
  140. },
  141. {
  142. title: 'Click for Google',
  143. url: 'http://google.com/',
  144. start: '2014-11-28',
  145. color: '#FF7043'
  146. }
  147. ];
  148. // Event background colors
  149. var eventBackgroundColors = [
  150. {
  151. title: 'All Day Event',
  152. start: '2014-11-01'
  153. },
  154. {
  155. title: 'Long Event',
  156. start: '2014-11-07',
  157. end: '2014-11-10',
  158. color: '#DCEDC8',
  159. rendering: 'background'
  160. },
  161. {
  162. id: 999,
  163. title: 'Repeating Event',
  164. start: '2014-11-06T16:00:00'
  165. },
  166. {
  167. id: 999,
  168. title: 'Repeating Event',
  169. start: '2014-11-16T16:00:00'
  170. },
  171. {
  172. title: 'Conference',
  173. start: '2014-11-11',
  174. end: '2014-11-13'
  175. },
  176. {
  177. title: 'Meeting',
  178. start: '2014-11-12T10:30:00',
  179. end: '2014-11-12T12:30:00'
  180. },
  181. {
  182. title: 'Lunch',
  183. start: '2014-11-12T12:00:00'
  184. },
  185. {
  186. title: 'Happy Hour',
  187. start: '2014-11-12T17:30:00'
  188. },
  189. {
  190. title: 'Dinner',
  191. start: '2014-11-24T20:00:00'
  192. },
  193. {
  194. title: 'Meeting',
  195. start: '2014-11-03T10:00:00'
  196. },
  197. {
  198. title: 'Birthday Party',
  199. start: '2014-11-13T07:00:00'
  200. },
  201. {
  202. title: 'Vacation',
  203. start: '2014-11-27',
  204. end: '2014-11-30',
  205. color: '#FFCCBC',
  206. rendering: 'background'
  207. }
  208. ];
  209. // Initialization
  210. // ------------------------------
  211. // Basic view
  212. $('.fullcalendar-basic').fullCalendar({
  213. header: {
  214. left: 'prev,next today',
  215. center: 'title',
  216. right: 'month,basicWeek,basicDay'
  217. },
  218. defaultDate: '2014-11-12',
  219. editable: true,
  220. events: events,
  221. isRTL: $('html').attr('dir') == 'rtl' ? true : false
  222. });
  223. // Agenda view
  224. $('.fullcalendar-agenda').fullCalendar({
  225. header: {
  226. left: 'prev,next today',
  227. center: 'title',
  228. right: 'month,agendaWeek,agendaDay'
  229. },
  230. defaultDate: '2014-11-12',
  231. defaultView: 'agendaWeek',
  232. editable: true,
  233. businessHours: true,
  234. events: events,
  235. isRTL: $('html').attr('dir') == 'rtl' ? true : false
  236. });
  237. // List view
  238. $('.fullcalendar-list').fullCalendar({
  239. header: {
  240. left: 'prev,next today',
  241. center: 'title',
  242. right: 'listDay,listWeek,listMonth'
  243. },
  244. views: {
  245. listDay: { buttonText: 'Day' },
  246. listWeek: { buttonText: 'Week' },
  247. listMonth: { buttonText: 'Month' }
  248. },
  249. defaultView: 'listMonth',
  250. defaultDate: '2014-11-12',
  251. navLinks: true, // can click day/week names to navigate views
  252. editable: true,
  253. eventLimit: true, // allow "more" link when too many events
  254. events: events,
  255. isRTL: $('html').attr('dir') == 'rtl' ? true : false
  256. });
  257. // Event colors
  258. $('.fullcalendar-event-colors').fullCalendar({
  259. header: {
  260. left: 'prev,next today',
  261. center: 'title',
  262. right: 'month,agendaWeek,agendaDay'
  263. },
  264. defaultDate: '2014-11-12',
  265. editable: true,
  266. events: eventColors,
  267. isRTL: $('html').attr('dir') == 'rtl' ? true : false
  268. });
  269. // Event background colors
  270. $('.fullcalendar-background-colors').fullCalendar({
  271. header: {
  272. left: 'prev,next today',
  273. center: 'title',
  274. right: 'month,agendaWeek,agendaDay'
  275. },
  276. defaultDate: '2014-11-12',
  277. editable: true,
  278. events: eventBackgroundColors,
  279. isRTL: $('html').attr('dir') == 'rtl' ? true : false
  280. });
  281. };
  282. //
  283. // Return objects assigned to module
  284. //
  285. return {
  286. init: function() {
  287. _componentFullCalendarStyling();
  288. }
  289. }
  290. }();
  291. // Initialize module
  292. // ------------------------------
  293. document.addEventListener('DOMContentLoaded', function() {
  294. FullCalendarStyling.init();
  295. });