From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 12 Feb 2020 14:36:40 +0000 (+0100) Subject: 'update' X-Git-Url: https://git.auder.net/doc/html/css/scripts/common.css?a=commitdiff_plain;h=9ddaf8da8743c50b9019888a82d84392913c60c9;p=vchess.git 'update' --- diff --git a/client/src/App.vue b/client/src/App.vue index 592861d7..f4f0cf7c 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -14,7 +14,7 @@ nav label.drawer-toggle(for="drawerControl") input#drawerControl.drawer(type="checkbox") - #menuBar(@click="hideDrawer") + #menuBar(@click="hideDrawer()") label.drawer-close(for="drawerControl") #leftMenu router-link(to="/") diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index 0e0f3720..45364053 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -1,5 +1,5 @@ <template lang="pug"> -div#baseGame(tabindex=-1 @click="() => focusBg()" +div#baseGame(tabindex=-1 @click="focusBg()" @keydown="handleKeys" @wheel="handleScroll") input#modalEog.modal(type="checkbox") div#eogDiv(role="dialog" data-checkbox="modalEog" aria-labelledby="eogMessage") @@ -21,21 +21,21 @@ div#baseGame(tabindex=-1 @click="() => focusBg()" #turnIndicator(v-if="game.vname=='Dark' && game.score=='*'") | {{ turn }} #controls - button(@click="gotoBegin") << - button(@click="() => undo()") < - button(@click="flip") ⇅ - button(@click="() => play()") > - button(@click="gotoEnd") >> + button(@click="gotoBegin()") << + button(@click="undo()") < + button(@click="flip()") ⇅ + button(@click="play()") > + button(@click="gotoEnd()") >> #pgnDiv #downloadDiv(v-if="game.vname!='Dark' || game.score!='*'") a#download(href="#") - button(@click="download") {{ st.tr["Download"] }} PGN + button(@click="download()") {{ st.tr["Download"] }} PGN button(onClick="doClick('modalAdjust')") ⤢ button(v-if="game.vname!='Dark' && game.mode!='analyze'" - @click="analyzePosition") + @click="analyzePosition()") | {{ st.tr["Analyse"] }} // NOTE: rather ugly hack to avoid showing twice "rules" link... - button(v-if="!$route.path.match('/variants/')" @click="showRules") + button(v-if="!$route.path.match('/variants/')" @click="showRules()") | {{ st.tr["Rules"] }} #movesList MoveList(v-if="showMoves" :score="game.score" :message="game.scoreMsg" @@ -52,7 +52,6 @@ import { getSquareId } from "@/utils/squareId"; import { getDate } from "@/utils/datetime"; import { processModalClick } from "@/utils/modalClick"; import { getScoreMessage } from "@/utils/scoring"; - export default { name: 'my-base-game', components: { diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 5bc8ec25..ddc13731 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -2,7 +2,6 @@ import { getSquareId, getSquareFromId } from "@/utils/squareId"; import { ArrayFun } from "@/utils/array"; import { store } from "@/store"; - export default { name: 'my-board', // Last move cannot be guessed from here, and is required to highlight squares diff --git a/client/src/components/ChallengeList.vue b/client/src/components/ChallengeList.vue index 95a71ac2..bffda1a1 100644 --- a/client/src/components/ChallengeList.vue +++ b/client/src/components/ChallengeList.vue @@ -17,7 +17,6 @@ div <script> import { store } from "@/store"; - export default { name: "my-challenge-list", props: ["challenges"], diff --git a/client/src/components/Chat.vue b/client/src/components/Chat.vue index 7eeba5ac..c5fde454 100644 --- a/client/src/components/Chat.vue +++ b/client/src/components/Chat.vue @@ -2,7 +2,7 @@ div input#inputChat(type="text" :placeholder="st.tr['Type here']" @keyup.enter="sendChat") - button#sendChatBtn(@click="sendChat") {{ st.tr["Send"] }} + button#sendChatBtn(@click="sendChat()") {{ st.tr["Send"] }} p(v-for="chat in chats" :class="classObject(chat)" v-html="chat.name + ': ' + chat.msg") p(v-for="chat in pastChats" :class="classObject(chat)" @@ -11,7 +11,6 @@ div <script> import { store } from "@/store"; - export default { name: "my-chat", // Prop 'pastChats' for corr games where chats are on server diff --git a/client/src/components/ComputerGame.vue b/client/src/components/ComputerGame.vue index 14c1b071..b20b8fe1 100644 --- a/client/src/components/ComputerGame.vue +++ b/client/src/components/ComputerGame.vue @@ -7,7 +7,6 @@ BaseGame(:game="game" :vr="vr" ref="basegame" import BaseGame from "@/components/BaseGame.vue"; import { store } from "@/store"; import Worker from "worker-loader!@/playCompMove"; - export default { name: "my-computer-game", components: { diff --git a/client/src/components/ContactForm.vue b/client/src/components/ContactForm.vue index 9ca337de..9ac57107 100644 --- a/client/src/components/ContactForm.vue +++ b/client/src/components/ContactForm.vue @@ -17,7 +17,7 @@ div br textarea#mailContent fieldset - button(type="button" @click="trySendMessage") {{ st.tr["Send"] }} + button(type="button" @click="trySendMessage()") {{ st.tr["Send"] }} p#emailSent {{ st.tr["Email sent!"] }} </template> @@ -25,7 +25,6 @@ div import { ajax } from "../utils/ajax"; import { store } from "@/store"; import { checkNameEmail } from "@/data/userCheck"; - export default { name: "my-contact-form", data: function() { diff --git a/client/src/components/GameList.vue b/client/src/components/GameList.vue index 24359302..5a4c8f7c 100644 --- a/client/src/components/GameList.vue +++ b/client/src/components/GameList.vue @@ -15,12 +15,14 @@ div td(data-label="White") {{ g.players[0].name || "@nonymous" }} td(data-label="Black") {{ g.players[1].name || "@nonymous" }} td(data-label="Time control") {{ g.cadence }} - td(data-label="Result") {{ g.score }} + td(data-label="Result" :class="{finished: g.score!='*'}" + @click.stop="deleteGame(g)") + | {{ g.score }} </template> <script> import { store } from "@/store"; - +import { GameStorage } from "@/utils/gameStorage"; export default { name: "my-game-list", props: ["games"], @@ -55,6 +57,12 @@ export default { return augmentedGames.sort((g1,g2) => { return g2.priority - g1.priority; }); }, }, + methods: { + deleteGame: function(game) { + if (confirm(this.st.tr["Remove game ?"])) + GameStorage.remove(game.id); + }, + }, }; </script> @@ -62,4 +70,6 @@ export default { // TODO: understand why the style applied to <tr> element doesn't work tr.my-turn > td background-color: #fcd785 +tr td.finished + background-color: red </style> diff --git a/client/src/components/MoveList.vue b/client/src/components/MoveList.vue index e3da8dd9..ffa102ec 100644 --- a/client/src/components/MoveList.vue +++ b/client/src/components/MoveList.vue @@ -1,6 +1,5 @@ <script> import { store } from "@/store"; -// Component for moves list on the right export default { name: 'my-move-list', props: ["moves","cursor","score","message","firstNum"], diff --git a/client/src/components/Welcome.vue b/client/src/components/Welcome.vue index 2e2cb823..5f336e85 100644 --- a/client/src/components/Welcome.vue +++ b/client/src/components/Welcome.vue @@ -4,16 +4,23 @@ div div(role="dialog") .card div(v-html="content") + p#disableMsg.clickable(@click="closeAndDisable()") + | {{ st.tr["Close and show no more"] }} </template> <script> import { store } from "@/store.js"; export default { name: "my-welcome", + data: function() { + return { + st: store.state, + }; + }, computed: { content: function() { // (AJAX) Request to get welcome content (plain text, HTML) - return require("raw-loader!@/translations/welcome/" + store.state.lang + ".pug") + return require("raw-loader!@/translations/welcome/" + this.st.lang + ".pug") // Next two lines fix a weird issue after last update (2019-11) .replace(/\\n/g, " ").replace(/\\"/g, '"') .replace('module.exports = "', '').replace(/"$/, ""); @@ -27,3 +34,10 @@ export default { }, }; </script> + +<style lang="sass"> +p#credits + font-size: 0.8rem + margin-top: -10px + text-align: center +</style> diff --git a/client/src/translations/en.js b/client/src/translations/en.js index 66a4b9e9..39d7f4b2 100644 --- a/client/src/translations/en.js +++ b/client/src/translations/en.js @@ -18,6 +18,7 @@ export const translations = "Cadence": "Cadence", "Challenge": "Challenge", "Challenge declined": "Challenge declined", + "Close and show no more": "Close and show no more", "Connection token sent. Check your emails!": "Connection token sent. Check your emails!", "Contact": "Contact", "Contact form": "Contact form", diff --git a/client/src/translations/es.js b/client/src/translations/es.js index d103124c..2a01b1d4 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -18,6 +18,7 @@ export const translations = "Cadence": "Cadencia", "Challenge": "Desafiar", "Challenge declined": "DesafÃo rechazado", + "Close and show no more": "Cerrar y no mostrar más", "Connection token sent. Check your emails!": "Token de conexión enviado. ¡ Revisa tus correos !", "Contact": "Contacto", "Contact form": "Formulario de contacto", diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index 77a6a339..fbaffc68 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -18,6 +18,7 @@ export const translations = "Cadence": "Cadence", "Challenge": "Défier", "Challenge declined": "Défi refusé", + "Close and show no more": "Fermer et ne plus montrer", "Connection token sent. Check your emails!": "Token de connection envoyé. Allez voir vos emails !", "Contact": "Contact", "Contact form": "Formulaire de contact", diff --git a/client/src/translations/welcome/en.pug b/client/src/translations/welcome/en.pug index bbc5edfc..4bb53b34 100644 --- a/client/src/translations/welcome/en.pug +++ b/client/src/translations/welcome/en.pug @@ -1,7 +1,11 @@ h3 Welcome to v[ariant]chess.club! p A place to play chess variants. img(src="/images/Hexagonal_chess.svg") -p A variant is a change in the usual rules : +- + var wikipediaUrl = "https://en.wikipedia.org/wiki/" + + "List_of_chess_variants#/media/File:Hexagonal_chess.svg"; +p#credits Image credit: #[a(href=wikipediaUrl) Wikipedia] +p A variant is a change in the usual rules: ul li different pieces movements, or li different chessboards (as on the image), or @@ -12,9 +16,3 @@ a(href="https://www.chessvariants.com/why.html") Why should I play them ?! h3 Notes (non-negotiable ;) ) p No ELO rating on this website. p Games start with an assymetric random setup. -p#disableMsg.clickable(onClick="localStorage.setItem('welcomed',true)") - | Close and show no more -- - var wikipediaUrl = "https://en.wikipedia.org/wiki/" + - "List_of_chess_variants#/media/File:Hexagonal_chess.svg"; -p.smallfont Image credit: #[a(href=wikipediaUrl) Wikipedia] diff --git a/client/src/translations/welcome/es.pug b/client/src/translations/welcome/es.pug index c3a292e9..56f1ac4d 100644 --- a/client/src/translations/welcome/es.pug +++ b/client/src/translations/welcome/es.pug @@ -1,6 +1,10 @@ h3 ¡ Bienvenido a v[ariant]chess.club ! p Un sitio donde jugar variantes del juego de ajedrez. img(src="/images/Hexagonal_chess.svg") +- + var wikipediaUrl = "https://en.wikipedia.org/wiki/" + + "List_of_chess_variants#/media/File:Hexagonal_chess.svg"; +p#credits Credito de imagen : #[a(href=wikipediaUrl) Wikipedia] p Una variante es un cambio de las reglas habituales : ul li diferentes desplazamientos de piezas, o @@ -12,9 +16,3 @@ a(href="https://www.chessvariants.com/why.html") Pero por qué jugar esto ?! h3 Notas (no negociables ;) ) p No hay clasificación ELO en el sitio. p Las partidas comienzan con una posición aleatoria asimétrica. -p#disableMsg.clickable(onClick="localStorage.setItem('welcomed',true)") - | Cerrar y no mostrar más -- - var wikipediaUrl = "https://en.wikipedia.org/wiki/" + - "List_of_chess_variants#/media/File:Hexagonal_chess.svg"; -p.smallfont Credito de imagen : #[a(href=wikipediaUrl) Wikipedia] diff --git a/client/src/translations/welcome/fr.pug b/client/src/translations/welcome/fr.pug index 84fd0c46..4a5a3877 100644 --- a/client/src/translations/welcome/fr.pug +++ b/client/src/translations/welcome/fr.pug @@ -1,6 +1,10 @@ h3 Bienvenue sur v[ariant]chess.club ! p Un site où jouer à des variantes du jeu d'échecs. img(src="/images/Hexagonal_chess.svg") +- + var wikipediaUrl = "https://en.wikipedia.org/wiki/" + + "List_of_chess_variants#/media/File:Hexagonal_chess.svg"; +p#credits Crédit image : #[a(href=wikipediaUrl) Wikipedia] p Une variante est une modification des règles usuelles : ul li différents déplacements de pièces, ou @@ -12,9 +16,3 @@ a(href="https://www.chessvariants.com/why.html") Mais pourquoi jouer à ça ?! h3 Notes (non négociables ;) ) p Aucun classement ELO sur le site. p Les parties démarrent avec une position aléatoire asymétrique. -p#disableMsg.clickable(@click="closeAndDisable") - | Fermer et ne plus montrer -- - var wikipediaUrl = "https://en.wikipedia.org/wiki/" + - "List_of_chess_variants#/media/File:Hexagonal_chess.svg"; -p.smallfont Crédit image : #[a(href=wikipediaUrl) Wikipedia] diff --git a/client/src/views/About.vue b/client/src/views/About.vue index 47a740d2..a685f3c8 100644 --- a/client/src/views/About.vue +++ b/client/src/views/About.vue @@ -7,7 +7,6 @@ main <script> import { store } from "@/store"; - export default { name: 'my-about', computed: { diff --git a/client/src/views/Analyse.vue b/client/src/views/Analyse.vue index a4bdec23..2f68cdea 100644 --- a/client/src/views/Analyse.vue +++ b/client/src/views/Analyse.vue @@ -4,7 +4,7 @@ main .col-sm-12 #fenDiv input#fen(v-model="curFen" @input="adjustFenSize") - button(@click="gotoFen") {{ st.tr["Go"] }} + button(@click="gotoFen()") {{ st.tr["Go"] }} BaseGame(:game="game" :vr="vr" ref="basegame") </template> @@ -12,7 +12,6 @@ main import BaseGame from "@/components/BaseGame.vue"; import { store } from "@/store"; import { ArrayFun } from "@/utils/array"; - export default { name: 'my-analyse', components: { diff --git a/client/src/views/Auth.vue b/client/src/views/Auth.vue index f892fd55..a750b3e3 100644 --- a/client/src/views/Auth.vue +++ b/client/src/views/Auth.vue @@ -9,7 +9,6 @@ main <script> import { store } from "@/store"; import { ajax } from "@/utils/ajax"; - export default { name: 'my-auth', data: function() { diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index a61655a9..dc6b817e 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -1,6 +1,6 @@ <template lang="pug"> main - input#modalChat.modal(type="checkbox" @click="resetChatColor") + input#modalChat.modal(type="checkbox" @click="resetChatColor()") div#chatWrap(role="dialog" data-checkbox="modalChat" aria-labelledby="inputChat") #chat.card label.modal-close(for="modalChat") @@ -17,10 +17,10 @@ main span.variant-info {{ game.vname }} button#chatBtn(onClick="doClick('modalChat')") Chat #actions(v-if="game.score=='*'") - button(@click="clickDraw" :class="{['draw-' + drawOffer]: true}") + button(@click="clickDraw()" :class="{['draw-' + drawOffer]: true}") | {{ st.tr["Draw"] }} - button(v-if="!!game.mycolor" @click="abortGame") {{ st.tr["Abort"] }} - button(v-if="!!game.mycolor" @click="resign") {{ st.tr["Resign"] }} + button(v-if="!!game.mycolor" @click="abortGame()") {{ st.tr["Abort"] }} + button(v-if="!!game.mycolor" @click="resign()") {{ st.tr["Resign"] }} #playersInfo p span.name(:class="{connected: isConnected(0)}") diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 9c06c4bd..42fd4767 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -31,7 +31,7 @@ main fieldset(v-if="st.user.id > 0 && newchallenge.to.length > 0") label(for="inputFen") FEN input#inputFen(type="text" v-model="newchallenge.fen") - button(@click="newChallenge") {{ st.tr["Send challenge"] }} + button(@click="newChallenge()") {{ st.tr["Send challenge"] }} .row .col-sm-12 button#newGame(onClick="doClick('modalNewgame')") {{ st.tr["New game"] }} @@ -39,14 +39,14 @@ main .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 div .button-group - button(@click="(e) => setDisplay('c','live',e)" class="active") + button(@click="setDisplay('c','live',$event)" class="active") | {{ st.tr["Live challenges"] }} - button(@click="(e) => setDisplay('c','corr',e)") + button(@click="setDisplay('c','corr',$event)") | {{ st.tr["Correspondance challenges"] }} ChallengeList(v-show="cdisplay=='live'" - :challenges="filterChallenges('live')" @click-challenge="clickChallenge") + :challenges="filterChallenges('live')" @click-challenge="clickChallenge()") ChallengeList(v-show="cdisplay=='corr'" - :challenges="filterChallenges('corr')" @click-challenge="clickChallenge") + :challenges="filterChallenges('corr')" @click-challenge="clickChallenge()") #people h3.text-center {{ st.tr["Who's there?"] }} #players @@ -64,9 +64,9 @@ main .clearer div .button-group - button(@click="(e) => setDisplay('g','live',e)" class="active") + button(@click="setDisplay('g','live',$event)" class="active") | {{ st.tr["Live games"] }} - button(@click="(e) => setDisplay('g','corr',e)") + button(@click="setDisplay('g','corr',$event)") | {{ st.tr["Correspondance games"] }} GameList(v-show="gdisplay=='live'" :games="filterGames('live')" @show-game="showGame") diff --git a/client/src/views/Logout.vue b/client/src/views/Logout.vue index 61259d58..89f9a399 100644 --- a/client/src/views/Logout.vue +++ b/client/src/views/Logout.vue @@ -9,7 +9,6 @@ main <script> import { store } from "@/store"; import { ajax } from "@/utils/ajax"; - export default { name: 'my-logout', data: function() { diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index 6ed2c7f6..9e58cfd5 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -16,7 +16,6 @@ import { store } from "@/store"; import { GameStorage } from "@/utils/gameStorage"; import { ajax } from "@/utils/ajax"; import GameList from "@/components/GameList.vue"; - export default { name: "my-games", components: { diff --git a/client/src/views/Rules.vue b/client/src/views/Rules.vue index 3339111a..dbc6798d 100644 --- a/client/src/views/Rules.vue +++ b/client/src/views/Rules.vue @@ -3,15 +3,15 @@ main .row .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 .button-group - button(@click="clickReadRules") {{ st.tr["Rules"] }} - button(v-show="!gameInProgress" @click="() => startGame('auto')") + button(@click="clickReadRules()") {{ st.tr["Rules"] }} + button(v-show="!gameInProgress" @click="startGame('auto')") | {{ st.tr["Example game"] }} - button(v-show="!gameInProgress" @click="() => startGame('versus')") + button(v-show="!gameInProgress" @click="startGame('versus')") | {{ st.tr["Practice"] }} - button(v-show="gameInProgress" @click="() => stopGame()") + button(v-show="gameInProgress" @click="stopGame()") | {{ st.tr["Stop game"] }} button(v-if="display=='rules' && gameInfo.vname!='Dark'" - @click="gotoAnalyze") + @click="gotoAnalyze()") | {{ st.tr["Analyse"] }} .section-content(v-show="display=='rules'" v-html="content") ComputerGame(v-show="display=='computer'" :game-info="gameInfo" @@ -22,7 +22,6 @@ main import ComputerGame from "@/components/ComputerGame.vue"; import { store } from "@/store"; import { getDiagram } from "@/utils/printDiagram"; - export default { name: 'my-rules', components: {