Fixed minor issues

This commit is contained in:
The Great & Powerful James Wernicke 2015-06-04 07:05:20 -06:00
parent 33efccf344
commit 715a029263
2 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,3 @@
[ [
"scoreboard.html", "scoreboard.html"
"tanks.html",
"credits.html"
] ]

View File

@ -20,7 +20,7 @@
} }
</style> </style>
<script> <script>
var SECS = 1000; var SECS = 1000, DELAY = 30*SECS;
var urls = ["scoreboard.html"]; var urls = ["scoreboard.html"];
var stack = []; var stack = [];
var i = 0; var i = 0;
@ -30,10 +30,13 @@ if (window.XMLHttpRequest){
} }
xmlhttp.onreadystatechange = function(){ xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){ if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
// update urls
urls = JSON.parse(xmlhttp.responseText); urls = JSON.parse(xmlhttp.responseText);
//console.log("new urls:", urls); console.log("new urls:", urls);
} }
} }
xmlhttp.open("GET", "projections.json", true);
xmlhttp.send();
function reload() { function reload() {
// alternate between scoreboard and other things // alternate between scoreboard and other things
if (i%2){ if (i%2){
@ -51,14 +54,14 @@ function reload() {
} }
} }
url = stack.pop(); url = stack.pop();
console.log("loading " + url + " of " + urls);
} }
console.log("loading " + url + " of " + urls);
document.getElementById("reloader").src = url; document.getElementById("reloader").src = url;
i++; i++;
} }
function init() { function init() {
setInterval(reload, 2*SECS); setInterval(reload, DELAY);
} }
window.addEventListener("load", init); window.addEventListener("load", init);