projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Draft Ball variant + some fixes, enhancements and code cleaning
[vchess.git]
/
client
/
src
/
views
/
Hall.vue
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
4d830bb
..
9bb913c
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-73,7
+73,10
@@
main
)
fieldset(v-if="st.user.id > 0")
label(for="selectPlayers") {{ st.tr["Play with"] }}
)
fieldset(v-if="st.user.id > 0")
label(for="selectPlayers") {{ st.tr["Play with"] }}
- select#selectPlayersInList(v-model="newchallenge.to")
+ select#selectPlayersInList(
+ v-model="newchallenge.to"
+ @change="changeChallTarget()"
+ )
option(value="")
option(
v-for="p in Object.values(people)"
option(value="")
option(
v-for="p in Object.values(people)"
@@
-296,8
+299,8
@@
export default {
encodeURIComponent(this.$route.path);
this.conn = new WebSocket(this.connexionString);
this.conn.onopen = connectAndPoll;
encodeURIComponent(this.$route.path);
this.conn = new WebSocket(this.connexionString);
this.conn.onopen = connectAndPoll;
- this.conn.
onmessage = this.socketMessageListener
;
- this.conn.
onclose = this.socketCloseListener
;
+ this.conn.
addEventListener("message", this.socketMessageListener)
;
+ this.conn.
addEventListener("close", this.socketCloseListener)
;
},
mounted: function() {
document.addEventListener('visibilitychange', this.visibilityChange);
},
mounted: function() {
document.addEventListener('visibilitychange', this.visibilityChange);
@@
-453,6
+456,13
@@
export default {
if (!!this.curChallToAccept.fen) return { "margin-top": "10px" };
return {};
},
if (!!this.curChallToAccept.fen) return { "margin-top": "10px" };
return {};
},
+ changeChallTarget: function() {
+ if (!this.newchallenge.to) {
+ // Reset potential FEN + diagram
+ this.newchallenge.fen = "";
+ this.newchallenge.diag = "";
+ }
+ },
cadenceFocusIfOpened: function() {
if (event.target.checked)
document.getElementById("cadence").focus();
cadenceFocusIfOpened: function() {
if (event.target.checked)
document.getElementById("cadence").focus();
@@
-653,6
+663,8
@@
export default {
break;
case "killed":
// I logged in elsewhere:
break;
case "killed":
// I logged in elsewhere:
+ this.conn.removeEventListener("message", this.socketMessageListener);
+ this.conn.removeEventListener("close", this.socketCloseListener);
this.conn = null;
alert(this.st.tr["New connexion detected: tab now offline"]);
break;
this.conn = null;
alert(this.st.tr["New connexion detected: tab now offline"]);
break;
@@
-901,7
+913,7
@@
export default {
position: parsedFen.position,
orientation: parsedFen.turn
});
position: parsedFen.position,
orientation: parsedFen.turn
});
- }
+ }
else this.newchallenge.diag = "";
},
newChallFromPreset(pchall) {
this.partialResetNewchallenge();
},
newChallFromPreset(pchall) {
this.partialResetNewchallenge();
@@
-1190,7
+1202,6
@@
export default {
// Game state (including FEN): will be updated
moves: [],
clocks: [-1, -1], //-1 = unstarted
// Game state (including FEN): will be updated
moves: [],
clocks: [-1, -1], //-1 = unstarted
- initime: [0, 0], //initialized later
score: "*"
}
);
score: "*"
}
);