Commit | Line | Data |
---|---|---|
98db2082 BA |
1 | <template lang="pug"> |
2 | div | |
3 | input#modalSettings.modal(type="checkbox") | |
dcd68c41 BA |
4 | div(role="dialog" data-checkbox="modalSettings" |
5 | aria-labelledby="settingsTitle") | |
98db2082 BA |
6 | .card.smallpad(@change="updateSettings") |
7 | label.modal-close(for="modalSettings") | |
98db2082 | 8 | fieldset |
602d6bef BA |
9 | label(for="setHints") {{ st.tr["Show possible moves?"] }} |
10 | input#setHints(type="checkbox" v-model="st.settings.hints") | |
98db2082 | 11 | fieldset |
dcd68c41 | 12 | label(for="setHighlight") |
602d6bef | 13 | | {{ st.tr["Highlight last move and checks?"] }} |
c66a829b | 14 | input#setHighlight(type="checkbox" v-model="st.settings.highlight") |
98db2082 | 15 | fieldset |
602d6bef | 16 | label(for="setBcolor") {{ st.tr["Board colors"] }} |
c66a829b BA |
17 | select#setBcolor(v-model="st.settings.bcolor") |
18 | option(value="lichess") {{ st.tr["brown"] }} | |
19 | option(value="chesscom") {{ st.tr["green"] }} | |
20 | option(value="chesstempo") {{ st.tr["blue"] }} | |
98db2082 | 21 | fieldset |
602d6bef | 22 | label(for="setSound") {{ st.tr["Play sounds?"] }} |
c66a829b BA |
23 | select#setSound(v-model="st.settings.sound") |
24 | option(value="0") {{ st.tr["None"] }} | |
25 | option(value="1") {{ st.tr["New game"] }} | |
26 | option(value="2") {{ st.tr["All"] }} | |
98db2082 BA |
27 | </template> |
28 | ||
29 | <script> | |
c66a829b | 30 | import { store } from "@/store.js"; |
98db2082 | 31 | export default { |
c66a829b BA |
32 | name: "my-settings", |
33 | data: function() { | |
34 | return { | |
35 | st: store.state, | |
36 | }; | |
5701c228 | 37 | }, |
dac39588 | 38 | methods: { |
98db2082 BA |
39 | updateSettings: function(event) { |
40 | const propName = | |
41 | event.target.id.substr(3).replace(/^\w/, c => c.toLowerCase()) | |
dfeb96ea | 42 | let value = (["bcolor","sound"].includes(propName) |
602d6bef | 43 | ? event.target.value |
dfeb96ea BA |
44 | : event.target.checked); |
45 | if (propName == "sound") | |
46 | value = parseInt(value); | |
47 | store.updateSetting(propName, value); | |
98db2082 | 48 | }, |
dac39588 | 49 | }, |
98db2082 BA |
50 | }; |
51 | </script> |