banplayer.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <!-- Standard Meta -->
  5. <meta charset="utf-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  8. <!-- Site Properties -->
  9. <title>Minecraft Server</title>
  10. <script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
  11. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
  12. <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
  13. <!-- MC Skin-->
  14. <link rel="stylesheet" href="/css/minecraft-skinviewer.css">
  15. <!-- Semantic UI Alert-->
  16. <link rel="stylesheet" href="/css/Semantic-UI-Alert.css">
  17. <script src="/js/semantic-ui-alert.js"></script>
  18. <script src="/js/alert.js"></script>
  19. </head>
  20. <body>
  21. <div class="ui divided items" id="userlist">
  22. </div>
  23. <div class="ui fluid input" style="position: fixed;bottom: 10px;width: 99vw;">
  24. <input type="text" id="uuid" placeholder="UUID">
  25. <div style="width:10px"></div>
  26. <input type="text" id="name" placeholder="Name">
  27. <div style="width:10px"></div>
  28. <input type="text" id="reason" placeholder="Reason">
  29. <div style="width:10px"></div>
  30. <div class="ui button" onclick="submit()">Submit</div>
  31. </div>
  32. </body>
  33. <script>
  34. updateInfo();
  35. setInterval(function() {
  36. updateInfo()
  37. }, 5000);
  38. function updateInfo() {
  39. $.get("/ban-player", function(data) {
  40. if (data.length == 0) {
  41. $("#userlist").html(`
  42. <div class="item">
  43. <div class="content">
  44. <div class="header">No record.</div>
  45. </div>
  46. </div>
  47. `)
  48. return
  49. }
  50. $("#userlist").html("");
  51. $.each(data, function(i, item) {
  52. $("#userlist").append(`
  53. <div class="item">
  54. <div class="ui mini image" style="width:64px">
  55. <div class="mc-face-viewer-8x" style="background-image:url('/skin/` + item.uuid + `.png')"></div>
  56. </div>
  57. <div class="content">
  58. <div class="header">` + item.name + `</div>
  59. <div class="meta">
  60. <span>` + item.uuid + `</span>
  61. </div>
  62. </div>
  63. <div class="ui right floated buttons" style="display:block;margin:auto" username="` + item.name + `">
  64. <button onclick="unban(this)" class="ui red button">UnBan</button>
  65. </div>
  66. </div>
  67. `)
  68. })
  69. $("#userlist").append('<div style="height:40px"></div>');
  70. });
  71. }
  72. function unban(btn) {
  73. var data = $(btn).parent().attr("username");
  74. $.get("/ban-player/remove?field=name&search=" + data, function(data) {
  75. if (data == "OK") {
  76. msgbox("Removed");
  77. } else {
  78. errmsg("Fail to remove the item.");
  79. }
  80. updateInfo();
  81. });
  82. }
  83. function submit() {
  84. var uuid = $("#uuid").val();
  85. var name = $("#name").val();
  86. var reason = $("#reason").val();
  87. $("#uuid").val("");
  88. $("#name").val("");
  89. $("#reason").val("");
  90. $.get("/ban-player/add?uuid=" + uuid + "&name=" + name + "&reason=" + reason, function(data) {
  91. if (data == "OK") {
  92. msgbox("Added");
  93. } else {
  94. errmsg(data);
  95. }
  96. updateInfo();
  97. });
  98. }
  99. </script>
  100. </html>