-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
157 lines (146 loc) · 7.81 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
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
150
151
152
153
154
155
156
157
<!doctype html>
<!--suppress HtmlUnknownTarget -->
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>WIT IEEE WRT Router</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="css/2-col.css" rel="stylesheet">
<link rel="shortcut icon" href="/luci-static/bootstrap/favicon.ico">
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">WIT IEEE WRT Router</a>
<div id="navbarResponsive">
<a class="btn btn-primary" href="/cgi-bin/luci/admin/status/">Router Status</a>
</div>
</div>
</nav>
<!-- Page Content -->
<div class="container">
<!-- Page Heading -->
<h1 class="my-4">IEEE 3D Printers
</h1>
<div class="row">
<div class="col-lg-6 portfolio-item">
<div class="card h-100">
<a id="topLeftImageLink" href="#"><img class="card-img-top" id="topLeftWebcamImage"
src="http://via.placeholder.com/700x400?text=IMAGE+UNAVAILABLE"
alt=""></a>
<div class="card-body">
<h4 class="card-title">
<a id="topLeftLink" href="#"></a>
</h4>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod
odio, gravida pellentesque urna varius vitae.</p>
</div>
</div>
</div>
<div class="col-lg-6 portfolio-item">
<div class="card h-100">
<a id="topRightImageLink" href="#"><img class="card-img-top" id="topRightWebcamImage"
src="http://via.placeholder.com/700x400?text=IMAGE+UNAVAILABLE"
alt=""></a>
<div class="card-body">
<h4 class="card-title">
<a id="topRightLink" href="#"></a>
</h4>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit aliquam aperiam
nulla perferendis dolor nobis numquam, rem expedita, aliquid optio, alias illum eaque. Non
magni, voluptates quae, necessitatibus unde temporibus.</p>
</div>
</div>
</div>
<div class="col-lg-6 portfolio-item">
<div class="card h-100">
<a id="bottomLeftImageLink" href="#"><img class="card-img-top" id="bottomLeftWebcamImage"
src="http://via.placeholder.com/700x400?text=IMAGE+UNAVAILABLE"
alt=""></a>
<div class="card-body">
<h4 class="card-title">
<a id="bottomLeftLink" href="#"></a>
</h4>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod
odio, gravida pellentesque urna varius vitae.</p>
</div>
</div>
</div>
<div class="col-lg-6 portfolio-item">
<div class="card h-100">
<a id="bottomRightImageLink" href="#"><img class="card-img-top" id="bottomRightWebcamImage"
src="http://via.placeholder.com/700x400?text=IMAGE+UNAVAILABLE"
alt=""></a>
<div class="card-body">
<h4 class="card-title">
<a id="bottomRightLink" href="#"></a>
</h4>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit aliquam aperiam
nulla perferendis dolor nobis numquam, rem expedita, aliquid optio, alias illum eaque. Non
magni, voluptates quae, necessitatibus unde temporibus.</p>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"
integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
crossorigin="anonymous"></script>
<script type="text/javascript">
const Printers = {
TOP_LEFT: {name: "Blackout", localIP: "10.0.0.6", remotePort: "8084", image: "img/Blackout.jpg"},
TOP_RIGHT: {name: "Stukmaken", localIP: "10.0.0.5", remotePort: "8083", image: "img/Stukmaken.jpg"},
BOTTOM_LEFT: {name: "Too European", localIP: "10.0.0.4", remotePort: "8082"},
BOTTOM_RIGHT: {name: "Printer 4", localIP: "10.0.0.3", remotePort: "8081"}
};
document.getElementById('topLeftLink').href = getPrinterURL(Printers.TOP_LEFT);
document.getElementById('topLeftLink').innerText = Printers.TOP_LEFT.name;
document.getElementById('topLeftImageLink').href = getPrinterURL(Printers.TOP_LEFT);
displayImageIfAvailable(document.getElementById('topLeftWebcamImage'), Printers.TOP_LEFT);
document.getElementById('topRightLink').href = getPrinterURL(Printers.TOP_RIGHT);
document.getElementById('topRightLink').innerText = Printers.TOP_RIGHT.name;
document.getElementById('topRightImageLink').href = getPrinterURL(Printers.TOP_RIGHT);
displayImageIfAvailable(document.getElementById('topRightWebcamImage'), Printers.TOP_RIGHT);
document.getElementById('bottomLeftLink').href = getPrinterURL(Printers.BOTTOM_LEFT);
document.getElementById('bottomLeftLink').innerText = Printers.BOTTOM_LEFT.name;
document.getElementById('bottomLeftImageLink').href = getPrinterURL(Printers.BOTTOM_LEFT);
displayImageIfAvailable(document.getElementById('bottomLeftWebcamImage'), Printers.BOTTOM_LEFT);
document.getElementById('bottomRightLink').href = getPrinterURL(Printers.BOTTOM_RIGHT);
document.getElementById('bottomRightLink').innerText = Printers.BOTTOM_RIGHT.name;
document.getElementById('bottomRightImageLink').href = getPrinterURL(Printers.BOTTOM_RIGHT);
displayImageIfAvailable(document.getElementById('bottomRightWebcamImage'), Printers.BOTTOM_RIGHT);
function getPrinterURL(printer) {
if (window.location.hostname.includes("10.0.0")) {
return printer.localIP;
} else {
return "http://" + window.location.hostname + ":" + printer.remotePort;
}
}
function displayImageIfAvailable(imageReference, printer) {
let webcamURL = getPrinterURL(printer) + "/webcam/?action=stream";
let request = new XMLHttpRequest();
request.open('GET', webcamURL, true);
request.send(); //Blocks until request is completed
if (request.status === 200) {
imageReference.src = webcamURL;
} else if (printer.image !== undefined) {
imageReference.src = printer.image;
}
}
</script>
</body>
</html>