Fix bug where mod is added even though cancel is pressed

This commit is contained in:
ZXMushroom63 2024-05-05 12:04:57 +08:00 committed by GitHub
parent 5b75a2addb
commit 43e1581482
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -112,6 +112,9 @@ function displayGui() {
addBtn.innerHTML = "Add new"; addBtn.innerHTML = "Add new";
addBtn.addEventListener("click", () => { addBtn.addEventListener("click", () => {
var newMod = window.prompt("URL of Mod: ", "http://example.com/example.js"); var newMod = window.prompt("URL of Mod: ", "http://example.com/example.js");
if (!newMod) {
return; //User pressed cancel
}
Mods.push( Mods.push(
newMod newMod
); );