|
3 | 3 | <head> |
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
6 | | - <title>ESP32 Camera</title> |
| 6 | + <title>ESP32-CAM Camera</title> |
7 | 7 | <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png"> |
8 | 8 | <link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png"> |
9 | 9 | <link rel="stylesheet" type="text/css" href="/css/style.css"> |
|
22 | 22 | <body> |
23 | 23 | <section class="main"> |
24 | 24 | <div id="logo"> |
25 | | - <label for="nav-toggle-cb" id="nav-toggle" style="float:left;">☰ Settings </label> |
26 | | - <button id="swap-viewer" style="float:left;">Simple</button> |
27 | | - <button id="nw-setup" style="float:left;" title="Configure network parameters">Network</button> |
28 | | - <button id="monitor" style="float:left;" title="Monitor system parameters">System</button> |
29 | | - <button id="get-still" style="float:left;" title="Capture a still image">Get Still</button> |
30 | | - <button id="toggle-stream" style="float:left;" class="hidden">Start Stream</button> |
| 25 | + <label for="nav-toggle-cb" id="nav-toggle" >☰ Camera </label> |
| 26 | + <button id="nw-setup" style="float:left;" title="Configure network parameters">Setup</button> |
| 27 | + <button id="monitor" style="float:left;" title="Monitor system parameters">Dump</button> |
| 28 | + <button id="get-still" style="float:left;" title="Capture a still image">Picture</button> |
| 29 | + <button id="toggle-stream" style="float:left;" class="hidden">Video</button> |
31 | 30 | <div id="wait-settings" style="float:left;" class="loader" title="Waiting for camera settings to load"></div> |
32 | 31 | </div> |
33 | 32 | <div id="content"> |
|
67 | 66 | const streamButton = document.getElementById('toggle-stream'); |
68 | 67 | const closeButton = document.getElementById('close-stream'); |
69 | 68 |
|
70 | | - const swapButton = document.getElementById('swap-viewer'); |
71 | 69 |
|
72 | 70 | const networkButton = document.getElementById('nw-setup'); |
73 | 71 | const monitorButton = document.getElementById('monitor'); |
74 | 72 |
|
75 | 73 | const toggleViewMode = () => { |
| 74 | + const swapButton = document.getElementById('swap-viewer'); |
76 | 75 | if(viewMode.checked) { |
77 | | - swapButton.innerHTML = "Full"; |
| 76 | + swapButton.innerHTML = 'More <i class="fa fa-caret-down"></i>'; |
78 | 77 | } |
79 | 78 | else { |
80 | | - swapButton.innerHTML = "Simple"; |
| 79 | + swapButton.innerHTML = 'Less <i class="fa fa-caret-up"></i>'; |
81 | 80 | } |
82 | 81 |
|
83 | 82 | toggleMenuVisible(false); |
|
110 | 109 |
|
111 | 110 | const stopStream = () => { |
112 | 111 | viewFrame.src = ''; |
113 | | - streamButton.innerHTML = 'Start Stream'; |
| 112 | + streamButton.innerHTML = 'Video'; |
114 | 113 | streamButton.setAttribute("title", `Start the stream`); |
| 114 | + setLightSlider(false); |
115 | 115 | hide(viewContainer); |
116 | 116 | } |
117 | 117 |
|
118 | 118 | const startStream = () => { |
119 | 119 | viewFrame.src = '/view?mode=stream'; |
120 | 120 | view.scrollIntoView(false); |
121 | | - streamButton.innerHTML = 'Stop Stream'; |
| 121 | + streamButton.innerHTML = 'Stop'; |
122 | 122 | streamButton.setAttribute("title", `Stop the stream`); |
| 123 | + setLightSlider(true); |
123 | 124 | show(viewContainer); |
124 | 125 | } |
125 | 126 |
|
| 127 | + |
| 128 | + |
126 | 129 | const applyRotation = (el) => { |
127 | 130 | rot = el.value; |
128 | 131 | if (rot == -90) { |
|
161 | 164 | div_group.appendChild(createButton("save_prefs", "Save", "Save preferences on camera module", "true", "cam")); |
162 | 165 | div_group.appendChild(createButton("remove_prefs", "Erase", "Erase saved preferences on camera module", "true", "cam")); |
163 | 166 | div_group.appendChild(createButton("reboot", "Reboot", "Reboot the camera module", "true")); |
| 167 | + div_group.appendChild(createButton("swap-viewer", "More","Show more controls")); |
164 | 168 |
|
165 | 169 | parent.appendChild(div_group); |
166 | 170 | }; |
|
179 | 183 | return response.json(); |
180 | 184 | }) |
181 | 185 | .then(function (state) { |
182 | | - document.title = state['cam_name']; |
| 186 | + document.title = state['cam_name'] + ' Camera'; |
183 | 187 | var cam_model = cameraTypes.find(item => item.pid == state['cam_pid']); |
184 | 188 | if(cam_model) |
185 | 189 | console.log("Camera " + cam_model.name + " detected"); |
|
209 | 213 | } |
210 | 214 |
|
211 | 215 | monitorButton.onclick = () => { |
212 | | - window.open('/dump', "_blank"); |
| 216 | + window.location.href = '/dump'; |
213 | 217 | } |
214 | 218 |
|
215 | 219 | stillButton.onclick = () => { |
|
225 | 229 | }; |
226 | 230 |
|
227 | 231 | streamButton.onclick = () => { |
228 | | - const streamEnabled = streamButton.innerHTML === 'Stop Stream' |
| 232 | + const streamEnabled = streamButton.innerHTML === 'Stop' |
229 | 233 | if (streamEnabled) { |
230 | 234 | stopStream(); |
231 | 235 | } else { |
232 | 236 | startStream(); |
233 | 237 | } |
234 | 238 | }; |
235 | 239 |
|
236 | | - viewSettings.onchange = () => { |
237 | | - if(viewSettings.checked) |
238 | | - show(swapButton); |
239 | | - else |
240 | | - hide(swapButton); |
241 | | - }; |
242 | 240 |
|
243 | 241 | // Attach default on change action |
244 | 242 | document |
245 | 243 | .querySelectorAll('.default-action') |
246 | 244 | .forEach(el => { |
247 | 245 | if(el.type == "submit") |
248 | 246 | el.onclick = () => { |
249 | | - if(submitChanges(el)) { |
250 | | - if(el.id == "reboot") { |
251 | | - hide(settings); |
252 | | - hide(viewContainer); |
253 | | - header.innerHTML = '<h1>Rebooting!</h1><hr>Page will reload after 30 seconds.'; |
254 | | - } |
| 247 | + if(el.id == "swap-viewer") { |
| 248 | + var value = viewMode.checked ? 1 : 0; |
| 249 | + viewMode.checked = !value; |
| 250 | + toggleViewMode(); |
255 | 251 | } |
| 252 | + else |
| 253 | + if(submitChanges(el)) { |
| 254 | + if(el.id == "reboot") { |
| 255 | + hide(settings); |
| 256 | + hide(viewContainer); |
| 257 | + header.innerHTML = '<h1>Rebooting!</h1><hr>Page will reload after 30 seconds.'; |
| 258 | + } |
| 259 | + } |
256 | 260 | } |
257 | 261 | else { |
258 | 262 | el.onchange = () => { |
|
270 | 274 | .forEach(el => { |
271 | 275 | el.oninput = () => updateRangeConfig(el) |
272 | 276 | }); |
273 | | - |
274 | | - |
275 | | - swapButton.onclick = () => { |
276 | | - var value = viewMode.checked ? 1 : 0; |
277 | | - viewMode.checked = !value; |
278 | | - toggleViewMode(); |
279 | | - }; |
280 | 277 |
|
281 | 278 | toggleMenuVisible(true); |
282 | 279 | }); |
|
0 commit comments