3 input#modalSettings.modal(type="checkbox")
6 data-checkbox="modalSettings"
9 label.modal-close(for="modalSettings")
16 fieldset(@change="setLanguage($event)")
17 label(for="langSelect")
18 | {{ st.tr["Language"] }}
20 each language,langCode in langName
21 option(value=langCode)
28 div(@change="updateSettings($event)")
30 label(for="setHints") {{ st.tr["Show possible moves"] }}
33 v-model="st.settings.hints"
36 label(for="setHighlight")
37 | {{ st.tr["Highlight last move"] }}
40 v-model="st.settings.highlight"
43 label(for="setBcolor") {{ st.tr["Board colors"] }}
44 select#setBcolor(v-model="st.settings.bcolor")
45 option(value="lichess") {{ st.tr["brown"] }}
46 option(value="chesscom") {{ st.tr["green"] }}
47 option(value="chesstempo") {{ st.tr["blue"] }}
50 | {{ st.tr["Sound alert at game start"] }}
53 v-model="st.settings.sound"
56 label(for="setGotonext")
57 | {{ st.tr["Show next game after a move"] }}
60 v-model="st.settings.gotonext"
63 label(for="setRandomness") {{ st.tr["Randomness"] }}
64 select#setRandomness(v-model="st.settings.randomness")
65 option(value="0") {{ st.tr["Deterministic"] }}
66 option(value="1") {{ st.tr["Symmetric random"] }}
67 option(value="2") {{ st.tr["Asymmetric random"] }}
71 import { store } from "@/store.js";
72 import { processModalClick } from "@/utils/modalClick.js";
81 document.getElementById("settingsDiv")
82 .addEventListener("click", processModalClick);
83 // NOTE: better style would be in pug directly, but how?
84 document.querySelectorAll("#langSelect > option").forEach(opt => {
85 if (opt.value == this.st.lang) opt.selected = true;
89 flagImage: function() {
90 return `/images/flags/${this.st.lang}.svg`;
94 setLanguage: function(e) {
95 localStorage["lang"] = e.target.value;
96 store.setLanguage(e.target.value);
98 updateSettings: function(event) {
99 const propName = event.target.id
101 .replace(/^\w/, c => c.toLowerCase());
102 const value = ["bcolor","randomness"].includes(propName)
104 : event.target.checked;
105 store.updateSetting(propName, value);
111 <style lang="sass" scoped>
112 [type="checkbox"].modal+div .card
116 display: inline-block
119 vertical-align: middle