# HG changeset patch # User Oleksandr Gavenko # Date 1411163505 -10800 # Node ID 804e751a3b7f4ff565b61b9750213f5288314d09 # Parent 8bbd7570f4373d5691e3ea7d40ec931b5cd1fe87 Save and restore continuation limits. diff -r 8bbd7570f437 -r 804e751a3b7f 2048.html --- a/2048.html Sat Sep 20 00:44:00 2014 +0300 +++ b/2048.html Sat Sep 20 00:51:45 2014 +0300 @@ -641,6 +641,8 @@ maxValLimit = 1; document.getElementById("until-max-value").value = maxValLimit; } + localStorage.untilScore = scoreLimit; + localStorage.untilMaxVal = maxValLimit; while (true) { if (board.gameOver(ui.board.position)) { ui.game.setMessage("Game over!"); @@ -894,6 +896,17 @@ ui.brdEngine = BoardArr2d; // TODO make user selectable + if (localStorage.untilScore) { + var scoreLimit = parseInt(localStorage.untilScore); + if (isFinite(scoreLimit) && scoreLimit > 0) + document.getElementById("until-score").value = scoreLimit; + } + if (localStorage.untilMaxVal) { + var maxValLimit = parseInt(localStorage.untilMaxVal); + if (isFinite(maxValLimit) && maxValLimit > 0 && maxValLimit <= 13) + document.getElementById("until-max-value").value = maxValLimit; + } + if (localStorage.val2048) { try { ui.board.val2048Dom.checked = JSON.parse(localStorage.val2048);