X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Findex.js;h=0e2a2631dde814d5b701ac4c3620de49ed81895b;hp=fe0b36a3be3ae15080113955f09b9523bd7715f1;hb=4608eed94432356bd2df8c144d7d233913c6483c;hpb=d44df0b01732d1948525daef5df62211ea6e1f64 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); + }, + }, });