dkforest

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

commit d4779434018d5a4e8b95692793236ce86e977d4a
parent 1491764cdb5b0712eb1512f33dd92d3a0b4d7d72
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 19 Dec 2023 02:16:33 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker/poker.go | 29++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1765,10 +1765,11 @@ func buildSeatsHtml(g *PokerGame, authUser *database.User) (html string) { } html += `<div>` for i := range *gPlayers { - html += `<div class="seat" id="seat` + itoa(i+1) + `"> -<iframe src="/poker/` + g.roomID.String() + `/sit/` + itoa(i+1) + `" class="takeSeat takeSeat` + itoa(i+1) + `"></iframe>` + idxStr := itoa(i + 1) + html += `<div class="seat" id="seat` + idxStr + `">` + html += ` <iframe src="/poker/` + g.roomID.String() + `/sit/` + idxStr + `" class="takeSeat takeSeat` + idxStr + `"></iframe>` html += ` <div class="inner"></div>` - html += ` <div id="seat` + itoa(i+1) + `_cash" class="cash"></div>` + html += ` <div id="seat` + idxStr + `_cash" class="cash"></div>` html += `</div>` } html += `</div>` @@ -1783,28 +1784,26 @@ func drawSeatsStyle(authUser *database.User, g *PokerGame) string { seated := g.isSeated(authUser.ID) g.Players.RWith(func(players *[]*seatedPlayer) { for i, p := range *players { - if p != nil || seated { - html += `.takeSeat` + itoa(i+1) + ` { display: none; }` - } else { - html += `.takeSeat` + itoa(i+1) + ` { display: block; }` - } + idxStr := itoa(i + 1) + display := utils.Ternary(p != nil || seated, "none", "block") + html += `.takeSeat` + idxStr + ` { display: ` + display + `; }` if p != nil { pUserID := p.userID pUsername := p.username if pUserID == authUser.ID { - html += `#seat` + itoa(i+1) + ` { border: 2px solid #0d1b8f; }` + html += `#seat` + idxStr + ` { border: 2px solid #0d1b8f; }` } - html += `#seat` + itoa(i+1) + ` .inner:before { content: "` + pUsername.String() + `"; }` - html += `#seat` + itoa(i+1) + `_cash:before { content: "` + itoa2(p.getCash()) + `"; }` + html += `#seat` + idxStr + ` .inner:before { content: "` + pUsername.String() + `"; }` + html += `#seat` + idxStr + `_cash:before { content: "` + itoa2(p.getCash()) + `"; }` if ongoing != nil { if op := ongoing.getPlayer(pUserID); op != nil && op.getBet() > 0 { - html += `#seat` + itoa(i+1) + `Pot:before { content: "` + itoa2(op.getBet()) + `"; }` + html += `#seat` + idxStr + `Pot:before { content: "` + itoa2(op.getBet()) + `"; }` } } } else { - html += `#seat` + itoa(i+1) + ` { border: 1px solid #333; }` - html += `#seat` + itoa(i+1) + ` .inner:before { content: ""; }` - html += `#seat` + itoa(i+1) + `_cash:before { content: ""; }` + html += `#seat` + idxStr + ` { border: 1px solid #333; }` + html += `#seat` + idxStr + ` .inner:before { content: ""; }` + html += `#seat` + idxStr + `_cash:before { content: ""; }` } } })