-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathws_page_template.html
67 lines (66 loc) · 2.56 KB
/
ws_page_template.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
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script>function proceed(direction) {
fetch("/control", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: 'key=' + direction
});
document.getElementById("lastControl").innerHTML = direction;
}
function proceed2(direction) {
const xhr = new XMLHttpRequest();
xhr.open("POST", "/control");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send('key=' + direction);
document.getElementById("lastControl").innerHTML = direction;
}
</script>
</head>
<body>
<p class="h1 text-center">LED Matrix control (running on ESP8266/ESP32 WebServer)</p>
<div class="container text-center">
<div class="row row-cols-3">
<div class="col-5"></div>
<div class="col-2">
<button type="button" class="btn btn-primary" onclick="proceed('up');"><i class="fa fa-arrow-up fa-2x"></i></button>
</div>
<div class="col-2">
<button type="button" class="btn btn-outline-primary" onclick="proceed('btnStart');"><i class="fa fa-play fa-2x"></i></button>
</div>
<div class="col-3"></div>
</div>
<div class="row row-cols-3">
<div class="col-5"></div>
<div class="col-1">
<button type="button" class="btn btn-primary" onclick="proceed2('left');"><i class="fa fa-arrow-left fa-2x"></i></button>
</div>
<div class="col-1">
<button type="button" class="btn btn-primary" onclick="proceed2('right');"><i class="fa fa-arrow-right fa-2x"></i></button>
</div>
<div class="col-5"></div>
</div>
<div class="row row-cols-3">
<div class="col-5"></div>
<div class="col-2">
<button type="button" class="btn btn-primary" onclick="proceed('down');"><i class="fa fa-arrow-down fa-2x"></i></button>
</div>
<div class="col-2">
<button type="button" class="btn btn-outline-primary" onclick="proceed('btnA');"><i class="fa fa-plus-circle fa-2x"></i></button>
<button type="button" class="btn btn-outline-primary" onclick="proceed('btnB');"><i class="fa fa-minus-circle fa-2x"></i></button>
</div>
<div class="col-3"></div>
</div>
<div class="row row-cols-3">
<div class="col-3"></div>
<div class="col-6">
<div class="text-right">Control pressed: <div id="lastControl"></div>
</div>
</div>
<div class="col-3"></div>
</div>
</div>
</body>
</html>