diff --git a/script.js b/script.js index a6ca354..b969815 100644 --- a/script.js +++ b/script.js @@ -29,6 +29,8 @@ async function run() { pageButton.addEventListener('touchend', pagination); } + const gameDataInput = document.getElementById("game-data"); + function new_game() { load_default_game_data(); // we don't need to look at the default game data, so skip ahead to the image page @@ -36,7 +38,7 @@ async function run() { } function clear_game() { - document.getElementById("game-data").innerHTML = ""; + gameDataInput.innerHTML = ""; } let new_game_button = document.getElementById("new"); @@ -61,6 +63,12 @@ async function run() { } } + document.getElementById("game").addEventListener("change", function() { + readFile(this, function (e) { + gameDataInput.innerHTML = e.target.result; + }, "text"); + }); + const preview = document.getElementById("preview"); preview.style.display = "none";