1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-26 10:05:10 +00:00

make it so ppl who spam buttons dont make articles glitch out

This commit is contained in:
zumbiepig
2024-09-05 15:40:20 -07:00
parent f9b5774caf
commit 5dcf64d255
3 changed files with 32 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ import { gt, coerce } from 'semver';
import { inflate, deflate } from 'pako';
let selectedVersion: string;
let articleClosing = false;
const theme = {
load: function (themeToLoad?: string) {
@@ -156,15 +157,32 @@ const article = {
open: function (articleId: string) {
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) {
modal.style.animation = 'openArticle 0.5s ease-in-out';
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);
}
},
close: function (articleId: string) {
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) {
modal.style.animation = 'closeArticle 0.5s ease-in-out';
modal.addEventListener('animationend', () => (modal.style.display = 'none'), { once: true });
if (!articleClosing) {
articleClosing = true;
const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null;
if (modal) {
modal.style.animation = 'article-close 0.5s ease-in-out';
modal.addEventListener(
'animationend',
() => {
modal.style.display = 'none';
articleClosing = false;
},
{ once: true }
);
}
}
},
};