Merge pull request #69 from esSteres/redacted

Fix loading weirdness
This commit is contained in:
Sakimori 2020-12-30 02:47:36 -05:00 committed by GitHub
commit 0d6c7193df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,6 @@ $(document).ready(function (){
for (var slotnum = 3; slotnum <= Math.min(maxslot, totalslots-1); slotnum++) { for (var slotnum = 3; slotnum <= Math.min(maxslot, totalslots-1); slotnum++) {
if (grid.children[slotnum].timestamp == timestamp) { if (grid.children[slotnum].timestamp == timestamp) {
console.log(json[timestamp].update_text);
updateGame(grid.children[slotnum], json[timestamp]); updateGame(grid.children[slotnum], json[timestamp]);
}; };
}; };
@ -35,12 +34,14 @@ $(document).ready(function (){
const insertGame = (gridboxnum, gamestate, timestamp) => { const insertGame = (gridboxnum, gamestate, timestamp) => {
var thisBox = grid.children[gridboxnum]; var thisBox = grid.children[gridboxnum];
fetch("/static/game.html").then(x=>x.text()).then(gamehtml => {
console.log(gamehtml)
console.log(thisBox)
thisBox.className = "game"; thisBox.className = "game";
thisBox.timestamp = timestamp; thisBox.timestamp = timestamp;
thisBox.id = "loadTarget"; thisBox.innerHTML = gamehtml;
$('#loadTarget').load("static/game.html");
thisBox.id = "";
updateGame(thisBox, gamestate); updateGame(thisBox, gamestate);
});
}; };
const BASE_EMPTY = "/static/img/base_empty.png" const BASE_EMPTY = "/static/img/base_empty.png"
@ -59,7 +60,6 @@ $(document).ready(function (){
$('#updateTarget .home_score').html("" + gamestate.home_score); $('#updateTarget .home_score').html("" + gamestate.home_score);
for (var i = 1; i <= 3; i++) { for (var i = 1; i <= 3; i++) {
$('#updateTarget .base_' + i).attr('src', (gamestate.bases[i] == null ? BASE_EMPTY : BASE_FILLED)); $('#updateTarget .base_' + i).attr('src', (gamestate.bases[i] == null ? BASE_EMPTY : BASE_FILLED));
} }
@ -70,7 +70,6 @@ $(document).ready(function (){
$('#updateTarget .pitcher_name').html(gamestate.pitcher); $('#updateTarget .pitcher_name').html(gamestate.pitcher);
$('#updateTarget .batter_name').html(gamestate.batter); $('#updateTarget .batter_name').html(gamestate.batter);
console.log(gamestate.update_emoji);
$('#updateTarget .update_emoji').html(gamestate.update_emoji); $('#updateTarget .update_emoji').html(gamestate.update_emoji);
$('#updateTarget .update_text').html(gamestate.update_text); $('#updateTarget .update_text').html(gamestate.update_text);