Start at a Chrome app

This commit is contained in:
Neale Pickett 2013-11-01 17:32:32 -06:00
parent 85c036e967
commit d6438fe2c2
4 changed files with 48 additions and 12 deletions

15
manifest.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "LADD Scoreboard",
"description": "Roller Derby Scoreboard",
"version": "5.2",
"manifest_version": 2,
"permissions": [ "storage" ],
"icons": {
"128": "res/icon.png"
},
"app": {
"background": {
"scripts": ["res/background.js"]
}
}
}

5
res/background.js Normal file
View File

@ -0,0 +1,5 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('../scoreboard.html', {
'state': 'fullscreen'
})
})

BIN
res/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -447,22 +447,38 @@ function key(event) {
} }
function get(k, d) { function get(k, d) {
if (! window.localStorage) { var storage;
return d;
if (chrome) {
storage = chrome.storage.local
} else { } else {
var v = window.localStorage["rdsb_" + k]; storage = window.localStorage;
}
if (! storage) {
return d;
}
var v = storage["rdsb_" + k];
if (v == undefined) { if (v == undefined) {
return d; return d;
} }
return v; return v;
}
} }
function store(k, v) { function store(k, v) {
if ((v == undefined) || ! window.localStorage) { var storage;
if (chrome) {
storage = chrome.storage.local
} else {
storage = window.localStorage;
}
if ((v == undefined) || ! storage) {
return; return;
} else { } else {
localStorage["rdsb_" + k] = v; storage["rdsb_" + k] = v;
} }
} }
@ -499,6 +515,8 @@ function iecheck() {
} }
} }
function start() { function start() {
resize(); resize();
iecheck(); iecheck();
@ -520,9 +538,7 @@ function start() {
period = Number(get("period", 0)); period = Number(get("period", 0));
jamno = Number(get("jamno", 0)); jamno = Number(get("jamno", 0));
if (window.localStorage) {
save_itimer = setInterval(save, 1000); save_itimer = setInterval(save, 1000);
}
if (window.penalties) { if (window.penalties) {
penalties_init(); penalties_init();