X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fvariant.js;h=74c4298c03ef00af6456afdf462dab06d65416d7;hp=e24dfc688433da348a93d5ccf1e245a3300599bb;hb=4608eed94432356bd2df8c144d7d233913c6483c;hpb=d44df0b01732d1948525daef5df62211ea6e1f64 diff --git a/public/javascripts/variant.js b/public/javascripts/variant.js index e24dfc68..74c4298c 100644 --- a/public/javascripts/variant.js +++ b/public/javascripts/variant.js @@ -18,7 +18,7 @@ new Vue({ created: function() { // TODO: navigation becomes a little more complex this.setDisplay(); - + window.onhashchange = this.setDisplay; this.myid = "abcdefghij"; //console.log(this.myid + " " + variant); @@ -29,7 +29,6 @@ new Vue({ } this.conn.onclose = socketCloseListener; - window.onhashchange = this.setDisplay; //this.vr = new VariantRules( V.GenRandInitFen() ); }, methods: { @@ -37,8 +36,9 @@ new Vue({ //TODO: prevent set display if there is a running game - const page = (location.hash || "#room").substr(1); - this.display = page; + if (!location.hash) + location.hash = "#room"; //default + this.display = location.hash.substr(1); // Close menu on small screens: let menuToggle = document.getElementById("drawer-control"); if (!!menuToggle)