1import { getEvents } from "../calendar/API.js"; 2import { generateCalendar, loadCalendar } from "../calendar/calendar.js"; 3 4document.addEventListener("DOMContentLoaded", async () => { 5 //CALENDAR CONTROLS 6 const prevMonth = document.getElementById("prev-month"); 7 const nextMonth = document.getElementById("next-month"); 8 9 //GET ACTUAL DATE 10 const date = new Date(); 11 let currentYear = date.getFullYear(); 12 let currentMonth = date.getMonth(); 13 14 //GET EVENTS 15 let events = await getEvents(currentMonth, currentYear); 16 17 //GENERATE CALENDAR 18 let days = generateCalendar(currentYear, currentMonth, events); 19 20 //RENDER CALENDAR 21 loadCalendar(days, currentMonth, currentYear); 22 23 //CHANGE TO PREV MONTH 24 prevMonth.addEventListener("click", async () => { 25 if (currentMonth === 0) { 26 currentMonth = 11; 27 currentYear--; 28 } else { 29 currentMonth--; 30 } 31 events = await getEvents(currentMonth, currentYear); 32 days = generateCalendar(currentYear, currentMonth, events); 33 loadCalendar(days, currentMonth, currentYear); 34 }); 35 36 //CHANGE TO NEXT MONTH 37 nextMonth.addEventListener("click", async () => { 38 if (currentMonth === 11) { 39 currentMonth = 0; 40 currentYear++; 41 } else { 42 currentMonth++; 43 } 44 events = await getEvents(currentMonth, currentYear); 45 days = generateCalendar(currentYear, currentMonth, events); 46 loadCalendar(days, currentMonth, currentYear); 47 }); 48}); 49 50 51 52
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.