-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (85 loc) · 1.84 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
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="style.css?v=0.1">
<script>
function UpdateStatus()
{
$.get({
url: "/powerStatus",
success: function( data ) {
$(".screen").css("background-color", data == true ? "#dcff71" : "#ffc071");
$(".screen").find(".textOnScreen").children().html(data == true ? "online" : "offline");
var startButton = $(".startButton");
if (data == true)
{
startButton.addClass("forceShutDownButton");
startButton.html("off");
}
else
{
startButton.removeClass("forceShutDownButton");
startButton.html("on");
}
},
async: false
});
}
function PowerOn()
{
$.get({
url: "/powerOn",
success: function( data ) {
if (data == true)
UpdateStatus();
},
async: false
});
}
function ForcePowerOff()
{
$.get({
url: "/forcePowerOff",
success: function( data ) {
if (data == true)
UpdateStatus();
},
async: false
});
}
$(document).ready(function() {
$(".startButton").click(function() {
PowerOn();
});
$(".forceShutDownButton").click(function() {
ForcePowerOff();
});
UpdateStatus();
var intervalId = window.setInterval(UpdateStatus, 5000);
});
</script>
</head>
<body>
<div class="monitor">
<div class="screen">
<div class="textOnScreen">
<div>
offline
</div>
</div>
<div class="buttons">
<div class="glow-on-hover button">
<div class="noselect startButton">
on
</div>
</div>
<div class="glow-on-hover button">
<div class="noselect forceShutDownButton">
force off
</div>
</div>
</div>
</div>
</div>
</body>
</html>