24
24
< title > Minecraft server tester</ title >
25
25
</ head >
26
26
27
- < body onload =" checkMojangStatus() " >
27
+ < body >
28
28
< noscript >
29
29
< h1 > This website unfortunately requires JavaScript.</ h1 >
30
30
</ noscript >
@@ -33,16 +33,8 @@ <h1>Minecraft server tester</h1>
33
33
< input id ="address-entry " placeholder ="Server address " />
34
34
< br />
35
35
< br />
36
- < button id ="java-btn " onclick ="doPing('/api/java/') " class ="java ">
37
- Ping Java
38
- </ button >
39
- < button
40
- id ="bedrock-btn "
41
- onclick ="doPing('/api/bedrock/') "
42
- class ="bedrock "
43
- >
44
- Ping Bedrock
45
- </ button >
36
+ < button id ="java-btn " class ="java "> Ping Java</ button >
37
+ < button id ="bedrock-btn " class ="bedrock "> Ping Bedrock</ button >
46
38
< br />
47
39
< br />
48
40
< span id ="ip-descriptor " class ="ip "> Your IP:</ span >
@@ -66,7 +58,7 @@ <h1>Minecraft server tester</h1>
66
58
< br />
67
59
< div id ="server-motd "> </ div >
68
60
< br />
69
- < button onclick =" window.location.reload() "> Ping Another</ button >
61
+ < button id =" reset-ping "> Ping Another</ button >
70
62
</ div >
71
63
< br id ="special-break " hidden />
72
64
< a href ="/api/ "> API</ a >
@@ -90,6 +82,9 @@ <h1>Minecraft server tester</h1>
90
82
const addressEntry = document . getElementById ( "address-entry" ) ;
91
83
const selectElement = document . getElementById ( "select-ping" ) ;
92
84
const responseElement = document . getElementById ( "server-response" ) ;
85
+ const resetPingElement = document . getElementById ( "reset-ping" ) ;
86
+ const javaTriggerElement = document . getElementById ( "java-btn" ) ;
87
+ const bedrockTriggerElement = document . getElementById ( "bedrock-btn" ) ;
93
88
94
89
fetch ( "https://v4.giveip.io/raw" )
95
90
. then ( ( rsp ) => rsp . text ( ) )
@@ -103,6 +98,19 @@ <h1>Minecraft server tester</h1>
103
98
ipElement . addEventListener ( "click" , ipClick ) ;
104
99
ipMsgElement . addEventListener ( "click" , ipClick ) ;
105
100
ipDescriptorElement . addEventListener ( "click" , ipClick ) ;
101
+ resetPingElement . addEventListener ( "click" , function ( _ ) {
102
+ window . location . reload ( ) ;
103
+ } ) ;
104
+ javaTriggerElement . addEventListener ( "click" , function ( _ ) {
105
+ doPing ( "/api/java/" ) ;
106
+ } ) ;
107
+ bedrockTriggerElement . addEventListener ( "click" , function ( _ ) {
108
+ doPing ( "/api/bedrock/" ) ;
109
+ } ) ;
110
+
111
+ document . addEventListener ( "load" , function ( _ ) {
112
+ checkMojangStatus ( ) . then ( ( ) => { } ) ;
113
+ } ) ;
106
114
107
115
async function doPing ( apiLocation ) {
108
116
let address = addressEntry . value ;
0 commit comments