X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=d76ab0117d828a3722ac2568b409f9c0c6aaf372;hb=32cfcea44bf00b0c6c4d172cca715823076ff490;hp=c7ec715af2d6e5e526ac184765477a1c7a5ecddb;hpb=130db3eff9afbf58b30287d06f3a2360fe652e97;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index c7ec715a..d76ab011 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -20,11 +20,12 @@ Vue.component('my-game', { hints: (getCookie("hints") === "1" ? true : false), color: getCookie("color", "lichess"), //lichess, chesscom or chesstempo // sound level: 0 = no sound, 1 = sound only on newgame, 2 = always - sound: getCookie("sound", "2"), + sound: parseInt(getCookie("sound", "2")), }; }, render(h) { const [sizeX,sizeY] = VariantRules.size; + console.log(sizeX + " " + sizeY); const smallScreen = (screen.width <= 420); // Precompute hints squares to facilitate rendering let hintSquares = doubleArray(sizeX, sizeY, false); @@ -92,7 +93,7 @@ Vue.component('my-game', { const settingsBtnElt = document.getElementById("settingsBtn"); const indicWidth = !!settingsBtnElt //-2 for border: ? parseFloat(window.getComputedStyle(settingsBtnElt).height.slice(0,-2)) - 2 - : 37; //TODO: always 37? + : (smallScreen ? 31 : 37); if (this.mode == "human") { let connectedIndic = h( @@ -140,8 +141,8 @@ Vue.component('my-game', { "tooltip": true, "topindicator": true, "indic-right": true, - "settings-btn": true, - "small": smallScreen, + "settings-btn": !smallScreen, + "settings-btn-small": smallScreen, }, }, [h('i', { 'class': { "material-icons": true } }, "settings")] @@ -660,6 +661,7 @@ Vue.component('my-game', { "value": "0", innerHTML: "None" }, + attrs: { "selected": this.sound==0 }, } ), h("option", @@ -668,6 +670,7 @@ Vue.component('my-game', { "value": "1", innerHTML: "Newgame" }, + attrs: { "selected": this.sound==1 }, } ), h("option", @@ -676,6 +679,7 @@ Vue.component('my-game', { "value": "2", innerHTML: "All" }, + attrs: { "selected": this.sound==2 }, } ), ], @@ -700,7 +704,10 @@ Vue.component('my-game', { { elementArray.push( h('div', - { attrs: { id: "pgn-div" } }, + { + attrs: { id: "pgn-div" }, + "class": { "section-content": true }, + }, [ h('a', { @@ -713,10 +720,16 @@ Vue.component('my-game', { h('p', { attrs: { id: "pgn-game" }, - on: { click: this.download }, domProps: { innerHTML: this.pgnTxt } } - ) + ), + h('button', + { + attrs: { "id": "downloadBtn" }, + on: { click: this.download }, + domProps: { innerHTML: "Download game" }, + } + ), ] ) ); @@ -726,7 +739,10 @@ Vue.component('my-game', { // Show current FEN elementArray.push( h('div', - { attrs: { id: "fen-div" } }, + { + attrs: { id: "fen-div" }, + "class": { "section-content": true }, + }, [ h('p', {