4 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
5 a#mainLink(href="/#/variants/list")
6 | {{ st.tr["View alphabetical variants list"] }}
8 a.leftLink(href="https://www.chessvariants.com/what.html")
9 | {{ st.tr["What is a chess variant?"] }}
10 a(href="https://www.chessvariants.com/why.html")
11 | {{ st.tr["Why play chess variants?"] }}
13 a(href="/#/variants/Chess960") Chess960
14 | {{ st.tr["chess960_v"] }}
15 div(v-for="g of sortedGroups")
16 h3 {{ st.tr["vt" + g] }}
17 p {{ st.tr["vg" + g] }}
19 li(v-for="v of sortVariants(variantGroup.get(g))")
20 a(:href="getLink(v)") {{ v.display }}
22 | {{ st.tr[v.description] }}
26 import { store } from "@/store";
27 import { ajax } from "@/utils/ajax";
42 this.variantGroup = new Map();
43 res.variantArray.forEach((v) => {
45 let collection = this.variantGroup.get(v.groupe);
46 if (!collection) this.variantGroup.set(v.groupe, [v]);
47 else collection.push(v);
55 sortedGroups: function() {
57 Array.from(this.variantGroup.keys()).sort((a, b) => (a < b ? -1 : 1))
62 sortVariants: function(group) {
63 return group.sort( (v1, v2) => v1.name.localeCompare(v2.name) );
65 // oninput listener, required for smartphones:
66 setCurPrefix: function(e) {
67 this.curPrefix = e.target.value;
69 getLink: function(variant) {
70 return "/#/variants/" + variant.name;
72 getVclasses: function(varray, idx) {
73 const idxMod2 = idx % 2;
75 'col-md-offset-1': idxMod2 == 0,
76 'col-lg-offset-2': idxMod2 == 0,
77 'last-noneighb': idxMod2 == 0 && idx == varray.length - 1
84 <style lang="sass" scoped>