mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix: hide empty titlebar metadata
This commit is contained in:
@@ -113,6 +113,10 @@ function updateUserInfo(info: {
|
|||||||
userName: string | null;
|
userName: string | null;
|
||||||
}) {
|
}) {
|
||||||
const titlebar = document.getElementsByClassName("titlebar")[0];
|
const titlebar = document.getElementsByClassName("titlebar")[0];
|
||||||
|
const metadata = [info.meta.code, info.meta.governmentID]
|
||||||
|
.filter((value): value is string => Boolean(value))
|
||||||
|
.join(" // ");
|
||||||
|
const displayName = info.userDesc || info.userName || "";
|
||||||
|
|
||||||
titlebar.append(
|
titlebar.append(
|
||||||
stringToHTML(/* html */ `
|
stringToHTML(/* html */ `
|
||||||
@@ -128,10 +132,10 @@ function updateUserInfo(info: {
|
|||||||
<div class="userInfo">
|
<div class="userInfo">
|
||||||
<div class="userInfoText">
|
<div class="userInfoText">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
<p class="userInfohouse userInfoCode"></p>
|
<p class="userInfohouse userInfoCode" style="display: none;"></p>
|
||||||
<p class="userInfoName">${info.userDesc}</p>
|
${displayName ? `<p class="userInfoName">${displayName}</p>` : ""}
|
||||||
</div>
|
</div>
|
||||||
<p class="userInfoCode">${info.meta.code} // ${info.meta.governmentID}</p>
|
${metadata ? `<p class="userInfoCode">${metadata}</p>` : ""}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`).firstChild!,
|
`).firstChild!,
|
||||||
@@ -171,9 +175,12 @@ async function updateStudentInfo(students: any) {
|
|||||||
|
|
||||||
const houseelement = document.getElementsByClassName(
|
const houseelement = document.getElementsByClassName(
|
||||||
"userInfohouse",
|
"userInfohouse",
|
||||||
)[0] as HTMLElement;
|
)[0] as HTMLElement | undefined;
|
||||||
|
|
||||||
|
if (!houseelement) return;
|
||||||
|
|
||||||
const student = students[index] ?? {};
|
const student = students[index] ?? {};
|
||||||
let text = "N/A";
|
let text = "";
|
||||||
|
|
||||||
if (student.house) {
|
if (student.house) {
|
||||||
text = `${student.year ?? ""}${student.house}`;
|
text = `${student.year ?? ""}${student.house}`;
|
||||||
@@ -193,6 +200,7 @@ async function updateStudentInfo(students: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
houseelement.innerText = text;
|
houseelement.innerText = text;
|
||||||
|
houseelement.style.display = text ? "block" : "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewsButton(fragment: DocumentFragment, menu: HTMLElement) {
|
function createNewsButton(fragment: DocumentFragment, menu: HTMLElement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user