Fix index style. Now on variant page
[vchess.git] / public / javascripts / index.js
index 007c9fe..e460f86 100644 (file)
@@ -1,3 +1,4 @@
+// Javascript for index page: mostly counters updating
 new Vue({
        el: "#indexPage",
        data: {
@@ -7,7 +8,11 @@ new Vue({
        },
        computed: {
                sortedCounts: function () {
-                       const variantsCounts = variantArray.map( v => {
+                       const variantsCounts = variantArray
+                       .filter( v => {
+                               return v.name.startsWith(this.curPrefix);
+                       })
+                       .map( v => {
                                return {
                                        name: v.name,
                                        desc: v.description,
@@ -72,12 +77,16 @@ new Vue({
                // Show welcome dialog box if "first visit"
                const visited = getCookie("visited");
                if (!visited || visited !== "1")
-                       document.getElementById("modal-b4welcome").checked = true;
+                       document.getElementById("modalB4welcome").checked = true;
        },
        methods: {
                showWelcomeMsg: function() {
-                       document.getElementById("modal-b4welcome").checked = false;
-                       document.getElementById("modal-welcome").checked = true;
+                       document.getElementById("modalB4welcome").checked = false;
+                       document.getElementById("modalWelcome").checked = true;
+               },
+               markAsVisited: function() {
+                       setCookie('visited', '1');
+                       document.getElementById('modalWelcome').checked = false;
                },
        },
 });