X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Findex.js;h=f59bc045ae28d0444ef11e0e1786223043b76e8e;hb=b57dbd126734b4398861292c611197c6991ed3eb;hp=e460f868786c94fd2e0c4a7a16fa2cd5233d93aa;hpb=e6dcb115eab52abefa1d54a65af546cf5a0153e9;p=vchess.git diff --git a/public/javascripts/index.js b/public/javascripts/index.js index e460f868..f59bc045 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: "", @@ -8,6 +8,7 @@ new Vue({ }, computed: { sortedCounts: function () { + // TODO: priorité aux parties corr où c'est à nous de jouer ! const variantsCounts = variantArray .filter( v => { return v.name.startsWith(this.curPrefix); @@ -48,45 +49,36 @@ new Vue({ this.conn.onmessage = socketMessageListener; this.conn.onclose = socketCloseListener; }, - 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 - }; - // Show welcome dialog box if "first visit" - const visited = getCookie("visited"); - if (!visited || visited !== "1") - document.getElementById("modalB4welcome").checked = true; - }, - methods: { - showWelcomeMsg: function() { - document.getElementById("modalB4welcome").checked = false; - document.getElementById("modalWelcome").checked = true; - }, - markAsVisited: function() { - setCookie('visited', '1'); - document.getElementById('modalWelcome').checked = false; - }, - }, +// 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 ?)