locales.html 3.3 KB

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