X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FRules.vue;h=c069eb29b073451c2f195354dce7a75dd37a2281;hb=b376589752ce154efbd6999f39ab09bb95ab2380;hp=09fe2e196604ca4460b099e822ad5d591ed91faf;hpb=ba65b8def2a0f3b187babaeed39fec0df55999f7;p=vchess.git diff --git a/client/src/views/Rules.vue b/client/src/views/Rules.vue index 09fe2e19..c069eb29 100644 --- a/client/src/views/Rules.vue +++ b/client/src/views/Rules.vue @@ -44,6 +44,7 @@ import ComputerGame from "@/components/ComputerGame.vue"; import { store } from "@/store"; import { replaceByDiag } from "@/utils/printDiagram"; import { CompgameStorage } from "@/utils/compgameStorage"; +import afterRawLoad from "@/utils/afterRawLoad"; export default { name: "my-rules", components: { @@ -77,19 +78,13 @@ export default { }, content: function() { if (!this.gameInfo.vname) return ""; //variant not set yet - // (AJAX) Request to get rules content (plain text, HTML) return ( - require( - "raw-loader!@/translations/rules/" + - this.gameInfo.vname + "/" + - this.st.lang + ".pug" - ) - // Next two lines fix a weird issue after last update (2019-11) - .replace(/\\n/g, " ") - .replace(/\\"/g, '"') - .replace('module.exports = "', "") - .replace(/"$/, "") - .replace(/(fen:)([^:]*):/g, replaceByDiag) + afterRawLoad( + require( + "raw-loader!@/translations/rules/" + + this.gameInfo.vname + "/" + this.st.lang + ".pug" + ).default + ).replace(/(fen:)([^:]*):/g, replaceByDiag) ); } }, @@ -125,12 +120,16 @@ export default { this.gameInfo.mode = mode; if (this.gameInfo.mode == "versus") { CompgameStorage.get(this.gameInfo.vname, (game) => { - // NOTE: game might be null + // NOTE: game might be null (if none stored yet) + if (!!game && !V.IsGoodFen(game.fen)) { + // Some issues with stored game: delete + CompgameStorage.remove(game.vname); + game = null; + } this.$refs["compgame"].launchGame(game); }); - } else { - this.$refs["compgame"].launchGame(); } + else this.$refs["compgame"].launchGame(); }, // The user wants to stop the game: stopGame: function() {