2048.html
changeset 95 804e751a3b7f
parent 94 8bbd7570f437
child 96 a9a6e08c9e35
--- 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);