38 lines
1.2 KiB
JavaScript

let main_panel_buffer = null;
function show(file)
{
if (main_panel_buffer == null) main_panel_buffer = document.getElementById("main_panel").innerHTML;
$.ajax
({
url: "./res/forum/" + file + "/" + file + ".html",
dataType: "html",
success: function(data)
{
$("#main_panel").html(main_panel_buffer + data);
}
});
}
function inject_info(id, username, postfix)
{
$.ajax
({
url: "./res/forum/api/user_info.php?username=" + username,
success: async function(result)
{
let admin_select = await selection("admin", result.admin);
let sex_select = await selection("sex", result.sex);
let output =
`Uživatelské jméno: <input id="username" class="editable" type="text" value="${result.username}"><br>
Přezdívka: <input id="nickname" class="editable" type="text" value="${result.nickname}"><br>
Admin: ${admin_select}<br>
Pohlaví: ${sex_select}<br>
Bio: <input id="bio" class="editable" type="text" value="${result.bio}"><br>`;
$(id).html(output + postfix);
}
});
}