keybindings, html/css cleanup

This commit is contained in:
Neale Pickett 2011-11-15 21:56:33 -07:00
parent 2c30d72b42
commit fbe83d92a4
3 changed files with 66 additions and 35 deletions

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- Presentation Timer 2011 Neale Pickett -->
<!-- Placed in the public domain. -->
<!-- Time-stamp: "2011-11-14 16:44:07 neale" -->
<!-- Time-stamp: "2011-11-15 20:55:47 neale" -->
<html>
<head>
<title>LADD Scoreboard</title>
@ -10,38 +10,38 @@
<script type="text/javascript" src="scoreboard.js"></script>
</head>
<body>
<table onclick="handle(event);">
<table>
<tr>
<td width="20%" class="team">
<span id="name-a">-</span>
<span id="name-a" onclick="handle(event);">-</span>
<br>
<img src="" alt="" class="logo" id="logo-a">
<img src="" alt="" id="logo-a" onclick="handle(event);">
</td>
<td width="60%" rowspan="2">
<p>
<span class="timer" id="period">--:--</span>
<span id="period" onclick="handle(event);">--:--</span>
<br>
<span id="periodtext">-</span>
<span id="periodtext" onclick="handle(event);">-</span>
</p>
<p>
<span id="jamtext">-</span>
<br>
<span class="timer" id="jam">-:--.--</span>
<span id="jam" onclick="handle(event);">-:--.--</span>
</p>
</td>
<td width="20%" class="team">
<span id="name-b">-</span>
<span id="name-b" onclick="handle(event);">-</span>
<br>
<img src="" alt="" class="logo" id="logo-b">
<img src="" alt="" id="logo-b" onclick="handle(event);">
</td>
</tr>
<tr>
<td>
<span id="score-a" class="number">-</span>
<span id="score-a" onclick="handle(event);">-</span>
</td>
<td>
<span id="score-b" class="number">-</span>
<span id="score-b" onclick="handle(event);">-</span>
</td>
</tr>
</table>

View File

@ -173,13 +173,6 @@ function save() {
}
// A timer was clicked
// 0 = period timer
// 1 = jam timer
function timer(tn) {
transition();
}
function e(id) {
return document.getElementById(id);
}
@ -200,11 +193,10 @@ function teamname(t, v) {
function handle(event) {
var e = event.target;
var team = e.id.substr(e.id.length - 1);
if (state == TIMEOUT) {
// During startup, everything is editable
var team = e.id.substr(e.id.length - 1);
switch (e.id) {
case "name-a":
case "name-b":
@ -243,6 +235,7 @@ function handle(event) {
break;
case "jam":
state = JAM;
transition();
break;
}
} else {
@ -259,23 +252,64 @@ function handle(event) {
break;
case "name-a":
case "logo-a":
score("a", -1);
break;
case "score-a":
score("a", 1);
break;
case "name-b":
case "logo-b":
score("b", -1);
score(team, -1);
break;
case "score-a":
case "score-b":
score("b", 1);
score(team, 1);
break;
}
transition();
}
}
function key(e) {
var s;
switch (String.fromCharCode(e.which || 0)) {
case " ":
if (state == JAM) {
s = ROTATE;
} else {
s = JAM;
}
break;
case "j":
s = JAM;
break;
case "r":
case "l": // WFTDA TV uses this
s = ROTATE;
break;
case "t":
s = TIMEOUT;
break;
case "a":
case ",":
score('a', 1);
break;
case "b":
case ".":
score('b', 1);
break;
case "A":
case "<":
score('a', -1);
break;
case "B":
case ">":
score('b', -1);
break;
}
if ((s != undefined) && (s != state)) {
state = s;
transition();
}
}
function start() {
var p = document.getElementById("period");
var j = document.getElementById("jam");
@ -291,7 +325,7 @@ function start() {
startTimer(j, 1, 120000);
save_itimer = setInterval(save, 1000);
transition();
}
window.onload = start;
window.onkeypress = key;

View File

@ -23,21 +23,18 @@ p {
margin: 0;
}
.team {
font-family: Comunicacion Digital;
font-family: Comunicacion Digital, sans-serif;
}
img.logo {
.team img {
max-width: 100%;
}
.number {
#score-a, #score-b, #jam, #period {
color: yellow;
font-family: sans-serif;
font-weight: bold;
}
.timer {
#jam, #period {
background: #000;
color: yellow;
font-family: sans-serif;
font-weight: bold;
font-size: 150%;
border-radius: 15px;
padding: 0 0.1em;