From 7f2a0cd88404e8ca2c51065521cbf0137967dd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Mon, 11 Jan 2021 01:11:38 +0200 Subject: [PATCH] Add undo/redo all buttons for fast history traversal --- takhta.html | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/takhta.html b/takhta.html index 811712a..e1b797a 100644 --- a/takhta.html +++ b/takhta.html @@ -211,11 +211,19 @@ -

+

+

+ + + +

+

+

+

-

+

@@ -650,6 +658,20 @@ return true; } + function undoAll() { + while (moveHistory.length > 0) { + undoMove(); + } + } + + function redoAll() { + while (moveFuture.length > 0) { + if (!redoMove()) { + break; + } + } + } + function flipBoard() { let oldBoard = document.getElementById('board').firstElementChild;