29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
function list_available_games() {
|
|
let game_list_panel = document.getElementById("game_list_panel");
|
|
|
|
let req = {
|
|
action: "get_available_games"
|
|
}
|
|
request(req).then(resp => {
|
|
let games_by_groups = JSON.parse(resp);
|
|
games_by_groups.forEach((game_collection) => {
|
|
let group_box = document.createElement("section");
|
|
group_box.classList.add("group-box");
|
|
let group_box_caption = document.createElement("span");
|
|
group_box_caption.classList.add("group-box-caption");
|
|
group_box_caption.innerHTML = game_collection["groupname"];
|
|
let group_box_inner = document.createElement("section");
|
|
group_box_inner.classList.add("group-box-inner");
|
|
group_box.append(group_box_caption, group_box_inner);
|
|
|
|
game_collection["games"].forEach((game) => {
|
|
let game_box = document.createElement("section");
|
|
game_box.classList.add("game-box");
|
|
game_box.innerHTML = game["name"];
|
|
group_box_inner.appendChild(game_box);
|
|
});
|
|
|
|
game_list_panel.appendChild(group_box);
|
|
});
|
|
});
|
|
} |