X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Findex.js;h=0e2a2631dde814d5b701ac4c3620de49ed81895b;hb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;hp=fe0b36a3be3ae15080113955f09b9523bd7715f1;hpb=d44df0b01732d1948525daef5df62211ea6e1f64;p=vchess.git diff --git a/public/javascripts/index.js b/public/javascripts/index.js index fe0b36a3..0e2a2631 100644 --- a/public/javascripts/index.js +++ b/public/javascripts/index.js @@ -30,6 +30,9 @@ new Vue({ }, }, created: function() { + this.setDisplay(); + window.onhashchange = this.setDisplay; + const url = socketUrl; const sid = getRandString(); this.conn = new WebSocket(url + "/?sid=" + sid + "&page=index"); @@ -54,5 +57,14 @@ new Vue({ // 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) + + }, + methods: { + setDisplay: function() { + if (!location.hash) + location.hash = "#variants"; //default + this.display = location.hash.substr(1); + }, + }, });