Improve script UI

This commit is contained in:
2026-01-10 02:07:03 +01:00
parent 6cba63d025
commit 2d5c21e7aa
4 changed files with 102 additions and 40 deletions

View File

@@ -110,9 +110,9 @@ export function createAdminConsole({
handleFileSelection(event.target);
});
}
const customAssetButton = document.getElementById("custom-asset-button");
if (customAssetButton && customAssetModal?.openLauncher) {
customAssetButton.addEventListener("click", () => customAssetModal.openLauncher());
const assetLauncherButton = document.getElementById("asset-launcher-button");
if (assetLauncherButton && customAssetModal?.openLauncher) {
assetLauncherButton.addEventListener("click", () => customAssetModal.openLauncher());
}
globalThis.addEventListener("resize", () => {
resizeCanvas();

View File

@@ -7,6 +7,7 @@ export function createCustomAssetModal({
const launchModal = document.getElementById("custom-asset-launch-modal");
const launchNewButton = document.getElementById("custom-asset-launch-new");
const launchMarketplaceButton = document.getElementById("custom-asset-launch-marketplace");
const assetFileInput = document.getElementById("asset-file");
const marketplaceModal = document.getElementById("custom-asset-marketplace-modal");
const marketplaceCloseButton = document.getElementById("custom-asset-marketplace-close");
const marketplaceSearchInput = document.getElementById("custom-asset-marketplace-search");
@@ -234,6 +235,13 @@ export function createCustomAssetModal({
if (launchMarketplaceButton) {
launchMarketplaceButton.addEventListener("click", () => openMarketplaceModal());
}
if (assetFileInput) {
assetFileInput.addEventListener("change", (event) => {
if (event.target?.files?.length) {
closeLaunchModal();
}
});
}
if (marketplaceModal) {
marketplaceModal.addEventListener("click", (event) => {
if (event.target === marketplaceModal) {