Seems to work

This commit is contained in:
Neale Pickett 2014-02-15 11:32:00 -07:00
parent 01df4571d0
commit 1f8dd3e48c
7 changed files with 56 additions and 36 deletions

7
TODO
View File

@ -1,7 +1,2 @@
* User-Provided Logos
* Default to Kitty
* Add Color Picker
* chrome.fileSystem.retainEntry
* onload handler: check if width=0 and height=0
* chrome.fileSystem.retainEntry?
* use chrome.power to keep the display on

View File

@ -4,7 +4,7 @@
"short_name": "__MSG_appShortName__",
"description": "__MSG_appDesc__",
"author": "Neale Pickett <neale@woozle.org>",
"version": "6.2.1",
"version": "7.0β1",
"app": {
"background": {
"scripts": ["res/background.js"]

BIN
res/ic_picture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

View File

@ -3,7 +3,7 @@
// If you are reading this, there's probably a nicer converter out now.
// But this seems to work okay so it may not be worth the effort.
var kitty = function(ctx, kittyColor) {
function kitty(ctx, kittyColor) {
var scaleBase = 0.1098503139616503
var scaleX = scaleBase * ctx.canvas.width / 100

View File

@ -61,21 +61,29 @@ input[readonly] {
text-align: center;
}
.logo {
text-align: center;
}
.logo img {
max-width: 1.8em;
max-height: 2em;
display: none;
}
.logo input {
position: absolute;
top: 0;
top: 30%;
font-size: 10pt;
vertical-align: top;
max-height: 15pt;
border: none;
}
.logo img {
display: none;
.setup {
background: rgba(0, 255,0, 0.3);
}
.timeouts {
position: absolute;
font-size: 50%;
@ -147,7 +155,6 @@ input[readonly] {
#preset {
top: 40%;
color: cyan;
}
#jamtext {

View File

@ -26,35 +26,37 @@
</head>
<body>
<div id="scoreboard">
<p class="left">
<span class="logo" id="logo-a">
<canvas class="kitty" id="kitty-a"></canvas>
<input type="button" class="setup" id="load-a" value="Load...">
<div class="left">
<div class="logo" id="logo-a">
<img class="img" id="img-a" src="" alt="A">
</span>
<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>
<span class="timeouts" id="timeouts-a">3</span>
<span class="jammer" id="jammer-a"></span>
<span class="score" id="score-a">-</span>
</p>
</div>
<p class="right">
<span class="logo" id="logo-b">
<canvas class="kitty" id="kitty-b"></canvas>
<input type="button" class="setup" id="load-b" value="Load...">
<div class="right">
<div class="logo" id="logo-b">
<img class="img" id="img-b" src="" alt="B">
</span>
<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>
<span class="timeouts" id="timeouts-b">3</span>
<span class="jammer" id="jammer-b"></span>
<span class="score" id="score-b">-</span>
</p>
</div>
<p class="center">
<div class="center">
<input id="period" value="--:--">
<span id="periodtext"></span>
<span class="setup" id="preset">-</span>
<input id="jam" value="-:--">
<span id="jamtext"></span>
</p>
</div>
</div>
<div id="notice">

View File

@ -58,8 +58,6 @@ var jamtext = [
var period = 0;
var jamno = 0;
var colors = ["#666", "#ffffff"];
var state = SETUP;
var timer_updates = [];
@ -229,7 +227,13 @@ function transition(newstate) {
// Reset lead jammer indicators
e("jammer-a").className = "";
e("jammer-b").className = "";
e("preset").style.display = "none";
var setupElements = document.getElementsByClassName("setup")
for (var i = 0; i < setupElements.length; i += 1) {
var el = setupElements[i]
el.style.display = "none"
}
save();
}
@ -301,7 +305,7 @@ function changeLogo(team) {
function loaded(entry) {
entry.file(setURL);
e("kitty-" + team).style.display = "none"
element.style.display = "block"
element.style.display = "inline"
}
chrome.fileSystem.chooseEntry(
@ -320,7 +324,6 @@ function handle(event) {
var adj = event.shiftKey?-1:1;
var mod = (event.ctrlKey || event.altKey);
var newstate;
console.log(tgt.id)
switch (tgt.id) {
case "load-a":
@ -506,7 +509,6 @@ function save() {
chrome.storage.local.set(
{
"preset": e("preset").innerHTML,
"score_a": e("score-a").innerHTML,
"score_b": e("score-b").innerHTML,
"timeouts_a": e("timeouts-a").innerHTML,
@ -600,6 +602,9 @@ function start() {
ei("close");
ei("preset");
e("color-a").addEventListener("change", function() {rekitty("a")}, false);
e("color-b").addEventListener("change", function() {rekitty("b")}, false);
ei("periodtext").innerHTML = periodtext[period];
ei("jamtext").innerHTML = jamtext[3];
transition();
@ -617,6 +622,16 @@ function start() {
}
function rekitty(team) {
var i = e("img-" + team)
var k = e("kitty-" + team)
var color = e("color-" + team).value
i.style.display = "none"
k.style.display = "inline"
kitty(k.getContext("2d"), color)
}
function resize() {
var w = window.innerWidth / 7
var h = window.innerHeight / 5
@ -625,16 +640,17 @@ function resize() {
document.body.style.fontSize = Math.min(w, h) + 'px'
// Now do kitty canvases
var kw = fs * 2
var kh = fs * 1.8
var kw = fs * 1.8
var kh = kw * 0.6883
var kitties = document.getElementsByClassName("kitty")
for (var i = 0; i < kitties.length; i += 1) {
k = kitties[i]
k.width = kw
k.height = kh
kitty(k.getContext("2d"), colors[i])
}
rekitty("a")
rekitty("b")
}
window.onload = start;