X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Findex.js;h=3d35c456a7912142cd71d4abd414566c6b8b1f4a;hb=26b8e4f7c71030d49e44fe1d89632ef91b886d67;hp=6859e8bf4a53ec5bf64285c12f4f03f42edbffd3;hpb=298c42e63ae321526693e9ce418c4113af36e025;p=vchess.git diff --git a/public/javascripts/index.js b/public/javascripts/index.js index 6859e8bf..3d35c456 100644 --- a/public/javascripts/index.js +++ b/public/javascripts/index.js @@ -1,6 +1,6 @@ // Javascript for index page: mostly counters updating new Vue({ - el: "#indexPage", + el: "#VueElement", data: { counts: {}, curPrefix: "", @@ -9,9 +9,10 @@ new Vue({ computed: { sortedCounts: function () { // TODO: priorité aux parties corr où c'est à nous de jouer ! + const capitalizedPrefix = this.curPrefix.replace(/^\w/, c => c.toUpperCase()); const variantsCounts = variantArray .filter( v => { - return v.name.startsWith(this.curPrefix); + return v.name.startsWith(capitalizedPrefix); }) .map( v => { return { @@ -48,37 +49,10 @@ new Vue({ }; this.conn.onmessage = socketMessageListener; this.conn.onclose = socketCloseListener; + + // 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) + // (helper: static fonction "GetNextCol()" dans base_rules.js) }, -// mounted: function() { -// // Handle key stroke -// document.onkeydown = event => { -// // Is it Back or Esc? If yes, apply action on current word -// if (event.keyCode == 8) //Back -// { -// event.preventDefault(); -// this.curPrefix = this.curPrefix.slice(0,-1); -// } -// else if (event.keyCode == 27) //Esc -// { -// event.preventDefault(); -// this.curPrefix = ""; -// } -// // Is it alphanumeric? If yes, stack it -// else if (_.range(48,58).includes(event.keyCode) -// || _.range(65,91).includes(event.keyCode) -// || _.range(97,123).includes(event.keyCode)) -// { -// let newChar = String.fromCharCode(event.keyCode); -// this.curPrefix += this.curPrefix.length==0 -// ? newChar.toUpperCase() -// : newChar.toLowerCase(); -// } -// // ...ignore everything else -// }; -// }, }); - -// 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 ?)