-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
178 lines (165 loc) · 4.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quadpad Export</title>
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
<link rel="stylesheet" href="https://fontlibrary.org//face/minecraftia">
<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.0/css/all.css">
<style>
/* CSS */
html, body {
background: #111;
color: white;
font-family: Inter;
}
p.slim {
display: inline-flex;
margin: 0;
}
.icon {
width: 20px;
height: 20px;
}
#port {
color: rgb(173, 191, 230);
}
#ip {
color: lightcoral;
}
#motd {
background: #222;
padding: 4px;
font-family: Minecraft, Minecraftia, JetBrains Mono, Fira Code, Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
#playerOnline, #playerMax {
color: lightgreen;
}
#version {
color: lightgoldenrodyellow;
}
code {
background-color: #222;
padding: 4px;
font-family: Fira Code, Jetbrains Mono, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
button, input {
padding: 6px 12px;
background: #444;
border: 1px solid #666;
border-radius: 4px;
color: white;
}
button:hover {
color: #ccc;
background: #414141;
cursor: pointer;
}
input:focus-within {
outline: none;
border: 1px solid #b1b1b1;
}
.selip {
font-family: JetBrains Mono, Fira Code, monospace;
}
.wg {
display: inline;
width: 10px;
height: 10px;
}
div.btns {
display: flex;
flex-direction: row;
align-items: center;
gap: 5px;
}
h1 i {
font-size: 10px;
}
h1 {
display: flex;
align-items: center;
gap: 5px;
}
.list {
display: flex;
flex-direction: column;
gap: 5px;
}
.item {
display: flex;
flex-direction: row;
gap: 5px;
align-items: center;
}
</style>
</head>
<body>
<!--- HTML --->
<h1>GaMS <i>gavinminecraftserver</i></h1>
<img src="" alt="" class="icon"> <div class="wg"></div> <span class="selip">localhost</span><br>
IP: <p id="ip" class="slim">ip</p>:<p id="port" class="slim">port</p><br>
Motd: <p id="motd" class="slim">MOTD</p><br>
Players: <p id="playerOnline" class="slim"></p>/<p id="playerMax" class="slim"></p><br>
Version:<p id="version" class="slim"></p><br>
Online: <p id="isOnline" class="slim"></p><br>
Software: <p id="software" class="slim"></p><br>
Debug: <code>ping:<span id="ping"></span>, query:<span id="query"></span>, srv:<span id="srv"></span></code>
<br><br>
<div class="btns">
<input type="text" id="ipinput" placeholder="IP Address (:Port)">
<button id="reload"><i class="fa-solid fa-refresh"></i></button>
<button id="save"><i class="fa-solid fa-download"></i></button>
</div>
<script type="text/javascript">
// JavaScript
var ipinput = document.querySelector("#ipinput");
var save = document.querySelector("#save");
var selIp = "localhost";
ipinput.addEventListener('input', (e)=>{
selIp = e.target.value;
document.querySelector('.selip').innerText = selIp;
})
var latestData = null;
function saveLatestData(data) {
const a = document.createElement('a'); a.href = URL.createObjectURL(new Blob([JSON.stringify(data)], { type: 'application/json' })); a.download = 'data.json'; a.click();
}
save.addEventListener('click', ()=>{
if(latestData) {
saveLatestData(latestData);
}
})
const reload = ()=>{
var ip = document.querySelector('#ip');
var port = document.querySelector('#port');
var motd = document.querySelector('#motd');
var playerOnline = document.querySelector('#playerOnline');
var playerMax = document.querySelector('#playerMax');
var version = document.querySelector('#version');
var isOnline = document.querySelector('#isOnline');
var software = document.querySelector('#software');
var [ ping, query, srv ] = [document.querySelector('#ping'), document.querySelector('#query'), document.querySelector('#srv')]
const icon = document.querySelector('.icon');
fetch("https://api.mcsrvstat.us/3/"+selIp)
.then(x => x.json())
.then(x => {
latestData = x;
ip.innerText = x.ip;
port.innerText = x.port;
motd.innerHTML = x.motd.html;
playerOnline.innerText = x.players.online;
playerMax.innerText = x.players.max;
software.innerText = x.software;
version.innerText = x.version;
isOnline.innerText = x.online;
ping.innerText = x.debug.ping;
query.innerText = x.debug.query;
srv.innerText = x.debug.srv;
icon.src = x.icon;
})
}
document.querySelector('#reload').onclick = reload;
</script>
</body>
</html>