Improve code

This commit is contained in:
Lavender 2021-05-04 20:19:04 -07:00
parent 8b8a5a0f2e
commit d37c2c45e6
Signed by: endie
GPG key ID: CC5162D7C2146F01

16
main.js
View file

@ -1,3 +1,5 @@
"use strict"
let request = new XMLHttpRequest() let request = new XMLHttpRequest()
request.open( request.open(
"GET", "GET",
@ -34,20 +36,22 @@ request.onload = function() {
) )
// Set the toggle function for & display the checkbox // Set the toggle function for & display the checkbox
shadows.oninput = shadows_on = function() { shadows.oninput = checkbox_toggle
shadows.style.display = "block"
document.getElementById("progress").remove()
}
function checkbox_toggle() {
results_shadowed.style.display = "block" results_shadowed.style.display = "block"
results.style.display = "none" results.style.display = "none"
// Toggle off function // Toggle off function
shadows.oninput = function() { shadows.oninput = function() {
results.style.display = "block" results.style.display = "block"
results_shadowed.style.display = "none" results_shadowed.style.display = "none"
shadows.oninput = shadows_on shadows.oninput = checkbox_toggle
} }
} }
shadows.style.display = "block"
document.getElementById("progress").remove()
}
function display_teams(totals, teams, div_container, hitters_fn, pitchers_fn) { function display_teams(totals, teams, div_container, hitters_fn, pitchers_fn) {
const ENDING = x => (Math.abs(x) === 1 ? "" : "s") const ENDING = x => (Math.abs(x) === 1 ? "" : "s")