index.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!DOCTYPE html>
  2. <!-- Background art by Justin Dalessandro (ColdOneK) -->
  3. <html>
  4. <head>
  5. <title>Online Player List</title>
  6. <style>
  7. body {
  8. font-family: Bitter;
  9. color: #fff;
  10. text-align: center;
  11. display: flex;
  12. flex-direction: column;
  13. justify-content: center;
  14. align-items: center;
  15. min-height: 100vh;
  16. margin: 0;
  17. background-color: #69b4fa;
  18. background-image: url('sky_background.png');
  19. background-repeat: repeat-x;
  20. }
  21. .container {
  22. background-color: rgba(0, 0, 0, 0.8);
  23. border-radius: 15px;
  24. padding: 20px;
  25. margin: 20px;
  26. display: flex;
  27. flex-direction: column;
  28. align-items: center;
  29. }
  30. table {
  31. border-collapse: collapse;
  32. margin: 10px;
  33. width: 100%;
  34. }
  35. th, td {
  36. padding: 10px;
  37. border: 1px solid #fff;
  38. }
  39. th {
  40. background-color: #a1bad9;
  41. color: #20252b;
  42. }
  43. tr:nth-child(even) {
  44. background-color: transparent; /* Removed hover effect on table rows */
  45. }
  46. button {
  47. padding: 10px 20px;
  48. background-color: #69b4fa; /* Lightened button background color */
  49. color: #20252b; /* Button text color */
  50. border: none;
  51. cursor: pointer;
  52. font-family: Bitter;
  53. font-size: 16px;
  54. margin-top: 20px;
  55. }
  56. button:hover {
  57. background-color: #73b8f8;
  58. color: #fff; /* Lightened button text color for better visibility */
  59. }
  60. </style>
  61. </head>
  62. <body>
  63. <h1>Online Player List</h1>
  64. <div class="container">
  65. <table>
  66. <thead>
  67. <tr>
  68. <th>Names</th>
  69. </tr>
  70. </thead>
  71. <tbody id="data">
  72. </tbody>
  73. </table>
  74. <button id="refreshButton">Refresh List</button>
  75. </div>
  76. <script>
  77. // Function to fetch and update JSON data
  78. function fetchData() {
  79. fetch('online.json')
  80. .then(response => response.json())
  81. .then(data => {
  82. const tableBody = document.getElementById("data");
  83. tableBody.innerHTML = ''; // Clear the table before populating
  84. data.forEach(name => {
  85. const row = document.createElement("tr");
  86. const cell = document.createElement("td");
  87. cell.textContent = name;
  88. row.appendChild(cell);
  89. tableBody.appendChild(row);
  90. });
  91. })
  92. .catch(error => {
  93. console.error('Error fetching JSON data:', error);
  94. });
  95. }
  96. // Initial data fetch
  97. fetchData();
  98. // Auto-refresh every 10 seconds
  99. setInterval(fetchData, 10000);
  100. // Button click to manually refresh
  101. const refreshButton = document.getElementById('refreshButton');
  102. refreshButton.addEventListener('click', fetchData);
  103. </script>
  104. </body>
  105. </html>