diff --git a/package.json b/package.json index ea36f0d1..1ca7e66d 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@types/webextension-polyfill": "^0.10.7", "autoprefixer": "^10.4.15", "color": "^4.2.3", - "dompurify": "^3.0.6", + "dompurify": "^3.0.8", "framer-motion": "^10.16.16", "install": "^0.13.0", "localforage": "^1.10.0", diff --git a/src/SEQTA.ts b/src/SEQTA.ts index e2e546ca..4b6d59dd 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -1578,6 +1578,8 @@ function CheckUnmarkedAttendance(lessonattendance: any) { } function callHomeTimetable(date: string, change?: any) { + const DayContainer = document.getElementById('day-container')! + console.log("Daycontainer: ", DayContainer) // Creates a HTTP Post Request to the SEQTA page for the students timetable var xhr = new XMLHttpRequest() xhr.open('POST', `${location.origin}/seqta/student/load/timetable?`, true) @@ -1652,10 +1654,6 @@ function callHomeTimetable(date: string, change?: any) { }) } } else { - if (DayContainer == null) { - console.log('DayContainer is null') - //DayContainer = document.getElementById('day-container')! - } console.log(DayContainer); DayContainer.innerHTML = '' var dummyDay = document.createElement('div') @@ -2187,9 +2185,15 @@ function AddCustomShortcutsToPage() { async function loadHomePage() { // Sends the html data for the home page console.log('[BetterSEQTA] Started Loading Home Page') + document.title = 'Home ― SEQTA Learn' const element = document.querySelector('[data-key=home]') + await new Promise((resolve) => { + // Delay to prevent SEQTA from removing the UI elements + setTimeout(resolve, 8) + }) + // Apply the active class to indicate clicked on home button element!.classList.add('active') @@ -2201,34 +2205,33 @@ async function loadHomePage() { return } - main.innerHTML = ''; - const icon = document.querySelector('link[rel*="icon"]')! as HTMLLinkElement icon.href = icon48 currentSelectedDate = new Date() // Creates the root of the home page added to the main div - var html = stringToHTML('
') + let homeContainer = stringToHTML('
') + console.log(homeContainer?.firstChild!) // Appends the html file to main div // Note: firstChild of html is done due to needing to grab the body from the stringToHTML function - main!.append(html.firstChild!) + main.append(homeContainer?.firstChild!) // Gets the current date const date = new Date() - - + console.log(document.getElementById('main')) + // Creates the shortcut container into the home container const Shortcut = stringToHTML('
') // Appends the shortcut container into the home container - document.getElementById('home-container')!.append(Shortcut.firstChild!) + document.getElementById('home-container')?.append(Shortcut?.firstChild!) // Creates the container div for the timetable portion of the home page const Timetable = stringToHTML('

Today\'s Lessons

') // Appends the timetable container into the home container - document.getElementById('home-container')!.append(Timetable.firstChild!) + document.getElementById('home-container')?.append(Timetable?.firstChild!) // Formats the current date used send a request for timetable and notices later const TodayFormatted =