1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 08:14: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 { inflate, deflate } from 'pako';
let selectedVersion: string;
let articleClosing = false;
let selectedVersion: string | undefined = undefined;
let articleAnimationLock = false;
const theme = {
load: function (themeToLoad?: string) {
@ -157,20 +157,28 @@ const article = {
open: function (articleId: string) {
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) {
articleAnimationLock = true;
modal.style.animation = 'article-open 0.5s ease-in-out';
modal.style.display = 'flex';
const closeArticleHandler = (event: Event) => {
if (event.target === modal) {
modal.removeEventListener('click', closeArticleHandler);
article.close(articleId);
}
};
modal.addEventListener('click', closeArticleHandler);
modal.addEventListener(
'animationend',
() => {
articleAnimationLock = false;
const closeArticleHandler = (event: Event) => {
if (event.target === modal) {
modal.removeEventListener('click', closeArticleHandler);
article.close(articleId);
}
};
modal.addEventListener('click', closeArticleHandler);
},
{ once: true }
);
}
},
close: function (articleId: string) {
if (!articleClosing) {
articleClosing = true;
if (!articleAnimationLock) {
articleAnimationLock = true;
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) {
modal.style.animation = 'article-close 0.5s ease-in-out';
@ -178,7 +186,7 @@ const article = {
'animationend',
() => {
modal.style.display = 'none';
articleClosing = false;
articleAnimationLock = false;
},
{ once: true }
);