From d32ad0d27d44eb3b11d14f635b2f0ccbfa0e29ce Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sun, 19 Jul 2020 22:02:22 +0100 Subject: [PATCH] fix game data bugs; tidyup --- script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 2529994..2e09d17 100644 --- a/script.js +++ b/script.js @@ -41,7 +41,7 @@ async function run() { } function clear_game() { - gameDataInput.innerHTML = ""; + gameDataInput.value = ""; } let new_game_button = document.getElementById("new"); @@ -96,9 +96,10 @@ async function run() { function addTiles() { let image = document.getElementById("preview").getAttribute("src"); - let gameData = document.getElementById("game-data").innerHTML; + let gameData = document.getElementById("game-data").value; let prefix = document.getElementById("prefix").value; - document.getElementById("output").innerHTML = add_tiles(gameData, image, prefix); + + output.value = add_tiles(gameData, image, prefix); } const importButton = document.getElementById("import"); @@ -116,7 +117,7 @@ async function run() { addImageButton.addEventListener("touchend", addImage); function reset() { - gameDataInput.innerHTML = ''; + clear_game(); preview.removeAttribute("src"); }