No Description

locales.html 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <link href='../packages/core/main.css' rel='stylesheet' />
  6. <link href='../packages/daygrid/main.css' rel='stylesheet' />
  7. <link href='../packages/timegrid/main.css' rel='stylesheet' />
  8. <link href='../packages/list/main.css' rel='stylesheet' />
  9. <script src='../packages/core/main.js'></script>
  10. <script src='../packages/core/locales-all.js'></script>
  11. <script src='../packages/interaction/main.js'></script>
  12. <script src='../packages/daygrid/main.js'></script>
  13. <script src='../packages/timegrid/main.js'></script>
  14. <script src='../packages/list/main.js'></script>
  15. <script>
  16. document.addEventListener('DOMContentLoaded', function() {
  17. var initialLocaleCode = 'en';
  18. var localeSelectorEl = document.getElementById('locale-selector');
  19. var calendarEl = document.getElementById('calendar');
  20. var calendar = new FullCalendar.Calendar(calendarEl, {
  21. plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
  22. header: {
  23. left: 'prev,next today',
  24. center: 'title',
  25. right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
  26. },
  27. defaultDate: '2019-08-12',
  28. locale: initialLocaleCode,
  29. buttonIcons: false, // show the prev/next text
  30. weekNumbers: true,
  31. navLinks: true, // can click day/week names to navigate views
  32. editable: true,
  33. eventLimit: true, // allow "more" link when too many events
  34. events: [
  35. {
  36. title: 'All Day Event',
  37. start: '2019-08-01'
  38. },
  39. {
  40. title: 'Long Event',
  41. start: '2019-08-07',
  42. end: '2019-08-10'
  43. },
  44. {
  45. groupId: 999,
  46. title: 'Repeating Event',
  47. start: '2019-08-09T16:00:00'
  48. },
  49. {
  50. groupId: 999,
  51. title: 'Repeating Event',
  52. start: '2019-08-16T16:00:00'
  53. },
  54. {
  55. title: 'Conference',
  56. start: '2019-08-11',
  57. end: '2019-08-13'
  58. },
  59. {
  60. title: 'Meeting',
  61. start: '2019-08-12T10:30:00',
  62. end: '2019-08-12T12:30:00'
  63. },
  64. {
  65. title: 'Lunch',
  66. start: '2019-08-12T12:00:00'
  67. },
  68. {
  69. title: 'Meeting',
  70. start: '2019-08-12T14:30:00'
  71. },
  72. {
  73. title: 'Happy Hour',
  74. start: '2019-08-12T17:30:00'
  75. },
  76. {
  77. title: 'Dinner',
  78. start: '2019-08-12T20:00:00'
  79. },
  80. {
  81. title: 'Birthday Party',
  82. start: '2019-08-13T07:00:00'
  83. },
  84. {
  85. title: 'Click for Google',
  86. url: 'http://google.com/',
  87. start: '2019-08-28'
  88. }
  89. ]
  90. });
  91. calendar.render();
  92. // build the locale selector's options
  93. calendar.getAvailableLocaleCodes().forEach(function(localeCode) {
  94. var optionEl = document.createElement('option');
  95. optionEl.value = localeCode;
  96. optionEl.selected = localeCode == initialLocaleCode;
  97. optionEl.innerText = localeCode;
  98. localeSelectorEl.appendChild(optionEl);
  99. });
  100. // when the selected option changes, dynamically change the calendar option
  101. localeSelectorEl.addEventListener('change', function() {
  102. if (this.value) {
  103. calendar.setOption('locale', this.value);
  104. }
  105. });
  106. });
  107. </script>
  108. <style>
  109. body {
  110. margin: 0;
  111. padding: 0;
  112. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  113. font-size: 14px;
  114. }
  115. #top {
  116. background: #eee;
  117. border-bottom: 1px solid #ddd;
  118. padding: 0 10px;
  119. line-height: 40px;
  120. font-size: 12px;
  121. }
  122. #calendar {
  123. max-width: 900px;
  124. margin: 40px auto;
  125. padding: 0 10px;
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div id='top'>
  131. Locales:
  132. <select id='locale-selector'></select>
  133. </div>
  134. <div id='calendar'></div>
  135. </body>
  136. </html>