Reset the board before loading a game
This commit is contained in:
parent
575c2c9b63
commit
a465cde80d
15
takhta.html
15
takhta.html
|
@ -806,6 +806,17 @@
|
||||||
let moveFile = event.target;
|
let moveFile = event.target;
|
||||||
|
|
||||||
if(moveFile.error === null) {
|
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");
|
let rows = moveFile.result.split("\n");
|
||||||
|
|
||||||
for(let row of rows) {
|
for(let row of rows) {
|
||||||
|
@ -827,6 +838,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
|
|
||||||
|
// clear the upload button
|
||||||
|
let hiddenLink = document.getElementById("moveupload");
|
||||||
|
hiddenLink.value = "";
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue