mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix home loading
This commit is contained in:
+1
-1
@@ -51,7 +51,7 @@
|
|||||||
"@types/webextension-polyfill": "^0.10.7",
|
"@types/webextension-polyfill": "^0.10.7",
|
||||||
"autoprefixer": "^10.4.15",
|
"autoprefixer": "^10.4.15",
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
"dompurify": "^3.0.6",
|
"dompurify": "^3.0.8",
|
||||||
"framer-motion": "^10.16.16",
|
"framer-motion": "^10.16.16",
|
||||||
"install": "^0.13.0",
|
"install": "^0.13.0",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
|
|||||||
+15
-12
@@ -1578,6 +1578,8 @@ function CheckUnmarkedAttendance(lessonattendance: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function callHomeTimetable(date: string, change?: 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
|
// Creates a HTTP Post Request to the SEQTA page for the students timetable
|
||||||
var xhr = new XMLHttpRequest()
|
var xhr = new XMLHttpRequest()
|
||||||
xhr.open('POST', `${location.origin}/seqta/student/load/timetable?`, true)
|
xhr.open('POST', `${location.origin}/seqta/student/load/timetable?`, true)
|
||||||
@@ -1652,10 +1654,6 @@ function callHomeTimetable(date: string, change?: any) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DayContainer == null) {
|
|
||||||
console.log('DayContainer is null')
|
|
||||||
//DayContainer = document.getElementById('day-container')!
|
|
||||||
}
|
|
||||||
console.log(DayContainer);
|
console.log(DayContainer);
|
||||||
DayContainer.innerHTML = ''
|
DayContainer.innerHTML = ''
|
||||||
var dummyDay = document.createElement('div')
|
var dummyDay = document.createElement('div')
|
||||||
@@ -2187,9 +2185,15 @@ function AddCustomShortcutsToPage() {
|
|||||||
async function loadHomePage() {
|
async function loadHomePage() {
|
||||||
// Sends the html data for the home page
|
// Sends the html data for the home page
|
||||||
console.log('[BetterSEQTA] Started Loading Home Page')
|
console.log('[BetterSEQTA] Started Loading Home Page')
|
||||||
|
|
||||||
document.title = 'Home ― SEQTA Learn'
|
document.title = 'Home ― SEQTA Learn'
|
||||||
const element = document.querySelector('[data-key=home]')
|
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
|
// Apply the active class to indicate clicked on home button
|
||||||
element!.classList.add('active')
|
element!.classList.add('active')
|
||||||
|
|
||||||
@@ -2201,34 +2205,33 @@ async function loadHomePage() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
main.innerHTML = '';
|
|
||||||
|
|
||||||
const icon = document.querySelector('link[rel*="icon"]')! as HTMLLinkElement
|
const icon = document.querySelector('link[rel*="icon"]')! as HTMLLinkElement
|
||||||
icon.href = icon48
|
icon.href = icon48
|
||||||
|
|
||||||
currentSelectedDate = new Date()
|
currentSelectedDate = new Date()
|
||||||
|
|
||||||
// Creates the root of the home page added to the main div
|
// Creates the root of the home page added to the main div
|
||||||
var html = stringToHTML('<div class="home-root"><div class="home-container" id="home-container"></div></div>')
|
let homeContainer = stringToHTML('<div class="home-root"><div class="home-container" id="home-container"></div></div>')
|
||||||
|
|
||||||
|
console.log(homeContainer?.firstChild!)
|
||||||
// Appends the html file to main div
|
// Appends the html file to main div
|
||||||
// Note: firstChild of html is done due to needing to grab the body from the stringToHTML function
|
// 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
|
// Gets the current date
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
|
|
||||||
|
console.log(document.getElementById('main'))
|
||||||
|
|
||||||
// Creates the shortcut container into the home container
|
// Creates the shortcut container into the home container
|
||||||
const Shortcut = stringToHTML('<div class="shortcut-container border"><div class="shortcuts border" id="shortcuts"></div></div>')
|
const Shortcut = stringToHTML('<div class="shortcut-container border"><div class="shortcuts border" id="shortcuts"></div></div>')
|
||||||
// Appends the shortcut container into the home container
|
// 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
|
// Creates the container div for the timetable portion of the home page
|
||||||
const Timetable = stringToHTML('<div class="timetable-container border"><div class="home-subtitle"><h2 id="home-lesson-subtitle">Today\'s Lessons</h2><div class="timetable-arrows"><svg width="24" height="24" viewBox="0 0 24 24" style="transform: scale(-1,1)" id="home-timetable-back"><g style="fill: currentcolor;"><path d="M8.578 16.359l4.594-4.594-4.594-4.594 1.406-1.406 6 6-6 6z"></path></g></svg><svg width="24" height="24" viewBox="0 0 24 24" id="home-timetable-forward"><g style="fill: currentcolor;"><path d="M8.578 16.359l4.594-4.594-4.594-4.594 1.406-1.406 6 6-6 6z"></path></g></svg></div></div><div class="day-container" id="day-container"></div></div>')
|
const Timetable = stringToHTML('<div class="timetable-container border"><div class="home-subtitle"><h2 id="home-lesson-subtitle">Today\'s Lessons</h2><div class="timetable-arrows"><svg width="24" height="24" viewBox="0 0 24 24" style="transform: scale(-1,1)" id="home-timetable-back"><g style="fill: currentcolor;"><path d="M8.578 16.359l4.594-4.594-4.594-4.594 1.406-1.406 6 6-6 6z"></path></g></svg><svg width="24" height="24" viewBox="0 0 24 24" id="home-timetable-forward"><g style="fill: currentcolor;"><path d="M8.578 16.359l4.594-4.594-4.594-4.594 1.406-1.406 6 6-6 6z"></path></g></svg></div></div><div class="day-container" id="day-container"></div></div>')
|
||||||
// Appends the timetable container into the home container
|
// 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
|
// Formats the current date used send a request for timetable and notices later
|
||||||
const TodayFormatted =
|
const TodayFormatted =
|
||||||
|
|||||||
Reference in New Issue
Block a user