+ if (this.game.fenStart) this.re_setVariables();
+ },
+ mounted: function() {
+ [
+ document.getElementById("eogDiv"),
+ document.getElementById("adjuster")
+ ].forEach(elt => elt.addEventListener("click", processModalClick));
+ // Take full width on small screens:
+ let boardSize = parseInt(localStorage.getItem("boardSize"));
+ if (!boardSize) {
+ boardSize =
+ window.innerWidth >= 768
+ ? 0.75 * Math.min(window.innerWidth, window.innerHeight)
+ : window.innerWidth;
+ }
+ const movesWidth = window.innerWidth >= 768 ? 280 : 0;
+ document.getElementById("boardContainer").style.width = boardSize + "px";
+ let gameContainer = document.getElementById("gameContainer");
+ gameContainer.style.width = boardSize + movesWidth + "px";
+ document.getElementById("boardSize").value =
+ (boardSize * 100) / (window.innerWidth - movesWidth);
+ // timeout to avoid calling too many time the adjust method
+ let timeoutLaunched = false;
+ window.addEventListener("resize", () => {
+ if (!timeoutLaunched) {
+ timeoutLaunched = true;
+ setTimeout(() => {
+ this.adjustBoard();
+ timeoutLaunched = false;
+ }, 500);
+ }
+ });