| {{ st.tr["Analysis mode"] }}
.row
.col-sm-12.col-md-8.col-md-offset-2.col-lg-6.col-lg-offset-3
+ h4#variantName {{ gameInfo.vname }}
div(
v-show="display=='rules'"
v-html="content"
<script>
import ComputerGame from "@/components/ComputerGame.vue";
import { store } from "@/store";
-import { getDiagram } from "@/utils/printDiagram";
+import { replaceByDiag } from "@/utils/printDiagram";
import { CompgameStorage } from "@/utils/compgameStorage";
export default {
name: "my-rules",
},
computed: {
showAnalyzeBtn: function() {
- return this.V && this.V.CanAnalyze;
+ return !!this.V && this.V.CanAnalyze;
},
content: function() {
if (!this.gameInfo.vname) return ""; //variant not set yet
.replace(/\\"/g, '"')
.replace('module.exports = "', "")
.replace(/"$/, "")
- .replace(/(fen:)([^:]*):/g, this.replaceByDiag)
+ .replace(/(fen:)([^:]*):/g, replaceByDiag)
);
}
},
if (this.display != "rules") this.display = "rules";
else if (this.gameInProgress) this.display = "computer";
},
- parseFen(fen) {
- const fenParts = fen.split(" ");
- return {
- position: fenParts[0],
- marks: fenParts[1],
- orientation: fenParts[2],
- shadow: fenParts[3]
- };
- },
- // Method to replace diagrams in loaded HTML
- replaceByDiag: function(match, p1, p2) {
- const args = this.parseFen(p2);
- return getDiagram(args);
- },
re_setVariant: async function(vname) {
await import("@/variants/" + vname + ".js")
.then((vModule) => {
<!-- NOTE: not scoped here, because HTML is injected (TODO) -->
<style lang="sass">
-.warn
- padding: 3px
- color: red
- background-color: lightgrey
+h4#variantName
+ text-align: center
font-weight: bold
figure.diagram-container
ul:not(.browser-default) > li
list-style-type: disc
+
+table
+ margin: 15px auto
+
+.italic
+ font-style: italic
+
+img.img-center
+ display: block
+ margin: 0 auto 15px auto
</style>