From c75838d9d5b52d1fbd3e419c5073ef0cfb95f40a Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Tue, 5 Feb 2019 19:32:06 +0100 Subject: [PATCH] Small fix in rules rendering --- client/src/main.js | 8 +--- client/src/rules/Alice/en.pug | 70 ++++++++++++++++----------------- client/src/rules/Baroque/en.pug | 2 +- client/src/views/Rules.vue | 6 ++- 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/client/src/main.js b/client/src/main.js index 28b7f86c..22fe0cd1 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -20,6 +20,7 @@ new Vue({ // }, created: function() { window.doClick = (elemId) => { document.getElementById(elemId).click() }; + store.initialize(); // TODO: AJAX call get corr games (all variants) // si dernier lastMove sur serveur n'est pas le mien et nextColor == moi, alors background orange @@ -34,13 +35,6 @@ new Vue({ // if (!!localStorage["variant"]) // location.hash = "#game?id=" + localStorage["gameId"]; }, - // Later, for icons (if using feather): -// mounted: function() { -// feather.replace(); -// }, - created: function() { - store.initialize(); - }, }).$mount("#app"); // TODO: get rules, dynamic import diff --git a/client/src/rules/Alice/en.pug b/client/src/rules/Alice/en.pug index 8f5dc3dc..5ef85f6e 100644 --- a/client/src/rules/Alice/en.pug +++ b/client/src/rules/Alice/en.pug @@ -1,53 +1,53 @@ p.boxed. - Every move played ends up on another board (the "other side of the mirror"). - There are two boards. All pieces start on board 1. + Every move played ends up on another board (the "other side of the mirror"). + There are two boards. All pieces start on board 1. p. - Two boards are used in this variant (represented on only one). - Upside-down pieces appear at every "normal" pieces moves: they live on - another board. When moved, they return to the initial board. - Orthodox rules apply on each board. - In addition, the final square should not be occupied by a piece from the - other board (thus allowing to represent all on one board). + Two boards are used in this variant (represented on only one). + Upside-down pieces appear at every "normal" pieces moves: they live on + another board. When moved, they return to the initial board. + Orthodox rules apply on each board. + In addition, the final square should not be occupied by a piece from the + other board (thus allowing to represent all on one board). p Notation for Alice pieces was chosen as follow: ul - li Pawn : S - li Rook : U - li Knight : O - li Bishop : C - li Queen : T - li King : L + li Pawn : S + li Rook : U + li Knight : O + li Bishop : C + li Queen : T + li King : L figure.diagram-container - .diagram - | fen:rnbqkbnr/ppp1pppp/8/8/2p5/5O2/PP1PPPPP/RNBQKB1R: - figcaption After the moves 1.Nf3 Pd5 2.Pc4 Sxc4 + .diagram + | fen:rnbqkbnr/ppp1pppp/8/8/2p5/5O2/PP1PPPPP/RNBQKB1R: + figcaption After the moves 1.Nf3 Pd5 2.Pc4 Sxc4 p. - En-passant and castle occur as they do in the standard game. - More specifically, en-passant is possible regardless of the worlds pawns - are in. This is justified because pawns "go through the mirror" while moving, - and can thus be captured either right after or just before they pass the - mirror. - Castling should be legal according to orthodox rules on the board 1 (it - cannot occur on board 2, because it would mean king and rook moved). - Moreover, the king cannot be in check on board 2 after castling. + En-passant and castle occur as they do in the standard game. + More specifically, en-passant is possible regardless of the worlds pawns + are in. This is justified because pawns "go through the mirror" while moving, + and can thus be captured either right after or just before they pass the + mirror. + Castling should be legal according to orthodox rules on the board 1 (it + cannot occur on board 2, because it would mean king and rook moved). + Moreover, the king cannot be in check on board 2 after castling. h3 End of the game p. - As in the orthodox game, win by checkmating the king. - It shouldn't be able to escape the check, not even by moving to the other - board. + As in the orthodox game, win by checkmating the king. + It shouldn't be able to escape the check, not even by moving to the other + board. h3 More information p - | See the Alice chess pages on - a(href="https://www.chessvariants.com/other.dir/alice.html") - | chessvariants.com - |  and on - a(href="https://www.schemingmind.com/journalarticle.aspx?article_id=9") - | schemingmind.com - | . + | See the Alice chess pages on + a(href="https://www.chessvariants.com/other.dir/alice.html") + | chessvariants.com + |  and on + a(href="https://www.schemingmind.com/journalarticle.aspx?article_id=9") + | schemingmind.com + | . diff --git a/client/src/rules/Baroque/en.pug b/client/src/rules/Baroque/en.pug index fb781641..58a0e4c3 100644 --- a/client/src/rules/Baroque/en.pug +++ b/client/src/rules/Baroque/en.pug @@ -166,7 +166,7 @@ figure.diagram-container h3 More information -p. +p | A good starting point is the a(href="https://en.wikipedia.org/wiki/Baroque_chess") Wikipedia page | , which also gives pointers to other interesting pages (including diff --git a/client/src/views/Rules.vue b/client/src/views/Rules.vue index 1702b509..b9f51279 100644 --- a/client/src/views/Rules.vue +++ b/client/src/views/Rules.vue @@ -10,7 +10,7 @@ button(v-show="gameInProgress" @click="stopGame") | Stop game div(v-show="display=='rules'" v-html="content" class="section-content") - Game(v-show="display=='computer'" :mycolor="mycolor" :gid-or-fen="fen" + Game(v-show="display=='computer'" :gid-or-fen="fen" :mode="mode" :sub-mode="subMode" :variant="variant" @computer-think="gameInProgress=false" @game-over="stopGame") @@ -36,6 +36,7 @@ export default { fen: "", }; }, + // TODO: variant is initialized before store initializes, so remain null (I think) created: function() { const vname = this.$route.params["vname"]; const idxOfVar = this.st.variants.indexOf(e => e.name == vname); @@ -49,7 +50,8 @@ export default { }; // (AJAX) Request to get rules content (plain text, HTML) this.content = - require("raw-loader!pug-plain-loader!@/rules/" + + // TODO: why doesn't this work? require("raw-loader!pug-plain-loader!@/rules/"...) + require("raw-loader!@/rules/" + this.$route.params["vname"] + "/" + this.st.lang + ".pug") .replace(/(fen:)([^:]*):/g, replaceByDiag); }, -- 2.44.0