Fix keybindings

This commit is contained in:
Neale Pickett 2011-11-21 23:20:25 -07:00
parent ed06e81318
commit 81e2fa5e14
1 changed files with 17 additions and 15 deletions

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-21 21:52:54 neale> * Time-stamp: <2011-11-21 23:17:49 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
@ -42,6 +42,7 @@ function startTimer(element, precision, duration, callback) {
var remain = element.remaining(); var remain = element.remaining();
var min = Math.floor(Math.abs(remain / 60000)); var min = Math.floor(Math.abs(remain / 60000));
var sec = Math.abs(remain / 1000) % 60; var sec = Math.abs(remain / 1000) % 60;
var t = "";
/* Scale sec to precision, since toFixed only rounds */ /* Scale sec to precision, since toFixed only rounds */
sec = Math.floor(sec * precmult) / precmult; sec = Math.floor(sec * precmult) / precmult;
@ -60,16 +61,19 @@ function startTimer(element, precision, duration, callback) {
} }
} }
element.innerHTML = "";
if ((duration > 0) && (remain <= 0)) { if ((duration > 0) && (remain <= 0)) {
// Timer has run out // Timer has run out
duration = 0; duration = 0;
element.stop(); element.stop();
element.innerHTML = "0:0" + (0).toFixed(precision); t = "0:0" + (0).toFixed(precision);
if (callback) callback(); if (callback) callback();
return; return;
} }
element.innerHTML += min + ":" + pad(sec.toFixed(precision)); t += min + ":" + pad(sec.toFixed(precision));
if (t != element.innerHTML) {
element.innerHTML = t;
}
} }
// Is element timer running? // Is element timer running?
@ -238,7 +242,7 @@ function handle(event) {
break; break;
case "logo-a": case "logo-a":
case "logo-b": case "logo-b":
var u = prompt("Enter URL to team " + team + " logo", e.src); var u = prompt("Enter URL to team " + team + " logo");
if (! u) return; if (! u) return;
e.src = u; e.src = u;
@ -291,15 +295,13 @@ function handle(event) {
newstate = JAM; newstate = JAM;
} }
break; break;
case "name-a":
case "logo-a":
case "name-b":
case "logo-b":
score(team, -1);
return;
case "score-a": case "score-a":
case "score-b": case "score-b":
score(team, 1); if (event.shiftKey == 1) {
score(team, -1);
} else {
score(team, 1);
}
return; return;
} }
} }
@ -330,14 +332,14 @@ function key(e) {
} }
break; break;
case "j": case "j":
s = JAM; newstate = JAM;
break; break;
case "r": case "r":
case "l": // WFTDA TV uses this case "l": // WFTDA TV uses this
s = ROTATE; newstate = ROTATE;
break; break;
case "t": case "t":
s = TIMEOUT; newstate = TIMEOUT;
break; break;
case "a": case "a":
case ",": case ",":