From 30c146c0c6dad927a2a88d67d9176d428399146f Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Tue, 20 Dec 2011 22:38:56 -0700 Subject: [PATCH] add notices --- scoreboard.html | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ scoreboard.js | 17 +++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/scoreboard.html b/scoreboard.html index e81910c..7af8fc4 100644 --- a/scoreboard.html +++ b/scoreboard.html @@ -37,6 +37,28 @@ width: 100%; } +#penalties.notice { + display: none; +} +#notice div { + font-family: sans-serif; + font-size: 800%; + display: none; +} +#notice .active { + display: block; + -moz-animation-duration: 0.5s; + -moz-animation-name: grow; + -moz-animation-iteration-count: infinite; + -moz-animation-direction: alternate; +} + +@-moz-keyframes grow { + 0% {color: red;} + 50% {color: yellow;} + 75% {color: blue;} + 100% {color: magenta;} +} @@ -44,6 +66,32 @@ @@ -101,5 +149,10 @@ +
+
Power Jam
+
Grand Slam
+
Ouch!
+
diff --git a/scoreboard.js b/scoreboard.js index c39e40f..8e011cd 100644 --- a/scoreboard.js +++ b/scoreboard.js @@ -308,9 +308,10 @@ function handle(event) { } function key(event) { + var c = String.fromCharCode(event.which || 0); var newstate; - switch (String.fromCharCode(event.which || 0)) { + switch (c) { case " ": if (state == JAM) { newstate = LINEUP; @@ -333,6 +334,20 @@ function key(event) { case "B": score('b', -1); break; + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + var n = Number(c); + + if (window.notice) { + window.notice(n); + } } transition(newstate);