From 82c97a9cd676ffa47367616dd19c8d898d943976 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Tue, 22 Nov 2011 00:45:52 -0700 Subject: [PATCH] new STARTUP state --- TODO.txt | 4 +++ scoreboard.css | 1 + scoreboard.js | 87 ++++++++++++++++++++++---------------------------- 3 files changed, 43 insertions(+), 49 deletions(-) create mode 100644 TODO.txt diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..624f7af --- /dev/null +++ b/TODO.txt @@ -0,0 +1,4 @@ +* Star indicator for lead jammer +* Add a halftime state +* Easier team name/logo selection from database +* Per-team timeout counter diff --git a/scoreboard.css b/scoreboard.css index 7c214a7..58e4e47 100644 --- a/scoreboard.css +++ b/scoreboard.css @@ -21,6 +21,7 @@ color: yellow; font-family: sans-serif; font-weight: bold; + font-size: 133%; } #jam, #period { background: #000; diff --git a/scoreboard.js b/scoreboard.js index cf9f9aa..6175f41 100644 --- a/scoreboard.js +++ b/scoreboard.js @@ -1,7 +1,7 @@ /* * LADD Roller Derby Scoreboard * Copyright © 2011 Neale Pickett - * Time-stamp: <2011-11-21 23:17:49 neale> + * Time-stamp: <2011-11-22 00:20:00 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 @@ -17,11 +17,12 @@ * along with this program. If not, see . */ -var TIMEOUT = 0; +var STARTUP = 0; var JAM = 1; var ROTATE = 2; +var TIMEOUT = 3; -var state = TIMEOUT; +var state = STARTUP; function pad(i) { if (i < 10) { @@ -233,29 +234,25 @@ function handle(event) { var team = e.id.substr(e.id.length - 1); var newstate; - if (state == TIMEOUT) { - // During startup, everything is editable - switch (e.id) { - case "name-a": - case "name-b": + switch (e.id) { + case "name-a": + case "name-b": + if (state == STARTUP) { teamname(team, prompt("Enter team " + team + " name", e.innerHTML)); - break; - case "logo-a": - case "logo-b": + } + break; + case "logo-a": + case "logo-b": + if (state == STARTUP) { var u = prompt("Enter URL to team " + team + " logo"); if (! u) return; e.src = u; e.plastic = false; - break; - case "score-a": - case "score-b": - var s = prompt("Enter team " + team + " score", e.innerHTML); - if (! s) return; - - e.innerHTML = s; - break; - case "period": + } + break; + case "period": + if ((state == STARTUP) || (state == TIMEOUT)) { var r = prompt("Enter new time for period clock", e.innerHTML); if (! r) return; @@ -269,41 +266,33 @@ function handle(event) { for (var i in t) { var v = t[i]; - sec = (sec * 60) + Number(v); } e.reset(sec*1000); - break; - case "periodtext": - period = 3 - period; - e.innerHTML = "Period " + period; - break; - case "jam": - newstate = JAM; - break; - } - } else { - switch (e.id) { - case "period": + } else { newstate = TIMEOUT; - break; - case "jam": - if (state == JAM) { - newstate = ROTATE; - } else { - newstate = JAM; - } - break; - case "score-a": - case "score-b": - if (event.shiftKey == 1) { - score(team, -1); - } else { - score(team, 1); - } - return; } + break; + case "periodtext": + period = 3 - period; + e.innerHTML = "Period " + period; + break; + case "jam": + if (state == JAM) { + newstate = ROTATE; + } else { + newstate = JAM; + } + break; + case "score-a": + case "score-b": + if (event.shiftKey == 1) { + score(team, -1); + } else { + score(team, 1); + } + break; } transition(newstate); }