X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Findex.js;h=64489262663e9237bd420d3ebeb5ece157830537;hp=12bcf64450e3001717d9af98d482bcbd3f4daeed;hb=b6487fb9c41705187cf97215fc9e8f86a59057c7;hpb=ecf44502c1ed7c408b8ea4d1be5234203aa3d314 diff --git a/public/javascripts/index.js b/public/javascripts/index.js index 12bcf644..64489262 100644 --- 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: { @@ -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, @@ -24,8 +30,7 @@ new Vue({ }, 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); @@ -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 ?)