Reset the board before loading a game

This commit is contained in:
Nick Chambers 2021-01-10 17:44:18 -06:00
parent 575c2c9b63
commit a465cde80d
1 changed files with 15 additions and 0 deletions

View File

@ -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 = "";
});
</script>
</body>