From 16b28953ac4acc1ce3485a0122eb6512b5372a70 Mon Sep 17 00:00:00 2001
From: Neale Pickett
Date: Tue, 6 Dec 2011 22:39:54 -0700
Subject: [PATCH] Track timeouts
---
jammer.svg | 79 ++++++++++++++++++++-----------------------------
scoreboard.css | 11 ++++++-
scoreboard.html | 4 ++-
scoreboard.js | 53 +++++++++++++++++++++++++--------
4 files changed, 86 insertions(+), 61 deletions(-)
diff --git a/jammer.svg b/jammer.svg
index c0a801b..63a2fd2 100644
--- a/jammer.svg
+++ b/jammer.svg
@@ -7,7 +7,6 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="468.20706"
@@ -15,15 +14,18 @@
id="svg2"
version="1.1"
inkscape:version="0.48.2 r9819"
- sodipodi:docname="New document 1">
+ sodipodi:docname="jammer.svg"
+ inkscape:export-filename="/home/neale/src/scoreboard/jammer.png"
+ inkscape:export-xdpi="38.439999"
+ inkscape:export-ydpi="38.439999">
-
+
+
+
+
- Jammer
-
- Lead
diff --git a/scoreboard.css b/scoreboard.css
index c34b45a..a932680 100644
--- a/scoreboard.css
+++ b/scoreboard.css
@@ -17,12 +17,21 @@
max-height: 2em;
}
-#score-a, #score-b, #jam, #period {
+#timeouts-a, #timeouts-b, #score-a, #score-b, #jam, #period {
color: yellow;
font-family: sans-serif;
font-weight: bold;
font-size: 133%;
}
+#timeouts-a, #timeouts-b {
+ font-size: 50%;
+}
+#timeouts-a {
+ float: left;
+}
+#timeouts-b {
+ float: right;
+}
#jam, #period {
background: #000;
font-size: 150%;
diff --git a/scoreboard.html b/scoreboard.html
index 1a078e6..02f33f6 100644
--- a/scoreboard.html
+++ b/scoreboard.html
@@ -1,7 +1,7 @@
-
+
LADD Scoreboard
@@ -44,7 +44,9 @@
-
+ 0
-
+ 0
-:--.--
diff --git a/scoreboard.js b/scoreboard.js
index cfcd066..3414400 100644
--- a/scoreboard.js
+++ b/scoreboard.js
@@ -1,7 +1,7 @@
/*
* LADD Roller Derby Scoreboard
* Copyright © 2011 Neale Pickett
- * 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
* it under the terms of the GNU General Public License as published by
@@ -24,11 +24,13 @@
/* State names */
-var STARTUP = 0;
-var JAM = 1;
-var ROTATE = 2;
-var TIMEOUT = 3;
-var BREAK = 4;
+var STARTUP = 0; // !P 30:00 !J 2:00
+var JAM = 1; // P J 2:00
+var ROTATE = 2; // P J 1:00
+var TIMEOUT = 3; // !P J 1:00
+
+var periods = ["Period 1", "Break", "Period 2"];
+var period = 0;
var state = STARTUP;
@@ -181,6 +183,15 @@ function score(team, points) {
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};
function logo_rotate(team, dir) {
var t;
@@ -223,8 +234,14 @@ function handle(event) {
} else {
logo_rotate(team, event.shiftKey?-1:1);
}
+ } else {
+ score(team, -1);
}
break;
+ case "timeouts-a":
+ case "timeouts-b":
+ adjust_timeouts(team, -1);
+ break;
case "period":
if ((state == STARTUP) || (state == TIMEOUT)) {
var r = prompt("Enter new time for period clock", e.innerHTML);
@@ -318,16 +335,28 @@ function key(e) {
transition(newstate);
}
+function dfl(v, d) {
+ if (v == undefined) {
+ return d;
+ } else {
+ return v;
+ }
+}
+
function start() {
var p = document.getElementById("period");
var j = document.getElementById("jam");
- e("name-a").innerHTML = localStorage.rdsb_name_a || "Home";
- e("name-b").innerHTML = localStorage.rdsb_name_b || "Visitor";
- e("logo-a").src = localStorage.rdsb_logo_a || "skate.png";
- e("logo-b").src = localStorage.rdsb_logo_b || "skate.png";
- e("score-a").innerHTML = localStorage.rdsb_score_a || 0;
- e("score-b").innerHTML = localStorage.rdsb_score_b || 0;
+ e("name-a").innerHTML = dfl(localStorage.rdsb_name_a, "Home");
+ e("name-b").innerHTML = dfl(localStorage.rdsb_name_b, "Visitor");
+ e("logo-a").src = dfl(localStorage.rdsb_logo_a, "#");
+ e("logo-b").src = dfl(localStorage.rdsb_logo_b, "#");
+ e("score-a").innerHTML = dfl(localStorage.rdsb_score_a, 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;
e("periodtext").innerHTML = "Period " + period;