- localStorage[propName] = ["highlight","coords"].includes(propName)
- ? event.target.checked
- : event.target.value;
- },
- adjustBoard: function() {
- const boardContainer = document.getElementById("boardContainer");
- if (!boardContainer)
- return; //no board on page
- const k = document.getElementById("myRange").value;
- const movesWidth = 280; //TODO: constant somewhere...;
- const minBoardWidth = 240; //TODO: same
- // Value of 0 is board min size; 100 is screen.width - movesWidth
- const boardSize = k * (screen.width - (movesWidth+minBoardWidth)) / 100 + minBoardWidth;
- localStorage.setItem("boardSize", boardSize);
- boardContainer.style.width = boardSize + "px";
- document.getElementById("gameContainer").style.width = (boardSize + movesWidth) + "px";
+ let value = (["bcolor","sound"].includes(propName)
+ ? event.target.value
+ : event.target.checked);
+ if (propName == "sound")
+ value = parseInt(value);
+ store.updateSetting(propName, value);