},
methods: {
hideDrawer: function(e) {
- if (e.target.innerText == "Forum") return; //external link
e.preventDefault(); //TODO: why is this needed?
document.getElementsByClassName("drawer")[0].checked = false;
}
return h(App);
},
created: function() {
+ // Several interactions on clicks on elements:
window.doClick = elemId => {
document.getElementById(elemId).click();
};
+ // Esc key can close modals:
document.addEventListener("keydown", e => {
if (e.code === "Escape") {
let modalBoxes = document.querySelectorAll("[id^='modal']");
Observe: "Observe",
"Offer draw?": "Offer draw?",
"Opponent action": "Opponent action",
+ "Participant(s):": "Participant(s):",
"Play with?": "Play with?",
Players: "Players",
"Please log in to accept corr challenges": "Please log in to accept corr challenges",
Previous: "Previous",
"Processing... Please wait": "Processing... Please wait",
Problems: "Problems",
- "participant(s):": "participant(s):",
"Random?": "Random?",
"Randomness": "Randomness",
"Randomness against computer": "Randomness against computer",
"Offer draw?": "¿Ofrecer tablas?",
Observe: "Observar",
"Opponent action": "Acción del adversario",
+ "Participant(s):": "Participante(s):",
"Play with?": "¿Jugar con?",
Players: "Jugadores",
"Please log in to accept corr challenges": "Inicia sesión para aceptar los desafíos por correspondencia",
Previous: "Anterior",
"Processing... Please wait": "Procesando... por favor espere",
Problems: "Problemas",
- "participant(s):": "participante(s):",
"Random?": "Aleatorio?",
"Randomness": "Grado de azar",
"Randomness against computer": "Grado de azar contra la computadora",
"Offer draw?": "Proposer nulle ?",
Observe: "Observer",
"Opponent action": "Action de l'adversaire",
+ "Participant(s):": "Participant(s) :",
"Play with?": "Jouer avec ?",
Players: "Joueurs",
"Please log in to accept corr challenges": "Identifiez vous pour accepter des défis par correspondance",
Previous: "Précédent",
"Processing... Please wait": "Traitement en cours... Attendez SVP",
Problems: "Problèmes",
- "participant(s):": "participant(s) :",
"Random?": "Aléatoire?",
"Randomness": "Degré d'aléa",
"Randomness against computer": "Degré d'aléa contre l'ordinateur",
.card
label.modal-close(for="modalChat")
#participants
- span {{ Object.keys(people).length + " " + st.tr["participant(s):"] }}
+ span {{ st.tr["Participant(s):"] }}
span(
v-for="p in Object.values(people)"
v-if="p.focus && !!p.name"
span.variantName {{ curChallToAccept.vname }}
span {{ curChallToAccept.cadence }}
span {{ st.tr["with"] + " " + curChallToAccept.from.name }}
- .diagram(v-html="tchallDiag")
- .button-group#buttonsTchall
+ .diagram(
+ v-if="!!curChallToAccept.fen"
+ v-html="tchallDiag"
+ )
+ .button-group#buttonsTchall(:style="tchallButtonsMargin()")
button.acceptBtn(@click="decisionChallenge(true)")
span {{ st.tr["Accept challenge?"] }}
button.refuseBtn(@click="decisionChallenge(false)")
.button-group
button#peopleBtn(onClick="window.doClick('modalPeople')")
| {{ st.tr["Who's there?"] }}
- button(onClick="window.doClick('modalNewgame')")
+ button(@click="showNewchallengeForm()")
| {{ st.tr["New game"] }}
.row
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
: "losefocus"
);
},
- // Helpers:
+ partialResetNewchallenge: function() {
+ // Reset potential target and custom FEN:
+ this.newchallenge.to = "";
+ this.newchallenge.fen = "";
+ this.newchallenge.diag = "";
+ },
+ showNewchallengeForm: function() {
+ this.partialResetNewchallenge();
+ window.doClick("modalNewgame");
+ },
+ tchallButtonsMargin: function() {
+ if (!!this.curChallToAccept.fen) return { "margin-top": "10px" };
+ return {};
+ },
cadenceFocusIfOpened: function() {
if (event.target.checked)
document.getElementById("cadence").focus();
);
},
challenge: function(sid) {
- // Available, in Hall (only)
+ this.partialResetNewchallenge();
+ // Available, in Hall
this.newchallenge.to = this.people[sid].name;
document.getElementById("modalPeople").checked = false;
window.doClick("modalNewgame");
position: parsedFen.position,
orientation: c.mycolor
});
- this.curChallToAccept = c;
- document.getElementById("modalAccept").checked = true;
- }
- else {
- if (!confirm(this.st.tr["Accept challenge?"]))
- c.accepted = false;
- this.finishProcessingChallenge(c);
}
+ this.curChallToAccept = c;
+ document.getElementById("modalAccept").checked = true;
}
- else
- this.finishProcessingChallenge(c);
+ else this.finishProcessingChallenge(c);
}
else {
// My challenge
background-color: red
#buttonsTchall
- margin-top: 10px
+ // margin-top set dynamically (depends if diagram showed or not)
& > button > span
width: 100%
text-align: center
score varchar default '*',
scoreMsg varchar,
cadence varchar,
+ randomness integer, --for rematch
created datetime,
drawOffer character default '',
rematchOffer character default '',