- name: 'my-move-list',
- props: ["moves","cursor","score","message","firstNum"],
+ name: "my-move-list",
+ props: ["moves", "show", "cursor", "score", "message", "firstNum"],
+ data: function() {
+ return {
+ st: store.state
+ };
+ },
+ mounted: function() {
+ document.getElementById("adjuster").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);
+ }
+ });
+ },