feat: improve apis + add animated background and assessment average plugins

This commit is contained in:
SethBurkart123
2025-03-30 13:17:19 +11:00
parent aeaf5d9e59
commit b8d8b108c3
11 changed files with 189 additions and 268 deletions
-4
View File
@@ -21,10 +21,6 @@ export async function main() {
if (settingsState.onoff) {
injectPageState()
if (typeof settingsState.assessmentsAverage == "undefined") {
settingsState.assessmentsAverage = true
}
// TEMP FIX for bug! -> this is a hack to get the injected.css file to have HMR in development mode as this import system is currently broken with crxjs
if (import.meta.env.MODE === "development") {
import("../css/injected.scss")
+12 -1
View File
@@ -5,14 +5,25 @@ export async function waitForElm(
selector: string,
usePolling: boolean = false,
interval: number = 100,
maxIterations?: number
): Promise<Element> {
if (usePolling) {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
let iterations = 0;
if (maxIterations) {
iterations = 0;
}
const checkForElement = () => {
const element = document.querySelector(selector)
if (element) {
resolve(element)
} else {
if (maxIterations) {
iterations++;
if (iterations >= maxIterations) {
reject(new Error("Element not found"));
}
}
setTimeout(checkForElement, interval)
}
}