From a465cde80d1c0c29e3cb701d37d840c3886a842b Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sun, 10 Jan 2021 17:44:18 -0600 Subject: [PATCH] Reset the board before loading a game --- takhta.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/takhta.html b/takhta.html index 5da50b7..1dff4b3 100644 --- a/takhta.html +++ b/takhta.html @@ -806,6 +806,17 @@ let moveFile = event.target; if(moveFile.error === null) { + // reset the board + undoAll(); + moveFuture = []; + + let moveList = document.getElementById("movelist"); + + while(moveList.firstChild) { + moveList.removeChild(moveList.firstChild); + } + + // parse the file let rows = moveFile.result.split("\n"); for(let row of rows) { @@ -827,6 +838,10 @@ }); reader.readAsText(file); + + // clear the upload button + let hiddenLink = document.getElementById("moveupload"); + hiddenLink.value = ""; });