projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Draft code reorganisation (+ fix Alice rules + stateless VariantRules object)
[vchess.git]
/
public
/
javascripts
/
index.js
diff --git
a/public/javascripts/index.js
b/public/javascripts/index.js
index
12bcf64
..
6448926
100644
(file)
--- a/
public/javascripts/index.js
+++ b/
public/javascripts/index.js
@@
-1,3
+1,4
@@
+// Javascript for index page: mostly counters updating
new Vue({
el: "#indexPage",
data: {
new Vue({
el: "#indexPage",
data: {
@@
-7,7
+8,12
@@
new Vue({
},
computed: {
sortedCounts: function () {
},
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,
return {
name: v.name,
desc: v.description,
@@
-24,8
+30,7
@@
new Vue({
},
created: function() {
const url = socketUrl;
},
created: function() {
const url = socketUrl;
- // random enough (TODO: function)
- const sid = (Date.now().toString(36) + Math.random().toString(36).substr(2, 7)).toUpperCase();
+ const sid = getRandString();
this.conn = new WebSocket(url + "/?sid=" + sid + "&page=index");
const socketMessageListener = msg => {
const data = JSON.parse(msg.data);
this.conn = new WebSocket(url + "/?sid=" + sid + "&page=index");
const socketMessageListener = msg => {
const data = JSON.parse(msg.data);
@@
-72,3
+77,8
@@
new Vue({
};
},
});
};
},
});
+
+// 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 ?)