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 | form |
8 | fieldset | |
9 | label(for="setHints") {{ st.tr["Show possible moves?"] }} | |
10 | input#setHints(type="checkbox" v-model="st.settings.hints") | |
11 | fieldset | |
12 | label(for="setHighlight") | |
13 | | {{ st.tr["Highlight last move and checks?"] }} | |
14 | input#setHighlight(type="checkbox" v-model="st.settings.highlight") | |
15 | fieldset | |
16 | label(for="setBcolor") {{ st.tr["Board colors"] }} | |
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"] }} | |
21 | fieldset | |
22 | label(for="setSound") {{ st.tr["Play sounds?"] }} | |
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 { | |
6808d7a1 | 35 | st: store.state |
c66a829b | 36 | }; |
5701c228 | 37 | }, |
dac39588 | 38 | methods: { |
98db2082 | 39 | updateSettings: function(event) { |
6808d7a1 BA |
40 | const propName = event.target.id |
41 | .substr(3) | |
42 | .replace(/^\w/, c => c.toLowerCase()); | |
43 | let value = ["bcolor", "sound"].includes(propName) | |
602d6bef | 44 | ? event.target.value |
6808d7a1 BA |
45 | : event.target.checked; |
46 | if (propName == "sound") value = parseInt(value); | |
dfeb96ea | 47 | store.updateSetting(propName, value); |
6808d7a1 BA |
48 | } |
49 | } | |
98db2082 BA |
50 | }; |
51 | </script> | |
9a3049f3 BA |
52 | |
53 | <style lang="sass" scoped> | |
54 | [type="checkbox"].modal+div .card | |
55 | max-width: 767px | |
56 | max-height: 100% | |
57 | </style> |