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"] }}
48 option(value="orangecc") {{ st.tr["orange"] }}
51 | {{ st.tr["Sound alert at game start"] }}
54 v-model="st.settings.sound"
57 label(for="setGotonext")
58 | {{ st.tr["Show next game after a move"] }}
61 v-model="st.settings.gotonext"
63 fieldset(v-if="desktopBrowser")
64 label(for="setScrollmove")
65 | {{ st.tr["Mouse scroll to replay moves"] }}
68 v-model="st.settings.scrollmove"
73 import { store } from "@/store.js";
74 import { processModalClick } from "@/utils/modalClick.js";
83 document.getElementById("settingsDiv")
84 .addEventListener("click", processModalClick);
85 // NOTE: better style would be in pug directly, but how?
86 document.querySelectorAll("#langSelect > option").forEach(opt => {
87 if (opt.value == this.st.lang) opt.selected = true;
91 flagImage: function() {
92 return `/images/flags/${this.st.lang}.svg`;
94 desktopBrowser: function() {
95 return !("ontouchstart" in window);
99 setLanguage: function(e) {
100 localStorage["lang"] = e.target.value;
101 store.setLanguage(e.target.value);
103 updateSettings: function(event) {
104 const propName = event.target.id
106 .replace(/^\w/, c => c.toLowerCase());
107 const value = propName == "bcolor"
109 : event.target.checked;
110 store.updateSetting(propName, value);
116 <style lang="sass" scoped>
117 [type="checkbox"].modal+div .card
121 display: inline-block
124 vertical-align: middle