Experimental change: options replacing randomness (more general)
[vchess.git] / client / src / components / Settings.vue
index a6c3e65..514e704 100644 (file)
@@ -1,7 +1,7 @@
 <template lang="pug">
 div
   input#modalSettings.modal(type="checkbox")
-  div(
+  div#settingsDiv(
     role="dialog"
     data-checkbox="modalSettings"
   )
@@ -27,14 +27,14 @@ div
           )
       div(@change="updateSettings($event)")
         fieldset
-          label(for="setHints") {{ st.tr["Show possible moves?"] }}
+          label(for="setHints") {{ st.tr["Show possible moves"] }}
           input#setHints(
             type="checkbox"
             v-model="st.settings.hints"
           )
         fieldset
           label(for="setHighlight")
-            | {{ st.tr["Highlight last move and checks?"] }}
+            | {{ st.tr["Highlight last move"] }}
           input#setHighlight(
             type="checkbox"
             v-model="st.settings.highlight"
@@ -45,16 +45,26 @@ div
             option(value="lichess") {{ st.tr["brown"] }}
             option(value="chesscom") {{ st.tr["green"] }}
             option(value="chesstempo") {{ st.tr["blue"] }}
+            option(value="orangecc") {{ st.tr["orange"] }}
         fieldset
-          label(for="setSound") {{ st.tr["Play sounds?"] }}
-          select#setSound(v-model="st.settings.sound")
-            option(value="0") {{ st.tr["None"] }}
-            option(value="1") {{ st.tr["New game"] }}
-            option(value="2") {{ st.tr["All"] }}
+          label(for="setSound")
+            | {{ st.tr["Sound alert at game start"] }}
+          input#setSound(
+            type="checkbox"
+            v-model="st.settings.sound"
+          )
+        fieldset
+          label(for="setGotonext")
+            | {{ st.tr["Show next game after a move"] }}
+          input#setGotonext(
+            type="checkbox"
+            v-model="st.settings.gotonext"
+          )
 </template>
 
 <script>
 import { store } from "@/store.js";
+import { processModalClick } from "@/utils/modalClick.js";
 export default {
   name: "my-settings",
   data: function() {
@@ -63,6 +73,8 @@ export default {
     };
   },
   mounted: function() {
+    document.getElementById("settingsDiv")
+      .addEventListener("click", processModalClick);
     // NOTE: better style would be in pug directly, but how?
     document.querySelectorAll("#langSelect > option").forEach(opt => {
       if (opt.value == this.st.lang) opt.selected = true;
@@ -82,10 +94,9 @@ export default {
       const propName = event.target.id
         .substr(3)
         .replace(/^\w/, c => c.toLowerCase());
-      let value = ["bcolor", "sound"].includes(propName)
+      const value = propName == "bcolor"
         ? event.target.value
         : event.target.checked;
-      if (propName == "sound") value = parseInt(value);
       store.updateSetting(propName, value);
     }
   }
@@ -94,7 +105,7 @@ export default {
 
 <style lang="sass" scoped>
 [type="checkbox"].modal+div .card
-  max-width: 767px
+  max-width: 520px
   max-height: 100%
 #flagContainer
   display: inline-block