ops.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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="level" placeholder="Level">
  29. <div style="width:10px"></div>
  30. <input type="text" id="bypass" placeholder="BypassesPlayerLimit">
  31. <div style="width:10px"></div>
  32. <div class="ui button" onclick="submit()">Submit</div>
  33. </div>
  34. </body>
  35. <script>
  36. updateInfo();
  37. setInterval(function() {
  38. updateInfo()
  39. }, 5000);
  40. function updateInfo() {
  41. $.get("/ops", function(data) {
  42. if (data.length == 0) {
  43. $("#userlist").html(`
  44. <div class="item">
  45. <div class="content">
  46. <div class="header">No record.</div>
  47. </div>
  48. </div>
  49. `)
  50. return
  51. }
  52. $("#userlist").html("");
  53. $.each(data, function(i, item) {
  54. $("#userlist").append(`
  55. <div class="item">
  56. <div class="ui mini image" style="width:64px">
  57. <div class="mc-face-viewer-8x" style="background-image:url('/skin/` + item.uuid + `.png')"></div>
  58. </div>
  59. <div class="content">
  60. <div class="header">` + item.name + `</div>
  61. <div class="meta">
  62. <span>` + item.uuid + `</span>
  63. </div>
  64. </div>
  65. <div class="ui right floated buttons" style="display:block;margin:auto" username="` + item.name + `">
  66. <button onclick="deop(this)" class="ui red button">Deop</button>
  67. </div>
  68. </div>
  69. `)
  70. })
  71. $("#userlist").append('<div style="height:40px"></div>');
  72. });
  73. }
  74. function deop(btn) {
  75. var data = $(btn).parent().attr("username");
  76. $.get("/ops/remove?field=name&search=" + data, function(data) {
  77. if (data == "OK") {
  78. msgbox("Removed");
  79. } else {
  80. errmsg("Fail to remove the item.");
  81. }
  82. updateInfo();
  83. });
  84. }
  85. function submit() {
  86. var uuid = $("#uuid").val();
  87. var name = $("#name").val();
  88. var level = $("#level").val();
  89. var bypass = $("#bypass").val();
  90. $("#uuid").val("");
  91. $("#name").val("");
  92. $("#level").val("");
  93. $("#bypass").val("");
  94. $.get("/ops/add?uuid=" + uuid + "&name=" + name + "&level=" + level + "&bypass=" + bypass, function(data) {
  95. if (data == "OK") {
  96. msgbox("Added");
  97. } else {
  98. errmsg(data);
  99. }
  100. updateInfo();
  101. });
  102. }
  103. </script>
  104. </html>