-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
238 lines (207 loc) · 6.61 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PortalPoint - Minecraft Coordinate Converter</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
padding: 20px;
background-color: #f3f3f3;
/* Light gray background */
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
}
h1 {
text-align: center;
color: #4CAF50;
/* Green header */
margin-bottom: 20px;
}
form {
background: #ffffff;
/* White form background */
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.form-group {
margin-bottom: 15px;
transition: opacity 0.3s ease;
}
.form-group label {
display: block;
margin-bottom: 5px;
color: #555;
text-align: center;
/* Center align label text */
}
.form-group input,
.form-group select {
width: calc(100% - 22px);
padding: 10px;
border: 1px solid #ccc;
/* Light gray border */
border-radius: 8px;
transition: border-color 0.3s ease, background-color 0.3s ease;
background-color: #f9f9f9;
/* Light gray input background */
}
.form-group input:invalid {
border-color: #ff8080;
/* Light red border on invalid */
}
.form-group.error {
animation: pulse 0.5s ease-in-out infinite alternate;
}
@keyframes pulse {
from {
transform: scale(1);
}
to {
transform: scale(1.02);
}
}
button {
background-color: #4CAF50;
/* Green button */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
margin: 20px auto 0;
cursor: pointer;
border-radius: 8px;
transition: background-color 0.3s ease, transform 0.2s ease;
width: 100%;
}
button:hover {
background-color: #45a049;
/* Darker green on hover */
}
#result {
border: 1px solid #ccc;
/* Light gray border */
padding: 20px;
margin-top: 15px;
border-radius: 8px;
font-size: 18px;
text-align: center;
background: #ffffff;
/* White result background */
animation: slideIn 0.5s forwards;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.error {
color: #ff8080;
/* Light red error message */
font-size: 14px;
margin-top: 5px;
text-align: center;
transition: opacity 0.3s ease;
}
@media screen and (max-width: 600px) {
form {
width: 100%;
}
}
</style>
<script>
function validateInput(input) {
return !isNaN(input) && input >= 0 && input <= 10000;
}
function convert(event) {
event.preventDefault();
const inputX = parseInt(document.getElementById('inputX').value);
const inputZ = parseInt(document.getElementById('inputZ').value);
const type = document.getElementById('conversionType').value;
let resultX, resultZ;
let hasError = false;
// Reset error messages and borders
document.getElementById('errorX').innerHTML = '';
document.getElementById('errorZ').innerHTML = '';
document.getElementById('inputX').style.borderColor = '#ccc';
document.getElementById('inputZ').style.borderColor = '#ccc';
// Check each input for validity and display errors if necessary
if (isNaN(inputX) || inputX < 0 || inputX > 10000 || inputX.toString().trim() === '') {
document.getElementById('errorX').innerHTML = 'Please enter valid integers between 0 and 10000';
document.getElementById('inputX').style.borderColor = '#ff8080';
document.getElementById('inputX').parentElement.classList.add('error');
hasError = true;
} else {
document.getElementById('inputX').parentElement.classList.remove('error');
}
if (isNaN(inputZ) || inputZ < 0 || inputZ > 10000 || inputZ.toString().trim() === '') {
document.getElementById('errorZ').innerHTML = 'Please enter valid integers between 0 and 10000';
document.getElementById('inputZ').style.borderColor = '#ff8080';
document.getElementById('inputZ').parentElement.classList.add('error');
hasError = true;
} else {
document.getElementById('inputZ').parentElement.classList.remove('error');
}
if (hasError) {
return;
}
// Perform conversion based on type selected
if (type === 'overworld') {
resultX = inputX / 8;
resultZ = inputZ / 8;
} else {
resultX = inputX * 8;
resultZ = inputZ * 8;
}
// Display the result with animation
document.getElementById('result').innerHTML = `Result: X=${resultX.toFixed(2)}, Z=${resultZ.toFixed(2)}`;
document.getElementById('result').style.animation = 'slideIn 0.5s forwards';
}
</script>
</head>
<body>
<h1>PortalPoint - Minecraft Coordinate Converter</h1>
<form>
<div class="form-group">
<label for="inputX">X:</label>
<input type="number" id="inputX" placeholder="Enter coordinate" aria-label="Enter X coordinate"
title="Enter the X coordinate">
<div id="errorX" class="error"></div>
</div>
<div class="form-group">
<label for="inputZ">Z:</label>
<input type="number" id="inputZ" placeholder="Enter coordinate" aria-label="Enter Z coordinate"
title="Enter the Z coordinate">
<div id="errorZ" class="error"></div>
</div>
<div class="form-group">
<label for="conversionType">Conversion Type:</label>
<select id="conversionType">
<option value="overworld">Overworld to Nether</option>
<option value="nether">Nether to Overworld</option>
</select>
</div>
<button onclick="convert(event)">Convert</button>
</form>
<div id="result"></div>
</body>
</html>