Update npm packages
[vchess.git] / client / src / views / Variants.vue
CommitLineData
5b020e73 1<template lang="pug">
7aa548e7
BA
2main
3 .row
9a3049f3 4 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
737a5daf
BA
5 a#mainLink(href="/#/variants/list")
6 | {{ st.tr["View alphabetical variants list"] }}
7 div(v-html="content")
5b020e73
BA
8</template>
9
10<script>
11import { store } from "@/store";
12export default {
cf2343ce 13 name: "my-variants",
5b020e73
BA
14 data: function() {
15 return {
6808d7a1 16 st: store.state
5b020e73 17 };
85e5b5c1
BA
18 },
19 computed: {
737a5daf
BA
20 content: function() {
21 // (AJAX) Request to get rules content (plain text, HTML)
22 return (
8b3b2151
BA
23 require(
24 "raw-loader!@/translations/variants/" + this.st.lang + ".pug"
25 ).default
26 .replace('export default "', "")
27 .replace(/";$/, "")
737a5daf
BA
28 // Next two lines fix a weird issue after last update (2019-11)
29 .replace(/\\n/g, " ")
30 .replace(/\\"/g, '"')
6808d7a1 31 );
6808d7a1 32 }
85e5b5c1 33 },
5b020e73 34 methods: {
9e3f662f
BA
35 // oninput listener, required for smartphones:
36 setCurPrefix: function(e) {
37 this.curPrefix = e.target.value;
38 },
5b020e73
BA
39 getLink: function(vname) {
40 return "/variants/" + vname;
09d37571
BA
41 },
42 getVclasses: function(varray, idx) {
43 const idxMod2 = idx % 2;
44 return {
45 'col-md-offset-1': idxMod2 == 0,
46 'col-lg-offset-2': idxMod2 == 0,
47 'last-noneighb': idxMod2 == 0 && idx == varray.length - 1
48 };
49 },
6808d7a1 50 }
5b020e73
BA
51};
52</script>
53
41c80bb6 54<style lang="sass" scoped>
737a5daf 55a#mainLink
bd76b456 56 display: block
737a5daf
BA
57 margin: 10px auto
58 text-align: center
59 font-size: 1.3em
5b020e73 60</style>