Fix Omega promotions
[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 (
23 require("raw-loader!@/translations/variants/" + this.st.lang + ".pug")
24 // Next two lines fix a weird issue after last update (2019-11)
25 .replace(/\\n/g, " ")
26 .replace(/\\"/g, '"')
27 .replace('module.exports = "', "")
28 .replace(/"$/, "")
6808d7a1 29 );
6808d7a1 30 }
85e5b5c1 31 },
5b020e73 32 methods: {
9e3f662f
BA
33 // oninput listener, required for smartphones:
34 setCurPrefix: function(e) {
35 this.curPrefix = e.target.value;
36 },
5b020e73
BA
37 getLink: function(vname) {
38 return "/variants/" + vname;
09d37571
BA
39 },
40 getVclasses: function(varray, idx) {
41 const idxMod2 = idx % 2;
42 return {
43 'col-md-offset-1': idxMod2 == 0,
44 'col-lg-offset-2': idxMod2 == 0,
45 'last-noneighb': idxMod2 == 0 && idx == varray.length - 1
46 };
47 },
6808d7a1 48 }
5b020e73
BA
49};
50</script>
51
41c80bb6 52<style lang="sass" scoped>
737a5daf 53a#mainLink
bd76b456 54 display: block
737a5daf
BA
55 margin: 10px auto
56 text-align: center
57 font-size: 1.3em
5b020e73 58</style>