p.
From the main Hall, you can see and talk to online players,
- "send and accept challenges (live or correspondance), and also watch current
- "games. If this is your first contact with chess variants, you probably should
- "start with the 'Variants' page from the top menu: it explains all the rules
- "and allows to observe sample games or play against basic bots. Finally,
- "at any moment in a game you can click on the FEN string at the bottom to
- "analyze the position. Try not to do that in live games ;)
+ send and accept challenges (live or correspondance), and also watch current
+ games. If this is your first contact with chess variants, you probably should
+ start with the 'Variants' page from the top menu: it explains all the rules
+ and allows to observe sample games or play against basic bots. Finally,
+ at any moment in a game you can click on the 'Analyze' button to analyze
+ the position. Try not to do that in live games, your opponent would know ;)
p
a(href="https://github.com/yagu0/vchess") The source code
let res = "";
if (days > 0)
res += days + "d ";
- if (days <= 3 && hours > 0) //TODO: 3 is arbitrary
+ if (days <= 3 && hours > 0) //NOTE: 3 is arbitrary
res += hours + "h ";
if (days == 0 && minutes > 0)
res += (hours > 0 ? padDigits(minutes) + "m " : minutes + ":");
if (days == 0 && hours == 0)
+ {
res += padDigits(seconds);
+ if (minutes == 0)
+ res += "s"; //seconds indicator, since this is the only number printed
+ }
return res.trim(); //remove potential last space
}
Chat(:players="game.players" :pastChats="game.chats"
@newchat-sent="finishSendChat" @newchat-received="processChat")
.row
- .col-sm-12.col-md-9.col-md-offset-3.col-lg-10.col-lg-offset-2
+ #aboveBoard.col-sm-12.col-md-9.col-md-offset-3.col-lg-10.col-lg-offset-2
button#chatBtn(onClick="doClick('modalChat')") Chat
#actions(v-if="game.mode!='analyze' && game.score=='*'")
button(@click="offerDraw") Draw
button(@click="abortGame") Abort
button(@click="resign") Resign
- div Names: {{ game.players[0].name }} - {{ game.players[1].name }}
- div(v-if="game.score=='*'") Time: {{ virtualClocks[0] }} - {{ virtualClocks[1] }}
+ #playersInfo
+ p
+ span.name(:class="{connected: isConnected(0)}") {{ game.players[0].name }}
+ span.time(v-if="game.score=='*'") {{ virtualClocks[0] }}
+ span.split-names -
+ span.name(:class="{connected: isConnected(1)}") {{ game.players[1].name }}
+ span.time(v-if="game.score=='*'") {{ virtualClocks[1] }}
BaseGame(:game="game" :vr="vr" ref="basegame"
@newmove="processMove" @gameover="gameOver")
</template>
roomInit: function() {
this.st.conn.send(JSON.stringify({code:"pollclients"}));
},
+ isConnected: function(index) {
+ const name = this.game.players[index].name;
+ if (this.st.user.name == name)
+ return true;
+ return this.people.some(p => p.name == name);
+ },
socketMessageListener: function(msg) {
const data = JSON.parse(msg.data);
switch (data.code)
<style lang="sass">
.connected
- background-color: green
-.disconnected
- background-color: red
+ background-color: lightgreen
@media screen and (min-width: 768px)
#actions
width: 33%
margin: 0
+@media screen and (max-width: 767px)
+ #aboveBoard
+ text-align: center
+
+.name
+ font-size: 1.5rem
+ padding: 1px
+
+.time
+ font-size: 2rem
+ display: inline-block
+ margin-left: 10px
+
+.split-names
+ display: inline-block
+ margin: 0 15px
+
#chat
padding-top: 20px
max-width: 600px