mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
fix: spam clicking outside a popup restarts closing animation, and remove multiple close popup functions
This commit is contained in:
+26
-12
@@ -4,22 +4,36 @@ import stringToHTML from "./stringToHTML";
|
||||
import browser from "webextension-polyfill";
|
||||
import kofi from "@/resources/kofi.png?base64";
|
||||
|
||||
export async function DeleteWhatsNew() {
|
||||
const bkelement = document.getElementById("whatsnewbk");
|
||||
const popup = document.getElementsByClassName("whatsnewContainer")[0];
|
||||
let isClosing = false;
|
||||
|
||||
if (!settingsState.animations) {
|
||||
bkelement?.remove();
|
||||
export async function DeleteWhatsNew() {
|
||||
if (isClosing) return;
|
||||
isClosing = true;
|
||||
|
||||
const bkelement = document.getElementById("whatsnewbk");
|
||||
const popup = document.getElementsByClassName(
|
||||
"whatsnewContainer",
|
||||
)[0] as HTMLElement;
|
||||
|
||||
if (!bkelement || !popup) {
|
||||
isClosing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
animate(
|
||||
[popup, bkelement!],
|
||||
{ opacity: [1, 0], scale: [1, 0] },
|
||||
{ ease: [0.22, 0.03, 0.26, 1] },
|
||||
).then(() => {
|
||||
bkelement?.remove();
|
||||
});
|
||||
if (!settingsState.animations) {
|
||||
bkelement.remove();
|
||||
isClosing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
await animate(
|
||||
[popup, bkelement as HTMLElement],
|
||||
{ opacity: [1, 0], scale: [1, 0.95] } as any,
|
||||
{ duration: 0.25, ease: [0.22, 0.03, 0.26, 1] },
|
||||
);
|
||||
|
||||
bkelement.remove();
|
||||
isClosing = false;
|
||||
}
|
||||
|
||||
export function OpenWhatsNewPopup() {
|
||||
|
||||
Reference in New Issue
Block a user