From 7943678472fb912ad3e8854fc3e86f705cf12fb8 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sat, 12 Nov 2011 08:24:11 -0700 Subject: [PATCH] Change color of rotation clock --- index.html | 2 +- scoreboard.js | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 0d0c031..e99af01 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - + LADD Scoreboard diff --git a/scoreboard.js b/scoreboard.js index b05a3ed..2e455db 100644 --- a/scoreboard.js +++ b/scoreboard.js @@ -19,6 +19,7 @@ function startTimer(element, precision, duration, callback) { var beginning; var itimer; var precmult = 1; + var bg; for (var i = 0; i < precision; i += 1) { precmult *= 10; @@ -37,12 +38,14 @@ function startTimer(element, precision, duration, callback) { element.style.color = "#888"; } - if (! duration) { - element.style.backgroundColor = "#044"; - } else if (remain <= 20000) { - element.style.backgroundColor = "#f24"; - } else { - element.style.backgroundColor = element.bg; + if (! bg) { + if (! duration) { + element.style.backgroundColor = "#044"; + } else if (remain <= 20000) { + element.style.backgroundColor = "#f24"; + } else { + element.style.backgroundColor = element.bg; + } } element.innerHTML = ""; @@ -91,7 +94,7 @@ function startTimer(element, precision, duration, callback) { } // Unpause if paused - this.go = function () { + this.go = function (color) { if (itimer) return; this.start(); @@ -107,7 +110,12 @@ function startTimer(element, precision, duration, callback) { } // Restart with a new time - this.reset = function (t) { + this.reset = function (t, color) { + bg = color; + if (color) { + element.style.backgroundColor = color; + } + duration = t; this.start(); display(duration); @@ -136,7 +144,7 @@ function transition() { jtext.innerHTML = "Jam"; } else if (state == ROTATE) { pt.go(); - jt.reset(30000); + jt.reset(30000, "#060"); jtext.innerHTML = "Rotation"; } else if (state == TIMEOUT) { pt.pause();