modified: script.js

This commit is contained in:
SimolZimol
2025-12-11 22:34:10 +01:00
parent fd2456d507
commit 412b1f45ac

View File

@@ -548,25 +548,19 @@ class MinecraftChatParser {
}
const mapInfo = this.currentChatInfo.mapDownload;
const mapUrl = `./maps/${mapInfo.filename}`;
// Nutze mapInfo.url, falls vorhanden, sonst lokalen Pfad
const mapUrl = mapInfo.url ? mapInfo.url : `./maps/${mapInfo.filename}`;
const downloadName = mapInfo.url ? mapInfo.url.split('/').pop() : mapInfo.filename;
// Create temporary download link
const downloadLink = document.createElement('a');
downloadLink.href = mapUrl;
downloadLink.download = mapInfo.filename;
downloadLink.download = downloadName;
downloadLink.style.display = 'none';
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
// Show feedback
const originalText = this.downloadMap.innerHTML;
this.downloadMap.innerHTML = '⬇️ Downloading...';
setTimeout(() => {
this.downloadMap.innerHTML = originalText;
}, 2000);
}
}