F1CTL/Core/Html/index.html
2024-12-15 14:07:02 +08:00

189 lines
4.0 KiB
HTML

R"(<!DOCTYPE html>
<html><head>
<title>W5500 Configuration</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #f5f5f5;
}
h2 {
color: #333;
text-align: center;
padding-bottom: 10px;
border-bottom: 2px solid #ddd;
font-size: clamp(1.5rem, 4vw, 2rem);
}
form {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
width: 100%;
max-width: 600px;
margin: 0 auto;
}
.form-group {
margin-bottom: 15px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
}
label {
font-weight: bold;
color: #555;
min-width: 80px;
flex: 0 0 auto;
}
input[type='text'] {
flex: 1;
min-width: 200px;
max-width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
font-family: monospace;
box-sizing: border-box;
}
input[type='submit'] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
width: 100%;
max-width: 300px;
display: block;
margin: 20px auto 0;
}
input[type='submit']:hover {
background-color: #45a049;
}
.status {
margin-top: 20px;
padding: 10px;
border-radius: 4px;
text-align: center;
width: 100%;
max-width: 600px;
margin: 20px auto;
box-sizing: border-box;
}
.connected {
background-color: #dff0d8;
color: #3c763d;
border: 1px solid #d6e9c6;
}
.disconnected {
background-color: #f2dede;
color: #a94442;
border: 1px solid #ebccd1;
}
@media screen and (max-width: 600px) {
body {
padding: 10px;
margin: 10px;
}
form {
padding: 15px;
}
.form-group {
flex-direction: column;
align-items: stretch;
}
label {
margin-bottom: 5px;
}
input[type='text'] {
width: 100%;
}
}
@media screen and (max-width: 400px) {
h2 {
font-size: 1.2rem;
}
form {
padding: 10px;
}
input[type='submit'] {
padding: 8px 16px;
font-size: 14px;
}
}
.loading {
display: none;
text-align: center;
padding: 10px;
color: #666;
}
.loading.active {
display: block;
}
form.submitting input {
opacity: 0.7;
pointer-events: none;
}
input[type='submit'].loading {
background-color: #cccccc;
cursor: not-allowed;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
const form = document.querySelector('form');
const submitBtn = form.querySelector('input[type="submit"]');
form.addEventListener('submit', function(e) {
submitBtn.value = 'Saving...';
submitBtn.classList.add('loading');
form.classList.add('submitting');
setTimeout(function() {
if(submitBtn.classList.contains('loading')) {
submitBtn.value = 'Save Configuration';
submitBtn.classList.remove('loading');
form.classList.remove('submitting');
alert('Request timeout. Please try again.');
}
}, 5000);
});
});
</script>
</head><body>
<h2>W5500 Network Configuration</h2>
<form method='post' action='/config'>
<div class='form-group'>
<label>MAC:</label>
<input type='text' name='mac' value='%02X:%02X:%02X:%02X:%02X:%02X'>
</div>
<div class='form-group'>
<label>IP:</label>
<input type='text' name='ip' value='%d.%d.%d.%d'>
</div>
<div class='form-group'>
<label>Subnet:</label>
<input type='text' name='subnet' value='%d.%d.%d.%d'>
</div>
<div class='form-group'>
<label>Gateway:</label>
<input type='text' name='gateway' value='%d.%d.%d.%d'>
</div>
<input type='submit' value='Save Configuration'>
</form>
<div class='status %s'>
Network Status: %s
</div>
</body></html>)"