Experimental change: options replacing randomness (more general)
[vchess.git] / client / src / views / Analyse.vue
index bc88c75..5c525a3 100644 (file)
@@ -7,7 +7,8 @@ main
   )
     .card
       label.modal-close(for="modalRules")
-      h4#variantNameInAnalyze(@click="gotoRules()") {{ game.vname }}
+      a#variantNameInAnalyze(:href="'/#/variants/'+game.vname")
+        | {{ game.vname }}
       div(v-html="rulesContent")
   .row
     .col-sm-12
@@ -28,6 +29,7 @@ import BaseGame from "@/components/BaseGame.vue";
 import { processModalClick } from "@/utils/modalClick";
 import { replaceByDiag } from "@/utils/printDiagram";
 import { store } from "@/store";
+import afterRawLoad from "@/utils/afterRawLoad";
 export default {
   name: "my-analyse",
   // TODO: game import ==> require some adjustments, like
@@ -42,7 +44,8 @@ export default {
       rulesContent: "",
       gameRef: {
         vname: "",
-        fen: ""
+        fen: "",
+        options: {}
       },
       game: {
         players: [{ name: "Analyse" }, { name: "Analyse" }],
@@ -97,22 +100,14 @@ export default {
           this.alertAndQuit("Analysis disabled for this variant");
         else this.loadGame(orientation);
       })
-      .catch((err) => { this.alertAndQuit("Mispelled variant name", true); });
+      //.catch((err) => { this.alertAndQuit("Mispelled variant name", true); });
       this.rulesContent =
-        require(
-          "raw-loader!@/translations/rules/" +
-          this.gameRef.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);
-    },
-    gotoRules: function() {
-      this.$router.push("/variants/" + this.gameRef.vname);
+        afterRawLoad(
+          require(
+            "raw-loader!@/translations/rules/" +
+            this.gameRef.vname + "/" + this.st.lang + ".pug"
+          ).default
+        ).replace(/(fen:)([^:]*):/g, replaceByDiag);
     },
     loadGame: function(orientation) {
       this.game.vname = this.gameRef.vname;
@@ -149,11 +144,13 @@ export default {
 </style>
 
 <style lang="sass" scoped>
-h4#variantNameInAnalyze
-  cursor: pointer
+a#variantNameInAnalyze
+  color: var(--card-fore-color)
   text-align: center
-  text-decoration: underline
   font-weight: bold
+  font-size: calc(1rem * var(--heading-ratio))
+  line-height: 1.2
+  margin: calc(1.5 * var(--universal-margin))
 
 #rulesDiv > .card
   padding: 5px 0