commit 1fb92b09915718f3c50a2c06829e26d360ab4559
parent 0b434359390c5f375179d471e94edfc5362da8b9
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 16 Jun 2023 19:38:20 -0700
useless code
Diffstat:
1 file changed, 0 insertions(+), 28 deletions(-)
diff --git a/pkg/web/handlers/interceptors/chess.go b/pkg/web/handlers/interceptors/chess.go
@@ -558,40 +558,12 @@ func (g *ChessGame) drawPlayerCard(moveIdx int, key string, isBlack, isSpectator
}
fns := template.FuncMap{
- "commentHTML": func(s string) template.HTML {
- return template.HTML(fmt.Sprintf("<!-- %s -->", s))
- },
"attr": func(s string) template.HTMLAttr {
return template.HTMLAttr(s)
},
- "plus": func(v int) int { return v + 1 },
"pct": func(v float64) string {
return fmt.Sprintf("%.1f%%", v)
},
- "abs": func(v int) int { return int(math.Abs(float64(v))) },
- "cp": func(v int) string {
- return fmt.Sprintf("%.2f", float64(v)/100)
- },
- "fmtMove": func(idx int) string {
- idx += 2
- if idx%2 == 0 {
- return fmt.Sprintf("%d.", idx/2)
- }
- return fmt.Sprintf("%d...", idx/2)
- },
- "renderCP": func(color string, v Score) int {
- const maxH = 120 // Max graph height
- const maxV = 1200 // Max cp value. Anything bigger should take 100% of graph height space.
- absV := int(math.Abs(float64(v.CP)))
- absV = utils.MinInt(absV, maxV)
- absV = absV * maxH / maxV
- if v.CP == 0 && v.Mate != 0 {
- if (color == "white" && v.Mate < 0) || (color == "black" && v.Mate > 0) {
- absV = maxH
- }
- }
- return absV
- },
}
var buf1 bytes.Buffer