From b9a5fe01da415dfbea740651c04e6e10dace2c21 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 4 Mar 2020 12:13:01 +0100 Subject: [PATCH] Allow hyphen in username on server side + add icons for navigation --- TODO | 14 +++ client/public/images/icons/SOURCE | 8 ++ client/public/images/icons/fast-forward.svg | 44 ++++++++ .../public/images/icons/fast-forward_rev.svg | 100 ++++++++++++++++++ client/public/images/icons/flip.svg | 7 ++ client/public/images/icons/play.svg | 10 ++ client/public/images/icons/play_rev.svg | 52 +++++++++ client/public/images/icons/resize.svg | 23 ++++ client/public/images/{ => icons}/settings.svg | 0 client/public/images/icons/undo.svg | 12 +++ client/src/App.vue | 2 +- client/src/components/BaseGame.vue | 22 +++- server/models/User.js | 2 +- 13 files changed, 289 insertions(+), 7 deletions(-) create mode 100644 client/public/images/icons/SOURCE create mode 100644 client/public/images/icons/fast-forward.svg create mode 100644 client/public/images/icons/fast-forward_rev.svg create mode 100644 client/public/images/icons/flip.svg create mode 100644 client/public/images/icons/play.svg create mode 100644 client/public/images/icons/play_rev.svg create mode 100644 client/public/images/icons/resize.svg rename client/public/images/{ => icons}/settings.svg (100%) create mode 100644 client/public/images/icons/undo.svg diff --git a/TODO b/TODO index 1c5f4a6b..9fec5b71 100644 --- a/TODO +++ b/TODO @@ -10,6 +10,11 @@ And remove current "notify through newmove" on server in sockets.js Analyse mode when launched from a position: should keep orientation --> $route query param, "side=w or b" +Subcursor (intra move) for multi-move variants for better navigation (in BaseGame) + +Allow symmetric mode in all variants (vertical symmetry for racing kings) +flag in challenge, "Symmetric: true / false", option of GenRandInitFen() + # Misc: Saw once a "double challenge" bug, one anonymous and a second one logged Both were asked a challenge probably, and both challenges added as different ones. @@ -20,4 +25,13 @@ https://www.chessvariants.com/rules/8-piece-chess Eightpieces : non-symmetric Sym8pieces : symmetric (960) +Generator vatiant, called "Matrix" ? +Peces on first rank never move but generate new pieces. Pawn don't generate. +A generator captured and replaced by a similar piece does not generate. +King does not generate. No castling. En passant possible? +Goal is still checkmate. + +Take(a)n(d)make : if capture a piece, take its power for the last of the turn and make a move like it. +If a pawn taken: direction of the capturer. + + Maxima, Interweave, Roccoco, Dynamo, Synchrone, Cannibal (force captures) diff --git a/client/public/images/icons/SOURCE b/client/public/images/icons/SOURCE new file mode 100644 index 00000000..ee8510e7 --- /dev/null +++ b/client/public/images/icons/SOURCE @@ -0,0 +1,8 @@ +https://www.onlinewebfonts.com/icon/519460 +https://www.onlinewebfonts.com/icon/322704 +https://www.flaticon.com/free-icon/play_254434?term=play&page=1&position=1 +https://www.flaticon.com/free-icon/fast-forward_660276?term=fast%20forward&page=1&position=7 + +# Unused for now: +https://www.flaticon.com/free-icon/resize_512182?term=resize&page=1&position=49 +https://www.flaticon.com/free-icon/undo_725004?term=undo&page=1&position=4 diff --git a/client/public/images/icons/fast-forward.svg b/client/public/images/icons/fast-forward.svg new file mode 100644 index 00000000..411b157c --- /dev/null +++ b/client/public/images/icons/fast-forward.svg @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"> +<g> + <g> + <path d="M504.171,239.489l-234.667-192c-6.357-5.227-15.189-6.293-22.656-2.773c-7.424,3.541-12.181,11.051-12.181,19.285v146.987 + L34.837,47.489c-6.379-5.227-15.189-6.293-22.656-2.773C4.757,48.257,0,55.767,0,64.001v384c0,8.235,4.757,15.744,12.181,19.285 + c2.923,1.365,6.059,2.048,9.152,2.048c4.843,0,9.621-1.643,13.504-4.821l199.829-163.499v146.987 + c0,8.235,4.757,15.744,12.181,19.285c2.923,1.365,6.059,2.048,9.152,2.048c4.843,0,9.621-1.643,13.504-4.821l234.667-192 + c4.949-4.053,7.829-10.112,7.829-16.512S509.12,243.543,504.171,239.489z"/> + </g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +<g> +</g> +</svg> diff --git a/client/public/images/icons/fast-forward_rev.svg b/client/public/images/icons/fast-forward_rev.svg new file mode 100644 index 00000000..6d4728d1 --- /dev/null +++ b/client/public/images/icons/fast-forward_rev.svg @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="Capa_1" + x="0px" + y="0px" + viewBox="0 0 512 512" + style="enable-background:new 0 0 512 512;" + xml:space="preserve" + sodipodi:docname="fast-forward_rev.svg" + inkscape:version="0.92.4 5da689c313, 2019-01-14"><metadata + id="metadata43"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs41" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="960" + inkscape:window-height="1060" + id="namedview39" + showgrid="false" + inkscape:zoom="0.4609375" + inkscape:cx="260.33898" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="Capa_1" /> +<g + id="g6" + transform="matrix(-1,0,0,1,511.999,0)"> + <g + id="g4"> + <path + d="m 504.171,239.489 -234.667,-192 c -6.357,-5.227 -15.189,-6.293 -22.656,-2.773 -7.424,3.541 -12.181,11.051 -12.181,19.285 V 210.988 L 34.837,47.489 C 28.458,42.262 19.648,41.196 12.181,44.716 4.757,48.257 0,55.767 0,64.001 v 384 c 0,8.235 4.757,15.744 12.181,19.285 2.923,1.365 6.059,2.048 9.152,2.048 4.843,0 9.621,-1.643 13.504,-4.821 L 234.666,301.014 v 146.987 c 0,8.235 4.757,15.744 12.181,19.285 2.923,1.365 6.059,2.048 9.152,2.048 4.843,0 9.621,-1.643 13.504,-4.821 l 234.667,-192 c 4.949,-4.053 7.829,-10.112 7.829,-16.512 0,-6.4 -2.879,-12.458 -7.828,-16.512 z" + id="path2" + inkscape:connector-curvature="0" /> + </g> +</g> +<g + id="g8"> +</g> +<g + id="g10"> +</g> +<g + id="g12"> +</g> +<g + id="g14"> +</g> +<g + id="g16"> +</g> +<g + id="g18"> +</g> +<g + id="g20"> +</g> +<g + id="g22"> +</g> +<g + id="g24"> +</g> +<g + id="g26"> +</g> +<g + id="g28"> +</g> +<g + id="g30"> +</g> +<g + id="g32"> +</g> +<g + id="g34"> +</g> +<g + id="g36"> +</g> +</svg> \ No newline at end of file diff --git a/client/public/images/icons/flip.svg b/client/public/images/icons/flip.svg new file mode 100644 index 00000000..be39895c --- /dev/null +++ b/client/public/images/icons/flip.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve"> +<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata> +<g><g transform="translate(0.000000,511.000000) scale(0.100000,-0.100000)"><path d="M1329.9,3511.5C58,2239.5,100.2,2289.4,100.2,2018.9c0-180.3,38.4-285.9,153.5-412.5c113.2-124.7,270.5-191.9,448.9-191.9c241.7,0,287.8,30.7,782.7,523.8l425.9,425.9V-776.4v-3140.6l40.3-111.3c49.9-130.5,176.5-264.8,314.6-331.9c145.8-69.1,364.5-67.1,512.2,5.8c130.4,65.2,266.7,207.2,316.6,335.7c32.6,86.3,34.5,232.1,40.3,3226.9l3.8,3134.8l418.2-414.4c253.2-251.3,450.8-431.7,502.6-458.5c72.9-38.4,115.1-46,268.6-46c213,0,310.8,36.5,439.3,165c126.6,126.6,165,228.3,165,429.7c0,149.6-7.7,186.1-51.8,268.6c-36.4,69.1-356.8,402.9-1179.9,1224C2717,4491.9,2565.4,4637.7,2515.6,4637.7S2314.1,4491.9,1329.9,3511.5z"/><path d="M7308,4610.8c-176.5-57.6-337.7-207.2-402.9-372.2c-32.6-86.3-34.5-243.7-40.3-3226.9l-3.8-3134.8l-418.2,414.4c-471.9,472-535.3,514.2-755.9,516.1c-157.3,1.9-253.2-24.9-366.4-99.7c-243.7-161.2-333.8-493.1-207.2-755.9c48-99.8,199.5-259,1185.6-1243.2c984.2-980.4,1135.8-1126.2,1185.6-1126.2s201.4,143.9,1181.8,1124.2c1272,1272,1233.6,1225.9,1233.6,1494.5c0,174.6-38.4,280.1-143.9,401c-122.8,140-266.7,205.3-456.6,205.3c-241.7,1.9-270.5-15.4-763.6-506.5l-447-443.2V998.3v3138.7l-40.3,111.3c-49.9,130.5-176.5,266.7-312.7,330C7618.8,4631.9,7419.2,4647.3,7308,4610.8z"/></g></g> +</svg> \ No newline at end of file diff --git a/client/public/images/icons/play.svg b/client/public/images/icons/play.svg new file mode 100644 index 00000000..d34a3680 --- /dev/null +++ b/client/public/images/icons/play.svg @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 494.148 494.148" style="enable-background:new 0 0 494.148 494.148;" xml:space="preserve"> +<g> + <path d="M405.284,201.188L130.804,13.28C118.128,4.596,105.356,0,94.74,0C74.216,0,61.52,16.472,61.52,44.044v406.124 + c0,27.54,12.68,43.98,33.156,43.98c10.632,0,23.2-4.6,35.904-13.308l274.608-187.904c17.66-12.104,27.44-28.392,27.44-45.884 + C432.632,229.572,422.964,213.288,405.284,201.188z"/> +</g> +</svg> diff --git a/client/public/images/icons/play_rev.svg b/client/public/images/icons/play_rev.svg new file mode 100644 index 00000000..8d562e90 --- /dev/null +++ b/client/public/images/icons/play_rev.svg @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="Layer_1" + x="0px" + y="0px" + viewBox="0 0 494.148 494.148" + style="enable-background:new 0 0 494.148 494.148;" + xml:space="preserve" + sodipodi:docname="play_rev.svg" + inkscape:version="0.92.4 5da689c313, 2019-01-14"><metadata + id="metadata11"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs9" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="960" + inkscape:window-height="1060" + id="namedview7" + showgrid="false" + inkscape:zoom="0.4775897" + inkscape:cx="251.2617" + inkscape:cy="247.07401" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="Layer_1" /> +<g + id="g4" + transform="matrix(-1,0,0,1,494.148,0)"> + <path + d="M 405.284,201.188 130.804,13.28 C 118.128,4.596 105.356,0 94.74,0 74.216,0 61.52,16.472 61.52,44.044 v 406.124 c 0,27.54 12.68,43.98 33.156,43.98 10.632,0 23.2,-4.6 35.904,-13.308 L 405.188,292.936 c 17.66,-12.104 27.44,-28.392 27.44,-45.884 0.004,-17.48 -9.664,-33.764 -27.344,-45.864 z" + id="path2" + inkscape:connector-curvature="0" /> +</g> +</svg> \ No newline at end of file diff --git a/client/public/images/icons/resize.svg b/client/public/images/icons/resize.svg new file mode 100644 index 00000000..a6edd50a --- /dev/null +++ b/client/public/images/icons/resize.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 362.027 362.027" style="enable-background:new 0 0 362.027 362.027;" xml:space="preserve"> +<g> + <g> + <polygon points="60.587,331.733 167.893,224.427 137.6,194.347 30.293,301.653 39.68,280.32 39.68,223.147 0,222.72 0,362.027 + 138.88,362.027 139.093,322.347 80.853,322.347 "/> + </g> + <g> + <polygon points="222.72,0 223.147,39.68 280.32,39.68 301.653,30.293 194.347,137.6 224.427,167.893 331.733,60.587 + 322.347,80.853 322.347,139.093 362.027,138.88 362.027,0 "/> + </g> + <g> + + <rect x="129.381" y="61.89" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -105.2146 168.4373)" width="42.667" height="298.668"/> + </g> + <g> + + <rect x="189.754" y="1.469" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -44.8074 193.4308)" width="42.667" height="298.668"/> + </g> +</g> +</svg> diff --git a/client/public/images/settings.svg b/client/public/images/icons/settings.svg similarity index 100% rename from client/public/images/settings.svg rename to client/public/images/icons/settings.svg diff --git a/client/public/images/icons/undo.svg b/client/public/images/icons/undo.svg new file mode 100644 index 00000000..3ab78b89 --- /dev/null +++ b/client/public/images/icons/undo.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 512.011 512.011" style="enable-background:new 0 0 512.011 512.011;" xml:space="preserve"> +<g> + <path d="M511.136,286.255C502.08,194.863,419.84,128.015,328,128.015H192v-80c0-6.144-3.52-11.744-9.056-14.432 + c-5.568-2.656-12.128-1.952-16.928,1.92l-160,128C2.208,166.575,0,171.151,0,176.015s2.208,9.44,5.984,12.512l160,128 + c2.912,2.304,6.464,3.488,10.016,3.488c2.368,0,4.736-0.512,6.944-1.568c5.536-2.688,9.056-8.288,9.056-14.432v-80h139.392 + c41.856,0,80,30.08,84.192,71.712c4.832,47.872-32.704,88.288-79.584,88.288H208c-8.832,0-16,7.168-16,16v64 + c0,8.832,7.168,16,16,16h128C438.816,480.015,521.472,391.151,511.136,286.255z"/> +</g> +</svg> diff --git a/client/src/App.vue b/client/src/App.vue index b98618bf..18425c0d 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -28,7 +28,7 @@ | {{ st.user.id > 0 ? (st.user.name || "@nonymous") : "Login" }} #divSettings.clickable(onClick="window.doClick('modalSettings')") span {{ st.tr["Settings"] }} - img(src="/images/settings.svg") + img(src="/images/icons/settings.svg") router-view .row .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index ed75c003..2a1a4474 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -23,11 +23,16 @@ div#baseGame ) #turnIndicator(v-if="showTurn") {{ turn }} #controls - button(@click="gotoBegin()") << - button(@click="undo()") < - button(v-if="canFlip" @click="flip()") ⇅ - button(@click="play()") > - button(@click="gotoEnd()") >> + button(@click="gotoBegin()") + img.inline(src="/images/icons/fast-forward_rev.svg") + button(@click="undo()") + img.inline(src="/images/icons/play_rev.svg") + button(v-if="canFlip" @click="flip()") + img.inline(src="/images/icons/flip.svg") + button(@click="play()") + img.inline(src="/images/icons/play.svg") + button(@click="gotoEnd()") + img.inline(src="/images/icons/fast-forward.svg") #belowControls #downloadDiv(v-if="allowDownloadPGN") a#download(href="#") @@ -504,10 +509,17 @@ export default { #controls margin: 0 auto text-align: center + display: flex button display: inline-block width: 20% margin: 0 + img.inline + height: 24px + padding-top: 5px + @media screen and (max-width: 767px) + img.inline + height: 18px #turnIndicator text-align: center diff --git a/server/models/User.js b/server/models/User.js index 5117c175..3b888502 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -20,7 +20,7 @@ const UserModel = checkNameEmail: function(o) { return ( - (!o.name || o.name.match(/^[\w]+$/)) && + (!o.name || o.name.match(/^[\w-]+$/)) && (!o.email || o.email.match(/^[\w.+-]+@[\w.+-]+$/)) ); }, -- 2.44.0