start modularisation and breaking down the monofile

This commit is contained in:
Alphons Joseph
2025-03-12 21:45:23 +08:00
parent 3c65e6d6c5
commit c9f0f9cf16
25 changed files with 2284 additions and 2192 deletions
+33
View File
@@ -0,0 +1,33 @@
import { closeExtensionPopup, SettingsClicked, changeSettingsClicked } from "./Closers/closeExtensionPopup"
import { animate } from "motion"
import { settingsState } from "./listeners/SettingsState"
export function setupSettingsButton() {
var AddedSettings = document.getElementById("AddedSettings")
var extensionPopup = document.getElementById("ExtensionPopup")
AddedSettings!.addEventListener("click", async () => {
if (SettingsClicked) {
closeExtensionPopup(extensionPopup as HTMLElement)
} else {
if (settingsState.animations) {
animate(0, 1, {
onUpdate: (progress) => {
extensionPopup!.style.opacity = progress.toString()
extensionPopup!.style.transform = `scale(${progress})`
},
type: "spring",
stiffness: 280,
damping: 20,
})
} else {
extensionPopup!.style.opacity = "1"
extensionPopup!.style.transform = "scale(1)"
extensionPopup!.style.transition =
"opacity 0s linear, transform 0s linear"
}
extensionPopup!.classList.remove("hide")
changeSettingsClicked(true)
}
})
}