-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshutdown-generator.html
More file actions
141 lines (135 loc) · 3.96 KB
/
shutdown-generator.html
File metadata and controls
141 lines (135 loc) · 3.96 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
<!DOCTYPE html>
<html>
<head>
<title>Shutdown Command Generator</title>
<!-- Include flatpickr -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<style>
/* Algemene styling */
body {
font-family: Arial, sans-serif;
background-color: #333;
color: #fff;
text-align: center;
margin: 0;
padding: 0;
}
h1 {
margin-top: 50px;
font-size: 2.5em;
}
form {
margin: 20px;
}
label,
input,
select {
margin-bottom: 20px;
}
/* Knop styling */
.button {
padding: 15px 30px;
font-size: 18px;
cursor: pointer;
background-color: #555;
color: #fff;
border: none;
border-radius: 25px;
/* Afgeronde hoeken */
transition: background-color 0.3s ease, transform 0.3s ease;
/* Hover animatie */
}
/* Hover animatie */
.button:hover {
background-color: #777;
transform: scale(1.05);
/* Vergroot de knop iets */
}
</style>
</head>
<body>
<h1>Shutdown Command Generator</h1>
<form id="shutdownForm">
<!-- Tijd in seconden -->
<label for="time">Tijd (in seconden):</label>
<input type="number" id="time" name="time">
<br>
<br>
<!-- Time Picker Input -->
<label for="timePicker">Selecteer tijd:</label>
<input type="text" id="timePicker" placeholder="Select Time">
<br>
<br>
<!-- Snelle tijdselectie knoppen -->
<button type="button" onclick="setTime(600)">10 minuten</button>
<button type="button" onclick="setTime(3600)">1 uur</button>
<br>
<br>
<label for="action">Actie:</label>
<select id="action" name="action">
<option value="shutdown">Afsluiten</option>
<option value="restart">Herstarten</option>
</select>
<br>
<br>
<input type="checkbox" id="force" name="force">
<label for="force">Forceer afsluiten (/f)</label>
<br>
<br>
<label for="message">Bericht:</label>
<input type="text" id="message" name="message">
<br>
<br>
<input type="button" class="button" value="Genereer Commando" onclick="generateCommand()">
</form>
<h2>Uw Commando:</h2>
<p id="commandOutput"></p>
<script>
function setTime(seconds) {
document.getElementById("time").value = seconds;
}
// Initialize flatpickr
flatpickr("#timePicker", {
enableTime: true,
noCalendar: true,
dateFormat: "H:i",
time_24hr: true,
onChange: function(selectedDates, dateStr, instance) {
let selectedTime = selectedDates[0];
let currentTime = new Date();
let timeDifference = Math.floor((selectedTime - currentTime) / 1000);
if (timeDifference < 0) {
// If the time seems to be 'in the past', add 24 hours (for the next day)
timeDifference += 24 * 3600;
}
document.getElementById("time").value = timeDifference;
}
});
function generateCommand() {
let time = document.getElementById("time").value;
let action = document.getElementById("action").value;
let force = document.getElementById("force").checked;
let message = document.getElementById("message").value;
let command = "shutdown ";
// Tijd omzetten naar seconden
if (time) {
command += `-t ${time} `;
}
if (action === "restart") {
command += "-r ";
}
if (action === "shutdown") {
command += "-s ";
}
if (force) {
command += "-f ";
}
if (message) {
command += `-c "${message}" `;
}
document.getElementById("commandOutput").innerText = command;
}
</script>
</body>
</html>