clean up code

This commit is contained in:
Elijah Steres 2020-12-30 21:42:07 -05:00
parent 40e1c5a72c
commit 76f60e7c2a

View File

@ -39,18 +39,13 @@ $(document).ready(function (){
}; };
}; };
var requiredcells = Math.max(4, (3 * Math.ceil(Object.keys(json).length/3))+1);
for (var slotnum = 1; slotnum < grid.children.length; slotnum++) { for (var slotnum = 1; slotnum < grid.children.length; slotnum++) {
if (grid.children[slotnum].className == "game" && !(Object.keys(json).includes(grid.children[slotnum].timestamp))) { if (grid.children[slotnum].className == "game" && !(Object.keys(json).includes(grid.children[slotnum].timestamp))) {
grid.removeChild(grid.children[slotnum]); grid.removeChild(grid.children[slotnum]);
} }
} }
var requiredcells = Math.max(4, (3 * Math.ceil(Object.keys(json).length/3))+1);
console.log(Object.keys(json).length)
console.log(requiredcells)
console.log(grid.children.length)
while (grid.children.length > requiredcells) { while (grid.children.length > requiredcells) {
grid.removeChild(grid.children[requiredcells]); grid.removeChild(grid.children[requiredcells]);