123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <!DOCTYPE html>
- <html>
- <head>
- <!-- Standard Meta -->
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
- <!-- Site Properties -->
- <title>Minecraft Server</title>
- <script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
- <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
- <!-- MC Skin-->
- <link rel="stylesheet" href="/css/minecraft-skinviewer.css">
- <!-- Semantic UI Alert-->
- <link rel="stylesheet" href="/css/Semantic-UI-Alert.css">
- <script src="/js/semantic-ui-alert.js"></script>
- <script src="/js/alert.js"></script>
- </head>
- <body>
- <div class="ui divided items" id="userlist">
- </div>
- <div class="ui fluid input" style="position: fixed;bottom: 10px;width: 99vw;">
- <input type="text" id="uuid" placeholder="UUID">
- <div style="width:10px"></div>
- <input type="text" id="name" placeholder="Name">
- <div style="width:10px"></div>
- <input type="text" id="reason" placeholder="Reason">
- <div style="width:10px"></div>
- <div class="ui button" onclick="submit()">Submit</div>
- </div>
- </body>
- <script>
- updateInfo();
- setInterval(function() {
- updateInfo()
- }, 5000);
- function updateInfo() {
- $.get("/ban-player", function(data) {
- if (data.length == 0) {
- $("#userlist").html(`
- <div class="item">
- <div class="content">
- <div class="header">No record.</div>
- </div>
- </div>
- `)
- return
- }
- $("#userlist").html("");
- $.each(data, function(i, item) {
- $("#userlist").append(`
- <div class="item">
- <div class="ui mini image" style="width:64px">
- <div class="mc-face-viewer-8x" style="background-image:url('/skin/` + item.uuid + `.png')"></div>
- </div>
- <div class="content">
- <div class="header">` + item.name + `</div>
- <div class="meta">
- <span>` + item.uuid + `</span>
- </div>
- </div>
- <div class="ui right floated buttons" style="display:block;margin:auto" username="` + item.name + `">
- <button onclick="unban(this)" class="ui red button">UnBan</button>
- </div>
- </div>
- `)
- })
- $("#userlist").append('<div style="height:40px"></div>');
- });
- }
- function unban(btn) {
- var data = $(btn).parent().attr("username");
- $.get("/ban-player/remove?field=name&search=" + data, function(data) {
- if (data == "OK") {
- msgbox("Removed");
- } else {
- errmsg("Fail to remove the item.");
- }
- updateInfo();
- });
- }
- function submit() {
- var uuid = $("#uuid").val();
- var name = $("#name").val();
- var reason = $("#reason").val();
- $("#uuid").val("");
- $("#name").val("");
- $("#reason").val("");
- $.get("/ban-player/add?uuid=" + uuid + "&name=" + name + "&reason=" + reason, function(data) {
- if (data == "OK") {
- msgbox("Added");
- } else {
- errmsg(data);
- }
- updateInfo();
- });
- }
- </script>
- </html>
|