planet-wars/backend/static/script/maps.js

14 lines
376 B
JavaScript
Raw Normal View History

2020-03-26 19:25:33 +00:00
const ids = {};
["map_holder"].forEach(id => ids[id] = document.getElementById(id));
var last_map;
async function handle_map_click(url, event) {
if (last_map) {
last_map.classList.remove("selected");
}
last_map = event.target;
event.target.classList.add("selected");
const c = await fetch(url);
ids["map_holder"].innerHTML = await c.text();
}