-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
149 lines (141 loc) · 4.78 KB
/
Copy pathdashboard.html
File metadata and controls
149 lines (141 loc) · 4.78 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minecraft Server Dashboard</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
color: #333;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.dashboard {
width: 350px;
text-align: center;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
background-color: #fff;
border-radius: 10px;
}
.status-message {
margin: 20px 0;
padding: 10px;
font-size: 1.2em;
color: #fff;
background-color: #333;
border-radius: 5px;
}
.green {
background-color: #4CAF50;
}
.red {
background-color: #E53935;
}
button {
padding: 10px 20px;
margin: 10px;
border-radius: 5px;
border: none;
background-color: #4CAF50;
color: white;
cursor: pointer;
font-size: 1em;
}
button:hover {
background-color: #45a049;
}
button.disabled {
background-color: #ccc;
cursor: not-allowed;
}
nav {
background: #333;
color: white;
padding: 10px 0;
margin-bottom: 20px;
}
nav a {
color: white;
margin: 0 15px;
text-decoration: none;
font-size: 16px;
}
nav a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="dashboard">
<nav>
<a href="options.html">Options</a>
<a href="console.html">Console</a>
<a href="players.html">Players</a>
<a href="worlds.html">Worlds</a>
<a href="access.html">Access</a>
</nav>
<h1>Minecraft Server Dashboard</h1>
<div class="status-message">Server is offline</div>
<button onclick="toggleServer()">Start Server</button>
</div>
<script>
let serverRunning = false;
function toggleServer() {
const button = document.querySelector('button');
const statusMessage = document.querySelector('.status-message');
button.disabled = true; // Disable the button during operation
if (!serverRunning) {
serverRunning = true;
startServer(statusMessage, button);
} else {
serverRunning = false;
stopServer(statusMessage, button);
}
}
function startServer(statusMessage, button) {
const steps = ['Loading Worlds...', 'Loading Addons...', 'Loading Saved Files...', 'Starting Server...'];
let index = 0;
let intervalId = setInterval(() => {
if (index < steps.length) {
statusMessage.textContent = steps[index];
index++;
} else {
clearInterval(intervalId);
statusMessage.textContent = 'Server is online';
statusMessage.className = 'status-message green';
button.textContent = 'Stop Server';
button.disabled = false;
localStorage.setItem('serverStatus', 'online');
}
}, 1000);
}
function stopServer(statusMessage, button) {
statusMessage.textContent = 'Stopping Server...';
statusMessage.className = 'status-message red';
setTimeout(() => {
statusMessage.textContent = 'Server is offline';
button.textContent = 'Start Server';
button.disabled = false;
localStorage.setItem('serverStatus', 'offline');
}, 3000);
}
window.onload = function() {
const statusMessage = document.querySelector('.status-message');
const button = document.querySelector('button');
serverRunning = localStorage.getItem('serverStatus') === 'online';
if (serverRunning) {
statusMessage.textContent = 'Server is online';
statusMessage.className = 'status-message green';
button.textContent = 'Stop Server';
}
};
</script>
</body>
</html>