projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Advance on components/game.js
[vchess.git]
/
public
/
javascripts
/
variant.js
diff --git
a/public/javascripts/variant.js
b/public/javascripts/variant.js
index
7d30d73
..
e24dfc6
100644
(file)
--- a/
public/javascripts/variant.js
+++ b/
public/javascripts/variant.js
@@
-2,7
+2,7
@@
new Vue({
el: "#VueElement",
data: {
display: "undefined", //default to main hall; see "created()" function
el: "#VueElement",
data: {
display: "undefined", //default to main hall; see "created()" function
- gameid:
"undefined"
, //...yet
+ gameid:
undefined
, //...yet
conn: null,
conn: null,
@@
-10,25
+10,35
@@
new Vue({
mode: "analyze",
orientation: "w",
userColor: "w",
mode: "analyze",
orientation: "w",
userColor: "w",
+
+ allowChat: false,
+ allowMovelist: false,
+ fen: V.GenRandInitFen(),
},
created: function() {
// TODO: navigation becomes a little more complex
},
created: function() {
// TODO: navigation becomes a little more complex
- const url = window.location.href;
- const hashPos = url.indexOf("#");
- const page = (hashPos >= 0 ? url.substr(hashPos+1) : "room");
- this.setDisplay(page);
+ this.setDisplay();
+
+
+ this.myid = "abcdefghij";
+//console.log(this.myid + " " + variant);
- this.conn = new WebSocket(
url + "/?sid=" + this.myid + "&page=" + variant._
id);
+ this.conn = new WebSocket(
socketUrl + "/?sid=" + this.myid + "&page=" + variant.
id);
const socketCloseListener = () => {
const socketCloseListener = () => {
- this.conn = new WebSocket(
url + "/?sid=" + this.myid + "&page=" + variant._
id);
+ this.conn = new WebSocket(
socketUrl + "/?sid=" + this.myid + "&page=" + variant.
id);
}
this.conn.onclose = socketCloseListener;
}
this.conn.onclose = socketCloseListener;
- this.vr = new VariantRules( V.GenRandInitFen() );
+ window.onhashchange = this.setDisplay;
+ //this.vr = new VariantRules( V.GenRandInitFen() );
},
methods: {
},
methods: {
- setDisplay: function(elt) {
- this.display = elt;
+ setDisplay: function() {
+
+//TODO: prevent set display if there is a running game
+
+ const page = (location.hash || "#room").substr(1);
+ this.display = page;
// Close menu on small screens:
let menuToggle = document.getElementById("drawer-control");
if (!!menuToggle)
// Close menu on small screens:
let menuToggle = document.getElementById("drawer-control");
if (!!menuToggle)