62 lines
1.5 KiB
HTML
Raw Normal View History

2024-05-16 21:26:25 +02:00
<div id="panels">
<div id="left_panel">
2024-05-20 19:16:00 +02:00
Zde budou uživatelé.
2024-05-16 21:26:25 +02:00
</div>
<div id="right_panel">
2024-05-21 17:49:26 +02:00
<button onclick="remove_user()" id="remove_btn">Odstranit Uživatele</button>
2024-05-16 21:26:25 +02:00
</div>
2024-05-20 19:16:00 +02:00
</div>
<script>
2024-05-21 17:49:26 +02:00
var right_panel_buffer = null;
var username = null;
2024-05-21 17:28:33 +02:00
$(document).ready(function()
{
$("#remove_btn").hide();
});
2024-05-20 19:16:00 +02:00
$.ajax
({
2024-05-20 20:07:28 +02:00
url: "./res/forum/api/list_users.php",
2024-05-20 19:16:00 +02:00
success: function(result)
{
2024-05-21 20:02:52 +02:00
let users = "";
for (let i in result.users)
{
users += "<div class=\"output\">" + result.users[i] + "</div>";
}
$("#left_panel").html(users);
2024-05-20 19:16:00 +02:00
}
});
$("#left_panel").on("click", ".output", function(event)
{
2024-05-21 17:28:33 +02:00
$("#remove_btn").show();
if (right_panel_buffer == null) right_panel_buffer = document.getElementById("right_panel").innerHTML;
2024-05-21 17:49:26 +02:00
username = event.target.innerHTML;
$.ajax
({
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
success: function(result)
{
$("#right_panel").html(result + right_panel_buffer);
}
});
});
2024-05-21 17:49:26 +02:00
function remove_user()
{
$.ajax
({
url: "./res/forum/api/remove_user.php?username=" + username,
success: function(result)
{
//location.reload();
show("admin");
}
});
}
2024-05-20 19:16:00 +02:00
</script>