diff --git a/src/SEQTA.ts b/src/SEQTA.ts index c692ecb8..3e1abb4e 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -1212,15 +1212,15 @@ async function AddBetterSEQTAElements(toggle: any) { try { // Fetch the response and wait for it const response = await fetch(`${location.origin}/seqta/student/login`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json; charset=utf-8', - }, - body: JSON.stringify({ - mode: 'normal', - query: null, - redirect_url: location.origin, - }), + method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=utf-8', + }, + body: JSON.stringify({ + mode: 'normal', + query: null, + redirect_url: location.origin, + }), }); // Parse the JSON response and wait for it @@ -1242,17 +1242,17 @@ async function AddBetterSEQTAElements(toggle: any) { userInfosvgdiv.appendChild(logoutbutton); } catch (error) { - console.error('Error fetching and processing data:', error); + console.error('Error fetching and processing data:', error); } try { // Await the fetch response const response = await fetch(`${location.origin}/seqta/student/load/message/people`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json; charset=utf-8', - }, - body: JSON.stringify({ mode: 'student' }), + method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=utf-8', + }, + body: JSON.stringify({ mode: 'student' }), }); // Await the JSON parsing of the response @@ -1261,31 +1261,31 @@ async function AddBetterSEQTAElements(toggle: any) { // Process the students data var index = students.findIndex(function (person: any) { - return ( - person.firstname == students.userDesc.split(' ')[0] && - person.surname == students.userDesc.split(' ')[1] - ); + return ( + person.firstname == students.userDesc.split(' ')[0] && + person.surname == students.userDesc.split(' ')[1] + ); }); let houseelement1 = document.getElementsByClassName('userInfohouse')[0]; const houseelement = houseelement1 as HTMLElement if (students[index]?.house) { - (houseelement as HTMLElement).style.background = students[index].house_colour; - try { - let colorresult = GetThresholdOfColor(students[index]?.house_colour); - - houseelement.style.color = colorresult && colorresult > 300 ? 'black' : 'white'; - houseelement.innerText = students[index].year + students[index].house; - } catch (error) { - houseelement.innerText = students[index].house; - } + (houseelement as HTMLElement).style.background = students[index].house_colour; + try { + let colorresult = GetThresholdOfColor(students[index]?.house_colour); + + houseelement.style.color = colorresult && colorresult > 300 ? 'black' : 'white'; + houseelement.innerText = students[index].year + students[index].house; + } catch (error) { + houseelement.innerText = students[index].house; + } } else { - houseelement.innerText = students[index].year; + houseelement.innerText = students[index].year; } - } catch (error) { + } catch (error) { console.error('Error fetching and processing student data:', error); - } + } var NewsButtonStr = '
'; var NewsButton = stringToHTML(NewsButtonStr);