Some fixes, work on Eightpieces draft, add a few capturing variants
[vchess.git] / client / src / views / Hall.vue
index 14ea54f..d59946f 100644 (file)
@@ -66,13 +66,20 @@ main
             option(value="1") {{ st.tr["Symmetric random"] }}
             option(value="2") {{ st.tr["Asymmetric random"] }}
         fieldset
-          label(for="memorizeChall") {{ st.tr["Memorize?"] }}
+          label(for="memorizeChall") {{ st.tr["Memorize"] }}
           input#memorizeChall(
             type="checkbox"
             v-model="newchallenge.memorize"
           )
         fieldset(v-if="st.user.id > 0")
-          label(for="selectPlayers") {{ st.tr["Play with?"] }}
+          label(for="selectPlayers") {{ st.tr["Play with"] }}
+          select#selectPlayersInList(v-model="newchallenge.to")
+            option(value="")
+            option(
+              v-for="p in Object.values(people)"
+              :value="p.name"
+            )
+              | {{ p.name }}
           input#selectPlayers(
             type="text"
             v-model="newchallenge.to"
@@ -220,7 +227,10 @@ export default {
         vid: parseInt(localStorage.getItem("vid")) || 0,
         to: "", //name of challenged player (if any)
         cadence: localStorage.getItem("cadence") || "",
-        randomness: parseInt(localStorage.getItem("randomness")) || 2,
+        randomness:
+          parseInt(localStorage.getItem("challRandomness")) ||
+          // Default to global randomness if no challenges issued yet:
+          this.st.settings.randomness,
         // VariantRules object, stored to not interfere with
         // diagrams of targetted challenges:
         V: null,
@@ -374,8 +384,8 @@ export default {
   mounted: function() {
     document.addEventListener('visibilitychange', this.visibilityChange);
     ["peopleWrap", "infoDiv", "newgameDiv"].forEach(eltName => {
-      let elt = document.getElementById(eltName);
-      elt.addEventListener("click", processModalClick);
+      document.getElementById(eltName)
+        .addEventListener("click", processModalClick);
     });
     document.querySelectorAll("#predefinedCadences > button").forEach(b => {
       b.addEventListener("click", () => {
@@ -838,8 +848,7 @@ export default {
       const vModule = await import("@/variants/" + vname + ".js");
       this.newchallenge.V = vModule.VariantRules;
       this.newchallenge.vname = vname;
-      if (!!cb)
-        cb();
+      if (!!cb) cb();
     },
     trySetNewchallDiag: function() {
       if (!this.newchallenge.fen) {
@@ -865,7 +874,7 @@ export default {
       this.newchallenge.vid = pchall.vid;
       this.newchallenge.cadence = pchall.cadence;
       this.newchallenge.randomness = pchall.randomness;
-      this.issueNewChallenge();
+      this.loadNewchallVariant(this.issueNewChallenge);
     },
     issueNewChallenge: async function() {
       if (!!(this.newchallenge.cadence.match(/^[0-9]+$/)))
@@ -963,7 +972,7 @@ export default {
         // Remember cadence  + vid for quicker further challenges:
         localStorage.setItem("cadence", chall.cadence);
         localStorage.setItem("vid", chall.vid);
-        localStorage.setItem("randomness", chall.randomness);
+        localStorage.setItem("challRandomness", chall.randomness);
         document.getElementById("modalNewgame").checked = false;
         // Show the challenge if not on current display
         if (
@@ -1265,6 +1274,10 @@ tr > td
   &.random-2
     background-color: #33B42B
 
+@media screen and (max-width: 767px)
+  h4
+    margin: 5px 0
+
 td.remove-preset
   background-color: lightgrey
   text-align: center