Merge branch 'master' into stable

This commit is contained in:
Neale Pickett 2014-02-15 19:53:39 -07:00
commit 5c82282cf1
3 changed files with 45 additions and 20 deletions

View File

@ -61,6 +61,10 @@ input[readonly] {
text-align: center; text-align: center;
} }
.name {
display: none;
}
.logo { .logo {
text-align: center; text-align: center;
} }

View File

@ -27,27 +27,29 @@
<body> <body>
<div id="scoreboard"> <div id="scoreboard">
<div class="team" id="team-a"> <div class="team" id="team-a">
<span class="jammer" id="jammer-a"></span>
<input class="name" id="name-a" value="HOME">
<div class="logo" id="logo-a"> <div class="logo" id="logo-a">
<img class="img" id="img-a" src="" alt="A"> <img class="img" id="img-a" src="" alt="A">
<canvas class="kitty" id="kitty-a"></canvas> <canvas class="kitty" id="kitty-a"></canvas>
<input type="color" class="setup color" id="color-a" value="#666666"> <input type="color" class="setup color" id="color-a" value="#666666">
<input type="image" class="setup load" id="load-a" src="ic_picture.png"> <input type="image" class="setup load" id="load-a" src="ic_picture.png">
</div> </div>
<span class="timeouts" id="timeouts-a">3</span>
<span class="jammer" id="jammer-a"></span>
<span class="score" id="score-a">-</span> <span class="score" id="score-a">-</span>
<span class="timeouts" id="timeouts-a">3</span>
</div> </div>
<div class="team" id="team-b"> <div class="team" id="team-b">
<span class="jammer" id="jammer-b"></span>
<input class="name" id="name-b" value="HOME">
<div class="logo" id="logo-b"> <div class="logo" id="logo-b">
<img class="img" id="img-b" src="" alt="B"> <img class="img" id="img-b" src="" alt="B">
<canvas class="kitty" id="kitty-b"></canvas> <canvas class="kitty" id="kitty-b"></canvas>
<input type="color" class="setup color" id="color-b" value="#ffffff"> <input type="color" class="setup color" id="color-b" value="#ffffff">
<input type="image" class="setup load" id="load-b" src="ic_picture.png"> <input type="image" class="setup load" id="load-b" src="ic_picture.png">
</div> </div>
<span class="timeouts" id="timeouts-b">3</span>
<span class="jammer" id="jammer-b"></span>
<span class="score" id="score-b">-</span> <span class="score" id="score-b">-</span>
<span class="timeouts" id="timeouts-b">3</span>
</div> </div>
<div class="clocks"> <div class="clocks">

View File

@ -225,8 +225,8 @@ function transition(newstate) {
} }
// Reset lead jammer indicators // Reset lead jammer indicators
e("jammer-a").className = ""; e("jammer-a").className = "jammer";
e("jammer-b").className = ""; e("jammer-b").className = "jammer";
var setupElements = document.getElementsByClassName("setup") var setupElements = document.getElementsByClassName("setup")
for (var i = 0; i < setupElements.length; i += 1) { for (var i = 0; i < setupElements.length; i += 1) {
@ -287,11 +287,11 @@ function score(team, points) {
function leadJammer(team) { function leadJammer(team) {
tgt = e("jammer-" + team); tgt = e("jammer-" + team);
var on = ! tgt.className; var on = (tgt.className.indexOf("lead") == -1);
e("jammer-a").className = ""; e("jammer-a").className = "jammer";
e("jammer-b").className = ""; e("jammer-b").className = "jammer";
if (on) tgt.className = "lead"; if (on) tgt.className = "lead jammer";
} }
function changeLogo(team) { function changeLogo(team) {
@ -602,8 +602,8 @@ function start() {
ei("close"); ei("close");
ei("preset"); ei("preset");
e("color-a").addEventListener("change", function() {rekitty("a")}, false); e("color-a").addEventListener("change", function() {recolor("a")}, false);
e("color-b").addEventListener("change", function() {rekitty("b")}, false); e("color-b").addEventListener("change", function() {recolor("b")}, false);
ei("periodtext").innerHTML = periodtext[period]; ei("periodtext").innerHTML = periodtext[period];
ei("jamtext").innerHTML = jamtext[3]; ei("jamtext").innerHTML = jamtext[3];
@ -622,19 +622,38 @@ function start() {
} }
function rekitty(team) { function fgColor(color) {
var v = 0
for (var i = 0; i < 3; i += 1) {
v += parseInt(color.substr(1+i*2, 2), 16)
}
if (v / 3 >= 0x88) {
return "#000000"
} else {
return "#ffffff"
}
}
function recolor(team) {
var i = e("img-" + team) var i = e("img-" + team)
var k = e("kitty-" + team) var k = e("kitty-" + team)
var t = e("team-" + team)
var color = e("color-" + team).value var color = e("color-" + team).value
i.style.display = "none" if (k.style) {
k.style.display = "inline" i.style.display = "none"
kitty(k.getContext("2d"), color) k.style.display = "inline"
kitty(k.getContext("2d"), color)
} else {
t.style.backgroundColor = color
t.style.color = fgColor(color)
}
} }
function resize() { function resize() {
var w = window.innerWidth / 7 var w = window.innerWidth / Number(document.body.getAttribute("data-x") || 7)
var h = window.innerHeight / 5 var h = window.innerHeight / Number(document.body.getAttribute("data-y") || 5)
var fs = Math.min(w, h) var fs = Math.min(w, h)
document.body.style.fontSize = Math.min(w, h) + 'px' document.body.style.fontSize = Math.min(w, h) + 'px'
@ -649,8 +668,8 @@ function resize() {
k.width = kw k.width = kw
k.height = kh k.height = kh
} }
rekitty("a") recolor("a")
rekitty("b") recolor("b")
} }
window.onload = start; window.onload = start;