Don’t you hate it on game nights that your jeopardy buzzers’ batteries are dead?
Or do you really hate those shitty plastic buzzers that never works in your favor?
No worries, PorreKaj and Universal Dashboard got you covered!
With just a host PC, a few phones, and 25 lines of code you’re ready to to save the evening!
How does it work?
The default page is a simple input form, that takes “Team name” and adds that to an @Cache object with a timestamp that includes milliseconds.
The overview page is a simple grid that shows the entries and sorts by timestamp.
Could it be made smarter? sure, announcing the winner with a UDSweetalert would be nice.
But this can be built from scratch in the time it takes your significant other and her family to clean up the plastic remains of the buzzer you just destroyed.
A testament to the flexibilty of UD
$PageOverview = New-UDPage -Name Overview -Icon list -content {
New-UDCard -Title "Fastest contestant" -Content {
New-UDGrid -Id "TimesGrid" -Headers @("Name", "Time") -Properties @("Name", "Time") -DefaultSortColumn "Time" -Endpoint {
$Cache:Times | Out-UDGridData
}
New-UDButton -Text "Clear" -OnClick {
$Cache:Times = New-Object System.Collections.Generic.List[System.Object]
Invoke-UDRedirect -Url "/Overview/"
}
}
}
$PageContestant= New-UDPage -Name Contestants -Icon list -Endpoint {
New-UDInput -Content {
New-UDInputField -Name "Name" -Type textbox -Placeholder "Enter Team Name"
} -Endpoint {
param($Name)
$Timestamp = (get-date).ToString('yyyy-MM-dd-HH-mm-ss-fff')
$obj = [PSCustomObject]@{Name="$Name";Time=$Timestamp}
$Cache:Times.Add($obj) | Out-Null
Sync-UDElement -Id "TimesGrid" -Broadcast
} -SubmitText "BUZZ"
}
$dash = New-UDDashboard -Title "Jeopardy" -Theme (get-udtheme darkdefault) -Pages @($PageContestant,$PageOverview)
Start-UDDashboard -Dashboard $dash -Name "Jeopardy" -Port 1001 -AutoReload