refactor: Optimize element search and remove unused code in SEQTA.ts and injected.scss

This commit is contained in:
sethburkart123
2024-06-19 22:28:15 +10:00
parent d21f8f0633
commit df5e644a94
4 changed files with 90 additions and 81 deletions
+11 -10
View File
@@ -16,18 +16,15 @@ export async function AddBetterSEQTAElements() {
handleStudentData();
createNewsButton();
setupEventListeners();
}
appendBackgroundToUI();
addExtensionSettings();
if (settingsState.onoff) {
appendBackgroundToUI();
await createSettingsButton();
await addDarkLightToggle();
customizeMenuToggle();
} else {
await createSettingsButton();
}
addExtensionSettings();
if (!settingsState.onoff) await createSettingsButton();
setupSettingsButton();
}
@@ -212,9 +209,13 @@ function setupEventListeners() {
}
async function createSettingsButton() {
let SettingsButton = stringToHTML(
'<button class="addedButton tooltip" id="AddedSettings"><svg width="24" height="24" viewBox="0 0 24 24"><g><g><path d="M23.182,6.923c-.29,0-3.662,2.122-4.142,2.4l-2.8-1.555V4.511l4.257-2.456a.518.518,0,0,0,.233-.408.479.479,0,0,0-.233-.407,6.511,6.511,0,1,0-3.327,12.107,6.582,6.582,0,0,0,6.148-4.374,5.228,5.228,0,0,0,.333-1.542A.461.461,0,0,0,23.182,6.923Z"></path><path d="M9.73,10.418,7.376,12.883c-.01.01-.021.016-.03.025L1.158,19.1a2.682,2.682,0,1,0,3.793,3.793l4.583-4.582,0,0,4.1-4.005-.037-.037A9.094,9.094,0,0,1,9.73,10.418ZM3.053,21.888A.894.894,0,1,1,3.946,21,.893.893,0,0,1,3.053,21.888Z"></path></g></g></svg><div class="tooltiptext topmenutooltip">BetterSEQTA+ Settings</div></button>'
);
let SettingsButton = stringToHTML( /* html */`
<button class="addedButton tooltip" id="AddedSettings">
<svg width="24" height="24" viewBox="0 0 24 24">
<g><g><path d="M23.182,6.923c-.29,0-3.662,2.122-4.142,2.4l-2.8-1.555V4.511l4.257-2.456a.518.518,0,0,0,.233-.408.479.479,0,0,0-.233-.407,6.511,6.511,0,1,0-3.327,12.107,6.582,6.582,0,0,0,6.148-4.374,5.228,5.228,0,0,0,.333-1.542A.461.461,0,0,0,23.182,6.923Z"></path><path d="M9.73,10.418,7.376,12.883c-.01.01-.021.016-.03.025L1.158,19.1a2.682,2.682,0,1,0,3.793,3.793l4.583-4.582,0,0,4.1-4.005-.037-.037A9.094,9.094,0,0,1,9.73,10.418ZM3.053,21.888A.894.894,0,1,1,3.946,21,.893.893,0,0,1,3.053,21.888Z"></path></g></g>
</svg>
</button>
`);
let ContentDiv = document.getElementById('content');
ContentDiv!.append(SettingsButton.firstChild!);
}