dkforest

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

commit 41230235b5175b6c0324ef7833b659c9d7797dce
parent f67c9f4f89732ba341d06996886b06c7f2c2a896
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  1 Jun 2023 07:11:47 -0700

cleanup code

Diffstat:
Mpkg/odometer/odometer.go | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/pkg/odometer/odometer.go b/pkg/odometer/odometer.go @@ -32,7 +32,8 @@ func (o *Odometer) Css() string { .odometer .outer .top { z-index: 2; } .odometer .outer .inner { visibility: visible; animation-name: inner_frames; animation-duration: 3s; } @keyframes inner_frames { 0% { visibility: hidden; } 99% { visibility: hidden; } 100% { visibility: visible; } }` - for i := 0; i < len(o.s); i++ { + l := len(o.s) + for i := 0; i < l; i++ { out += fmt.Sprintf(` .odometer .odometer%d:before { visibility: hidden; content: "%c"; animation-name: odometer%d_frames; animation-duration: 3s; } @keyframes odometer%d_frames {`, i, o.s[i], i, i) @@ -41,11 +42,7 @@ func (o *Odometer) Css() string { step := 100.0 / float64(n) pct := 0.0 for j := 0; j <= n; j++ { - if (i == 0 && j == 15) || - (i == 1 && j == 16) || - (i == 2 && j == 17) || - (i == 3 && j == 18) || - (i == 4 && j == 19) { + if j == n-(l-i) { break } if pct >= 95 {