···11-// If window pathname is "/" and the element with the class "timetable" exists, run the code
22-if (window.location.pathname === "/" && document.getElementsByClassName("timetable")[0]) {
33- let timetableContainer = document.querySelectorAll("[data-timetable-container]");
11+// moves the timetable to it's own row on the dashboard, preventing it from being squished by other elements
4255- // Add the class "columns" to timetableContainer
66- timetableContainer[0].classList.add("columns");
33+// check if we're on the homepage and a timetable element exists
44+if (window.location.pathname !== "/" || !document.querySelector(".timetable")) return;
7588- let rowElement = document.getElementsByClassName("Component_Dashboard_TimetableController")[0].parentNode.parentNode;
66+// get the timetable container and add the 'columns' class
77+let timetableContainer = document.querySelector("[data-timetable-container]");
88+if (!timetableContainer) return;
99+timetableContainer.classList.add("columns");
9101010- // Move timetableContainer to the start of the row
1111- rowElement.insertBefore(timetableContainer[0], rowElement.firstChild);
1212-}
1111+// get the row element and move the timetable container to the beginning
1212+let rowElement = document.querySelector(".Component_Dashboard_TimetableController")?.parentNode?.parentNode;
1313+if (!rowElement) return;
1414+rowElement.insertBefore(timetableContainer, rowElement.firstChild);