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 and checks?"] }}
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 when game starts?"] }}
53 v-model="st.settings.sound"
58 import { store } from "@/store.js";
67 // NOTE: better style would be in pug directly, but how?
68 document.querySelectorAll("#langSelect > option").forEach(opt => {
69 if (opt.value == this.st.lang) opt.selected = true;
73 flagImage: function() {
74 return `/images/flags/${this.st.lang}.svg`;
78 setLanguage: function(e) {
79 localStorage["lang"] = e.target.value;
80 store.setLanguage(e.target.value);
82 updateSettings: function(event) {
83 const propName = event.target.id
85 .replace(/^\w/, c => c.toLowerCase());
86 const value = propName == "bcolor"
88 : event.target.checked;
89 store.updateSetting(propName, value);
95 <style lang="sass" scoped>
96 [type="checkbox"].modal+div .card
100 display: inline-block
103 vertical-align: middle