Draft code reorganisation (+ fix Alice rules + stateless VariantRules object)
[vchess.git] / public / javascripts / index.js
index 007c9fe..6448926 100644 (file)
@@ -1,3 +1,4 @@
+// Javascript for index page: mostly counters updating
 new Vue({
        el: "#indexPage",
        data: {
@@ -7,7 +8,12 @@ new Vue({
        },
        computed: {
                sortedCounts: function () {
-                       const variantsCounts = variantArray.map( v => {
+                       // TODO: priorité aux parties corr où c'est à nous de jouer !
+                       const variantsCounts = variantArray
+                       .filter( v => {
+                               return v.name.startsWith(this.curPrefix);
+                       })
+                       .map( v => {
                                return {
                                        name: v.name,
                                        desc: v.description,
@@ -69,15 +75,10 @@ new Vue({
                        }
                        // ...ignore everything else
                };
-               // Show welcome dialog box if "first visit"
-               const visited = getCookie("visited");
-               if (!visited || visited !== "1")
-                       document.getElementById("modal-b4welcome").checked = true;
-       },
-       methods: {
-               showWelcomeMsg: function() {
-                       document.getElementById("modal-b4welcome").checked = false;
-                       document.getElementById("modal-welcome").checked = true;
-               },
        },
 });
+
+// TODO:
+// si dernier lastMove sur serveur n'est pas le mien et nextColor == moi, alors background orange
+// ==> background orange si à moi de jouer par corr (sur main index)
+// (fonction "getNextCol()" dans base_rules.js ?)