-
Notifications
You must be signed in to change notification settings - Fork 0
/
cam.html
48 lines (45 loc) · 1.43 KB
/
cam.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
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Camera Server</title>
<link type="text/css" rel="stylesheet" href="/cam.css"/>
</head>
<body>
<script>
function switch_src() {
var btn = document.getElementById("src-switcher");
var feed = document.getElementById("feed");
var txt = document.getElementById("sel-src");
var plain = btn.classList.contains("plain");
var cls = [txt.classList, btn.classList];
if (plain) {
feed.setAttribute("src", "/cam-proc");
txt.textContent = "PROCESSED";
cls.forEach(function (e) {
e.remove("plain");
e.add("deco");
});
} else {
feed.setAttribute("src", "/cam");
txt.textContent = "PLAIN";
cls.forEach(function (e) {
e.remove("deco");
e.add("plain");
});
}
}
function switch_feeds() {
var oReq = new XMLHttpRequest();
oReq.open("GET", "/feed-change");
oReq.send();
}
</script>
<div>
<img id="feed" class="center" width="625" height="500" src="/cam"/>
<p id="sel-src" class="center center-text plain">PLAIN</p>
<button id="src-switcher" class="btn center plain" onclick="switch_src()">Switch Source</button>
<button id="feed-switcher" class="btn center plain" onclick="switch_feeds()">Switch Feed</button>
</div>
</body>
</html>