commit 2886c437abf5785e24ba23303ee440c6a4f15ce0
parent 66c22b0c95023e50c457afc13b2585e688af2931
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sun, 11 Jun 2023 16:26:20 -0700
cleanup
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -5215,7 +5215,7 @@ Loop:
animate(payload.Move.S1(), payload.Move.S2(), payload.IDStr1)
if payload.IDStr2 != "" {
- send(`<style>#` + payload.IDStr2 + ` { display: none; }</style>`)
+ send(fmt.Sprintf(`<style>#%s { display: none; }</style>`, payload.IDStr2))
}
if payload.Move.Promo() != chess.NoPieceType {
@@ -5254,16 +5254,17 @@ Loop:
// Render last move
send(`<style>.square { background-color: transparent !important; }</style>`)
- send(fmt.Sprintf(`<style>.square_%d, .square_%d { background-color: `+interceptors.LastMoveColor+` !important; }</style>`, int(payload.Move.S1()), int(payload.Move.S2())))
+ send(fmt.Sprintf(`<style>.square_%d, .square_%d { background-color: %s !important; }</style>`,
+ int(payload.Move.S1()), int(payload.Move.S2()), interceptors.LastMoveColor))
// Reset kings background to transparent
- send(`<style>#` + whiteKingID + ` { background-color: transparent !important; }</style>`)
- send(`<style>#` + blackKingID + ` { background-color: transparent !important; }</style>`)
+ send(fmt.Sprintf(`<style>#%s { background-color: transparent !important; }</style>`, whiteKingID))
+ send(fmt.Sprintf(`<style>#%s { background-color: transparent !important; }</style>`, blackKingID))
// Render "checks" red background
if payload.CheckW {
- send(`<style>#` + whiteKingID + ` { background-color: ` + interceptors.CheckColor + ` !important; }</style>`)
+ send(fmt.Sprintf(`<style>#%s { background-color: %s !important; }</style>`, whiteKingID, interceptors.CheckColor))
} else if payload.CheckB {
- send(`<style>#` + blackKingID + ` { background-color: ` + interceptors.CheckColor + ` !important; }</style>`)
+ send(fmt.Sprintf(`<style>#%s { background-color: %s !important; }</style>`, blackKingID, interceptors.CheckColor))
}
c.Response().Flush()