X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=49db618860ff549af1a72f52e7eb88d21cdd3596;hb=7931e479adf93c87771ded1892a0873af72ae46d;hp=deccd5da0c6bd5686b914ad8f614682c157bf9db;hpb=15c1295af871a5f416b0e5b43127512c8095497a;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index deccd5da..49db6188 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -24,7 +24,7 @@ Vue.component('my-game', { }; }, render(h) { - const [sizeX,sizeY] = VariantRules.size; + const [sizeX,sizeY] = [V.size.x,V.size.y]; const smallScreen = (window.innerWidth <= 420); // Precompute hints squares to facilitate rendering let hintSquares = doubleArray(sizeX, sizeY, false); @@ -409,7 +409,7 @@ Vue.component('my-game', { }), h('div', { - attrs: { "role": "dialog", "aria-labelledby": "modal-eog" }, + attrs: { "role": "dialog", "aria-labelledby": "eogMessage" }, }, [ h('div', @@ -425,6 +425,7 @@ Vue.component('my-game', { ), h('h3', { + attrs: { "id": "eogMessage" }, "class": { "section": true }, domProps: { innerHTML: eogMessage }, } @@ -445,7 +446,7 @@ Vue.component('my-game', { }), h('div', { - attrs: { "role": "dialog", "aria-labelledby": "modal-newgame" }, + attrs: { "role": "dialog", "aria-labelledby": "newGameTxt" }, }, [ h('div', @@ -461,6 +462,7 @@ Vue.component('my-game', { ), h('h3', { + attrs: { "id": "newGameTxt" }, "class": { "section": true }, domProps: { innerHTML: "New game" }, } @@ -485,7 +487,7 @@ Vue.component('my-game', { }), h('div', { - attrs: { "role": "dialog", "aria-labelledby": "modal-fenedit" }, + attrs: { "role": "dialog", "aria-labelledby": "titleFenedit" }, }, [ h('div', @@ -501,6 +503,7 @@ Vue.component('my-game', { ), h('h3', { + attrs: { "id": "titleFenedit" }, "class": { "section": true }, domProps: { innerHTML: "Position + flags (FEN):" }, } @@ -551,7 +554,7 @@ Vue.component('my-game', { }), h('div', { - attrs: { "role": "dialog", "aria-labelledby": "modal-settings" }, + attrs: { "role": "dialog", "aria-labelledby": "settingsTitle" }, }, [ h('div', @@ -567,6 +570,7 @@ Vue.component('my-game', { ), h('h3', { + attrs: { "id": "settingsTitle" }, "class": { "section": true }, domProps: { innerHTML: "Preferences" }, } @@ -1020,10 +1024,7 @@ Vue.component('my-game', { { const storageVariant = localStorage.getItem("variant"); if (!!storageVariant && storageVariant !== variant) - { - alert("Finish your " + storageVariant + " game first!"); - return; - } + return alert("Finish your " + storageVariant + " game first!"); // Send game request and wait.. localStorage["newgame"] = variant; this.seek = true; @@ -1083,7 +1084,10 @@ Vue.component('my-game', { const compMove = this.vr.getComputerMove(); // (first move) HACK: avoid selecting elements before they appear on page: const delay = Math.max(500-(Date.now()-timeStart), 0); - setTimeout(() => this.play(compMove, "animate"), delay); + setTimeout(() => { + if (this.mode == "computer") //Warning: mode could have changed! + this.play(compMove, "animate") + }, delay); }, // Get the identifier of a HTML table cell from its numeric coordinates o.x,o.y. getSquareId: function(o) {