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