1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00
This commit is contained in:
zumbiepig 2024-09-05 15:50:27 -07:00
parent b488fdbe6a
commit 1a1afd4a7c
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE

View File

@ -1,8 +1,8 @@
import { gt, coerce } from 'semver'; import { gt, coerce } from 'semver';
import { inflate, deflate } from 'pako'; import { inflate, deflate } from 'pako';
let selectedVersion: string; let selectedVersion: string | undefined = undefined;
let articleClosing = false; let articleAnimationLock = false;
const theme = { const theme = {
load: function (themeToLoad?: string) { load: function (themeToLoad?: string) {
@ -157,8 +157,13 @@ const article = {
open: function (articleId: string) { open: function (articleId: string) {
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null; const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) { if (modal) {
articleAnimationLock = true;
modal.style.animation = 'article-open 0.5s ease-in-out'; modal.style.animation = 'article-open 0.5s ease-in-out';
modal.style.display = 'flex'; modal.style.display = 'flex';
modal.addEventListener(
'animationend',
() => {
articleAnimationLock = false;
const closeArticleHandler = (event: Event) => { const closeArticleHandler = (event: Event) => {
if (event.target === modal) { if (event.target === modal) {
modal.removeEventListener('click', closeArticleHandler); modal.removeEventListener('click', closeArticleHandler);
@ -166,11 +171,14 @@ const article = {
} }
}; };
modal.addEventListener('click', closeArticleHandler); modal.addEventListener('click', closeArticleHandler);
},
{ once: true }
);
} }
}, },
close: function (articleId: string) { close: function (articleId: string) {
if (!articleClosing) { if (!articleAnimationLock) {
articleClosing = true; articleAnimationLock = true;
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null; const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) { if (modal) {
modal.style.animation = 'article-close 0.5s ease-in-out'; modal.style.animation = 'article-close 0.5s ease-in-out';
@ -178,7 +186,7 @@ const article = {
'animationend', 'animationend',
() => { () => {
modal.style.display = 'none'; modal.style.display = 'none';
articleClosing = false; articleAnimationLock = false;
}, },
{ once: true } { once: true }
); );