Working with new codebase

This commit is contained in:
Neale Pickett 2014-02-15 19:50:16 -07:00
parent 2d13a91e62
commit e4b7164c3e
4 changed files with 58 additions and 27 deletions

View File

@ -1,5 +1,8 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('res/scoreboard.html', {
'state': 'fullscreen'
"bounds": {
"height": 100,
"width": 450
}
})
})

View File

@ -34,11 +34,21 @@ input {
display: inline;
}
.kitty, .img {
.team .logo {
position: absolute;
left: -10000px;
left: 10%;
}
.team .logo * {
display: none;
}
.team .color {
display: inline;
width: 0.5em;
margin-top: 0.60em;
}
.team {
position: absolute;
left: 0;
@ -56,12 +66,10 @@ input {
#team-a {
top: 0;
background: #6c6;
}
#team-b {
top: 50%;
background: #c44;
}
.name {
@ -94,12 +102,16 @@ input {
}
#clocks * {
.clocks * {
position: absolute;
right: 0.1em;
text-align: right;
}
.setup {
background-color: rgba(0, 255, 0, 0.2);
}
#period {
top: -0.2em;
}
@ -109,6 +121,7 @@ input {
}
#jamtext {
display: none;
color: #cc0;
bottom: 0.1em;
right: 3em;
@ -121,8 +134,10 @@ input {
}
#preset {
top: 1em;
right: 3em;
font-size: 40%;
bottom: 45%;
left: 5%;
right: auto;
}
#close {

View File

@ -24,14 +24,12 @@
<script type="text/javascript" src="kitty.js"></script>
<script type="text/javascript" src="scoreboard.js"></script>
</head>
<body>
<body data-x="13" data-y="3">
<div id="scoreboard">
<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">
<img class="img" id="img-a" src="" alt="A">
<canvas class="kitty" id="kitty-a"></canvas>
<input type="color" class="setup color" id="color-a" value="#666666">
<input type="image" class="setup load" id="load-a" src="ic_picture.png">
</div>
@ -41,10 +39,8 @@
<div class="team" id="team-b">
<span class="jammer" id="jammer-b"></span>
<input class="name" id="name-b" value="HOME">
<input class="name" id="name-b" value="VIS">
<div class="logo" id="logo-b">
<img class="img" id="img-b" src="" alt="B">
<canvas class="kitty" id="kitty-b"></canvas>
<input type="color" class="setup color" id="color-b" value="#ffffff">
<input type="image" class="setup load" id="load-b" src="ic_picture.png">
</div>

View File

@ -225,8 +225,8 @@ function transition(newstate) {
}
// Reset lead jammer indicators
e("jammer-a").className = "";
e("jammer-b").className = "";
e("jammer-a").className = "jammer";
e("jammer-b").className = "jammer";
var setupElements = document.getElementsByClassName("setup")
for (var i = 0; i < setupElements.length; i += 1) {
@ -287,11 +287,11 @@ function score(team, points) {
function leadJammer(team) {
tgt = e("jammer-" + team);
var on = ! tgt.className;
var on = (tgt.className.indexOf("lead") == -1);
e("jammer-a").className = "";
e("jammer-b").className = "";
if (on) tgt.className = "lead";
e("jammer-a").className = "jammer";
e("jammer-b").className = "jammer";
if (on) tgt.className = "lead jammer";
}
function changeLogo(team) {
@ -622,21 +622,38 @@ function start() {
}
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 k = e("kitty-" + team)
var n = e("name-" + team)
var t = e("team-" + team)
var color = e("color-" + team).value
i.style.display = "none"
k.style.display = "inline"
n.style.backgroundColor = color
kitty(k.getContext("2d"), color)
if (k.style) {
i.style.display = "none"
k.style.display = "inline"
kitty(k.getContext("2d"), color)
} else {
t.style.backgroundColor = color
t.style.color = fgColor(color)
}
}
function resize() {
var w = window.innerWidth / 7
var h = window.innerHeight / 5
var w = window.innerWidth / Number(document.body.getAttribute("data-x") || 7)
var h = window.innerHeight / Number(document.body.getAttribute("data-y") || 5)
var fs = Math.min(w, h)
document.body.style.fontSize = Math.min(w, h) + 'px'