mirror of https://github.com/dirtbags/moth.git
Have cycling option for scoreboard
This commit is contained in:
parent
fd8f53dae3
commit
7aa23aadb5
|
@ -95,7 +95,7 @@ BEGIN {
|
||||||
|
|
||||||
# Get team colors and names
|
# Get team colors and names
|
||||||
for (team in teams) {
|
for (team in teams) {
|
||||||
fn = "/var/lib/ctf/teams/colors/" team ".color"
|
fn = "/var/lib/ctf/teams/colors/" team
|
||||||
getline colors_by_team[team] < fn
|
getline colors_by_team[team] < fn
|
||||||
close(fn)
|
close(fn)
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ BEGIN {
|
||||||
|
|
||||||
# Provide raw data for the chart
|
# Provide raw data for the chart
|
||||||
print " <script type=\"application/javascript\">"
|
print " <script type=\"application/javascript\">"
|
||||||
print "function draw() {"
|
print "function init() {"
|
||||||
printf(" plot(\"chart\", %d, %.2f, {\n", tslen, maxscore)
|
printf(" plot(\"chart\", %d, %.2f, {\n", tslen, maxscore)
|
||||||
c = 0
|
c = 0
|
||||||
for (team in teams) {
|
for (team in teams) {
|
||||||
|
@ -143,8 +143,12 @@ BEGIN {
|
||||||
printf("]],\n");
|
printf("]],\n");
|
||||||
}
|
}
|
||||||
print " });"
|
print " });"
|
||||||
|
print " if (location.hash) {"
|
||||||
|
print " cycle();"
|
||||||
|
print " setInterval(cycle, 10000);"
|
||||||
print " }"
|
print " }"
|
||||||
print "window.onload = draw;"
|
print "}"
|
||||||
|
print "window.onload = init;"
|
||||||
print " </script>"
|
print " </script>"
|
||||||
|
|
||||||
# Set up team colors and a few page-specific styles
|
# Set up team colors and a few page-specific styles
|
||||||
|
@ -161,7 +165,7 @@ BEGIN {
|
||||||
print " <body>"
|
print " <body>"
|
||||||
print " <h1>Scoreboard</h1>"
|
print " <h1>Scoreboard</h1>"
|
||||||
print "<p id=\"debug\"></p>"
|
print "<p id=\"debug\"></p>"
|
||||||
print " <table class=\"scoreboard\">"
|
print " <table id=\"scoreboard\">"
|
||||||
print " <tr>"
|
print " <tr>"
|
||||||
print " <th>Overall</th>"
|
print " <th>Overall</th>"
|
||||||
|
|
||||||
|
|
|
@ -105,3 +105,16 @@ function restore(cls) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var state = 0;
|
||||||
|
function cycle() {
|
||||||
|
if (state == 0) {
|
||||||
|
v = document.getElementById("scoreboard");
|
||||||
|
i = document.getElementById("chart");
|
||||||
|
} else {
|
||||||
|
v = document.getElementById("chart");
|
||||||
|
i = document.getElementById("scoreboard");
|
||||||
|
}
|
||||||
|
v.style.display = "block";
|
||||||
|
i.style.display = "none";
|
||||||
|
state = (state + 1) % 2;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue