# HG changeset patch # User Oleksandr Gavenko # Date 1410370909 -10800 # Node ID 8b1577211149f09e8952701a590a9b9c0bd7b23b # Parent 716508d5494c8b2846fe9909c94062e944c052e9 Save val2048 preference. diff -r 716508d5494c -r 8b1577211149 2048.html --- a/2048.html Wed Sep 10 20:27:57 2014 +0300 +++ b/2048.html Wed Sep 10 20:41:49 2014 +0300 @@ -236,6 +236,7 @@ ui.board.val2048Dom = document.getElementById('2048'); ui.board.val2048Dom.addEventListener("click", function(event) { ui.board.update(board.current); + localStorage.val2048 = ui.board.val2048Dom.checked; event.target.blur(); }); ui.board.val2048 = function(val) { @@ -586,6 +587,11 @@ ui.brdEngine = BoardArr2d; // TODO make user selectable + if (localStorage.val2048) { + try { + ui.board.val2048Dom.checked = JSON.parse(localStorage.val2048); + } catch (ex) { } + } if (localStorage.savedBoard) { try { board.current = JSON.parse(localStorage.savedBoard);