mirror of
https://github.com/Coldsmiles/infstarweb.git
synced 2026-04-23 02:30:41 +08:00
feat: Enhance UI setup with error handling and improve modal display logic
This commit is contained in:
@@ -3,9 +3,13 @@ let grandTotal = 0;
|
||||
let filterState = { search: '', project: 'all' };
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
try {
|
||||
setupUI();
|
||||
} catch (e) {
|
||||
console.error("UI Setup failed", e);
|
||||
}
|
||||
fetchSponsorsData();
|
||||
setupListeners();
|
||||
setupUI();
|
||||
});
|
||||
|
||||
function setupUI() {
|
||||
@@ -53,12 +57,14 @@ function setupUI() {
|
||||
|
||||
if (modal && btn) {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.preventDefault(); // Prevent accidental form submission
|
||||
e.preventDefault();
|
||||
modal.style.display = "flex";
|
||||
// Trigger reflow
|
||||
void modal.offsetWidth;
|
||||
requestAnimationFrame(() => {
|
||||
modal.classList.add('show');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (span && modal) {
|
||||
|
||||
Reference in New Issue
Block a user