Track timeouts

This commit is contained in:
Neale Pickett 2011-12-06 22:39:54 -07:00
parent f4c6764f37
commit 16b28953ac
4 changed files with 86 additions and 61 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -17,12 +17,21 @@
max-height: 2em; max-height: 2em;
} }
#score-a, #score-b, #jam, #period { #timeouts-a, #timeouts-b, #score-a, #score-b, #jam, #period {
color: yellow; color: yellow;
font-family: sans-serif; font-family: sans-serif;
font-weight: bold; font-weight: bold;
font-size: 133%; font-size: 133%;
} }
#timeouts-a, #timeouts-b {
font-size: 50%;
}
#timeouts-a {
float: left;
}
#timeouts-b {
float: right;
}
#jam, #period { #jam, #period {
background: #000; background: #000;
font-size: 150%; font-size: 150%;

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Presentation Timer 2011 Neale Pickett --> <!-- Presentation Timer 2011 Neale Pickett -->
<!-- Placed in the public domain. --> <!-- Placed in the public domain. -->
<!-- Time-stamp: "2011-11-23 15:41:24 neale" --> <!-- Time-stamp: "2011-12-06 22:24:18 neale" -->
<html> <html>
<head> <head>
<title>LADD Scoreboard</title> <title>LADD Scoreboard</title>
@ -44,7 +44,9 @@
<span id="periodtext" onclick="handle(event);">-</span> <span id="periodtext" onclick="handle(event);">-</span>
</p> </p>
<p> <p>
<span id="timeouts-a" onclick="handle(event);">0</span>
<span id="jamtext">-</span> <span id="jamtext">-</span>
<span id="timeouts-b" onclick="handle(event);">0</span>
<br> <br>
<span id="jam" onclick="handle(event);">-:--.--</span> <span id="jam" onclick="handle(event);">-:--.--</span>
</p> </p>

View File

@ -1,7 +1,7 @@
/* /*
* LADD Roller Derby Scoreboard * LADD Roller Derby Scoreboard
* Copyright © 2011 Neale Pickett <neale@woozle.org> * Copyright © 2011 Neale Pickett <neale@woozle.org>
* Time-stamp: <2011-11-23 20:01:35 neale> * Time-stamp: <2011-12-06 22:26:05 neale>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -24,11 +24,13 @@
/* State names */ /* State names */
var STARTUP = 0; var STARTUP = 0; // !P 30:00 !J 2:00
var JAM = 1; var JAM = 1; // P J 2:00
var ROTATE = 2; var ROTATE = 2; // P J 1:00
var TIMEOUT = 3; var TIMEOUT = 3; // !P J 1:00
var BREAK = 4;
var periods = ["Period 1", "Break", "Period 2"];
var period = 0;
var state = STARTUP; var state = STARTUP;
@ -181,6 +183,15 @@ function score(team, points) {
te.innerHTML = ts; te.innerHTML = ts;
} }
function adjust_timeouts(team, dir) {
var i;
var t = e("timeouts-" + team);
t.val = (t.val + 4 + dir) % 4;
t.innerHTML = t.val;
}
var preset = {a:-1, b:-1}; var preset = {a:-1, b:-1};
function logo_rotate(team, dir) { function logo_rotate(team, dir) {
var t; var t;
@ -223,8 +234,14 @@ function handle(event) {
} else { } else {
logo_rotate(team, event.shiftKey?-1:1); logo_rotate(team, event.shiftKey?-1:1);
} }
} else {
score(team, -1);
} }
break; break;
case "timeouts-a":
case "timeouts-b":
adjust_timeouts(team, -1);
break;
case "period": case "period":
if ((state == STARTUP) || (state == TIMEOUT)) { if ((state == STARTUP) || (state == TIMEOUT)) {
var r = prompt("Enter new time for period clock", e.innerHTML); var r = prompt("Enter new time for period clock", e.innerHTML);
@ -318,16 +335,28 @@ function key(e) {
transition(newstate); transition(newstate);
} }
function dfl(v, d) {
if (v == undefined) {
return d;
} else {
return v;
}
}
function start() { function start() {
var p = document.getElementById("period"); var p = document.getElementById("period");
var j = document.getElementById("jam"); var j = document.getElementById("jam");
e("name-a").innerHTML = localStorage.rdsb_name_a || "Home"; e("name-a").innerHTML = dfl(localStorage.rdsb_name_a, "Home");
e("name-b").innerHTML = localStorage.rdsb_name_b || "Visitor"; e("name-b").innerHTML = dfl(localStorage.rdsb_name_b, "Visitor");
e("logo-a").src = localStorage.rdsb_logo_a || "skate.png"; e("logo-a").src = dfl(localStorage.rdsb_logo_a, "#");
e("logo-b").src = localStorage.rdsb_logo_b || "skate.png"; e("logo-b").src = dfl(localStorage.rdsb_logo_b, "#");
e("score-a").innerHTML = localStorage.rdsb_score_a || 0; e("score-a").innerHTML = dfl(localStorage.rdsb_score_a, 0);
e("score-b").innerHTML = localStorage.rdsb_score_b || 0; e("score-b").innerHTML = dfl(localStorage.rdsb_score_b, 0);
e("timeouts-a").val = dfl(localStorage.rdsb_timeout_a, 3);
e("timeouts-b").val = dfl(localStorage.rdsb_timeout_b, 3);
adjust_timeouts("a", 0);
adjust_timeouts("b", 0);
period = localStorage.rdsb_period || 1; period = localStorage.rdsb_period || 1;
e("periodtext").innerHTML = "Period " + period; e("periodtext").innerHTML = "Period " + period;