Fix all known bugs
* score mods no longer reset timer * tenths of second display is smoother * jam timer < 1:30 no longer makes rotate timer count up
This commit is contained in:
parent
1bfbd23145
commit
ed06e81318
|
@ -0,0 +1,70 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- Presentation Timer 2011 Neale Pickett -->
|
||||||
|
<!-- Placed in the public domain. -->
|
||||||
|
<!-- Time-stamp: "2011-11-17 14:26:50 neale" -->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>LADD Scoreboard</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style type="text/css">
|
||||||
|
@font-face {
|
||||||
|
font-family: Most Wazted;
|
||||||
|
src: url(Mostwasted.ttf);
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
background: #222 url(stone-cmp.jpg);
|
||||||
|
color: #eee;
|
||||||
|
font-family: Most Wazted, fantasy;
|
||||||
|
font-size: 5em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#scoreboard {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="scoreboard.css">
|
||||||
|
<script type="text/javascript" src="scoreboard.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onkeypress = key;
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table id="scoreboard">
|
||||||
|
<tr>
|
||||||
|
<td width="20%" class="team">
|
||||||
|
<span id="name-a" onclick="handle(event);">-</span>
|
||||||
|
<br>
|
||||||
|
<img src="" alt="" id="logo-a" onclick="handle(event);"
|
||||||
|
onerror="imgfail('a');">
|
||||||
|
</td>
|
||||||
|
<td width="60%" rowspan="2">
|
||||||
|
<p>
|
||||||
|
<span id="period" onclick="handle(event);">--:--</span>
|
||||||
|
<br>
|
||||||
|
<span id="periodtext" onclick="handle(event);">-</span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span id="jamtext">-</span>
|
||||||
|
<br>
|
||||||
|
<span id="jam" onclick="handle(event);">-:--.--</span>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td width="20%" class="team">
|
||||||
|
<span id="name-b" onclick="handle(event);">-</span>
|
||||||
|
<br>
|
||||||
|
<img src="" alt="" id="logo-b" onclick="handle(event);"
|
||||||
|
onerror="imgfail('b');">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span id="score-a" onclick="handle(event);">-</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="score-b" onclick="handle(event);">-</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,6 +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-21 21:52:54 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
|
||||||
|
@ -108,8 +109,7 @@ function startTimer(element, precision, duration, callback) {
|
||||||
if (itimer) {
|
if (itimer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
itimer = setInterval(display, 100);
|
itimer = setInterval(display, 33);
|
||||||
display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unpause if paused
|
// Unpause if paused
|
||||||
|
@ -135,7 +135,9 @@ function startTimer(element, precision, duration, callback) {
|
||||||
element.className = cn;
|
element.className = cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.stop();
|
||||||
duration = t;
|
duration = t;
|
||||||
|
beginning = (new Date()).getTime();
|
||||||
display(duration);
|
display(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +154,12 @@ function startTimer(element, precision, duration, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transition state machine based on state
|
// Transition state machine based on state
|
||||||
function transition() {
|
function transition(newstate) {
|
||||||
|
if ((newstate == undefined) || (newstate == state)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state = newstate;
|
||||||
|
|
||||||
var jt = document.getElementById("jam");
|
var jt = document.getElementById("jam");
|
||||||
var pt = document.getElementById("period");
|
var pt = document.getElementById("period");
|
||||||
var ptext = document.getElementById("periodtext");
|
var ptext = document.getElementById("periodtext");
|
||||||
|
@ -220,6 +227,7 @@ function teamname(t, v) {
|
||||||
function handle(event) {
|
function handle(event) {
|
||||||
var e = event.target;
|
var e = event.target;
|
||||||
var team = e.id.substr(e.id.length - 1);
|
var team = e.id.substr(e.id.length - 1);
|
||||||
|
var newstate;
|
||||||
|
|
||||||
if (state == TIMEOUT) {
|
if (state == TIMEOUT) {
|
||||||
// During startup, everything is editable
|
// During startup, everything is editable
|
||||||
|
@ -268,20 +276,19 @@ function handle(event) {
|
||||||
e.innerHTML = "Period " + period;
|
e.innerHTML = "Period " + period;
|
||||||
break;
|
break;
|
||||||
case "jam":
|
case "jam":
|
||||||
state = JAM;
|
newstate = JAM;
|
||||||
transition();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (e.id) {
|
switch (e.id) {
|
||||||
case "period":
|
case "period":
|
||||||
state = TIMEOUT;
|
newstate = TIMEOUT;
|
||||||
break;
|
break;
|
||||||
case "jam":
|
case "jam":
|
||||||
if (state == JAM) {
|
if (state == JAM) {
|
||||||
state = ROTATE;
|
newstate = ROTATE;
|
||||||
} else {
|
} else {
|
||||||
state = JAM;
|
newstate = JAM;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "name-a":
|
case "name-a":
|
||||||
|
@ -295,8 +302,8 @@ function handle(event) {
|
||||||
score(team, 1);
|
score(team, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
transition();
|
|
||||||
}
|
}
|
||||||
|
transition(newstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function imgfail(team) {
|
function imgfail(team) {
|
||||||
|
@ -312,14 +319,14 @@ function imgfail(team) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function key(e) {
|
function key(e) {
|
||||||
var s;
|
var newstate;
|
||||||
|
|
||||||
switch (String.fromCharCode(e.which || 0)) {
|
switch (String.fromCharCode(e.which || 0)) {
|
||||||
case " ":
|
case " ":
|
||||||
if (state == JAM) {
|
if (state == JAM) {
|
||||||
s = ROTATE;
|
newstate = ROTATE;
|
||||||
} else {
|
} else {
|
||||||
s = JAM;
|
newstate = JAM;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "j":
|
case "j":
|
||||||
|
@ -350,10 +357,7 @@ function key(e) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s != undefined) && (s != state)) {
|
transition(newstate);
|
||||||
state = s;
|
|
||||||
transition();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
|
|
Loading…
Reference in New Issue