dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 8eab04e13b16964b8aee4d45c8832cb55b4e9659
parent c5e649205b80169f7dc17a9ef6511c861ed3c5ea
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun, 11 Jun 2023 20:08:54 -0700

fix last move color

Diffstat:
Mpkg/web/handlers/interceptors/chess.go | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go @@ -193,11 +193,11 @@ input[type=checkbox]:checked + label { {{ $sq := Square $id }} {{ $pidStr := GetPid $sq }} {{ $p := PieceFromSq $sq }} - <td class="square square_{{ $id }}" style="background-color: {{ if IsLastMove $sq }}{{ $.LastMoveColor }}{{ else }}transparent{{ end }};"> + <td class="square square_{{ $id }}" style="background-color: {{ if IsLastMove $sq }}{{ $.LastMoveColor | css }}{{ else }}transparent{{ end }};"> <div id="{{ $pidStr }}" class="img" style=" left: calc({{ $col }}*12.5%%); top: calc({{ $row }}*12.5%%); background-image: url(/public/img/chess/{{ GetPieceFileName $p }}.png); - background-color: {{ if PieceInCheck $p }}{{ .CheckColor }}{{ else }}transparent{{ end }};"></div> + background-color: {{ if PieceInCheck $p }}{{ .CheckColor | css }}{{ else }}transparent{{ end }};"></div> </td> {{ end }} </tr> @@ -220,6 +220,7 @@ input[type=checkbox]:checked + label { "GetPid": func(sq chess.Square) string { return g.PiecesCache[sq] }, "Square": func(id int) chess.Square { return chess.Square(id) }, "PieceFromSq": func(sq chess.Square) chess.Piece { return boardMap[sq] }, + "css": func(s string) template.CSS { return template.CSS(s) }, } var buf bytes.Buffer