Spaces:
Running
Running
Commit
·
034b530
1
Parent(s):
8bfcef4
Update templates/index.html
Browse files- templates/index.html +59 -60
templates/index.html
CHANGED
@@ -280,63 +280,6 @@
|
|
280 |
const loadingGif = "{{ url_for('static', filename='eye.gif') }}";
|
281 |
const newUrl = decodeURIComponent("{{ url|safe }}");
|
282 |
|
283 |
-
async function init() {
|
284 |
-
feed.style.width = "80px";
|
285 |
-
feed.style.height = "50px";
|
286 |
-
feed.src = loadingGif;
|
287 |
-
feed.style.opacity = "0.15";
|
288 |
-
infoText.style.opacity = "0";
|
289 |
-
locationName.textContent = "{{ page_title|safe }}";
|
290 |
-
|
291 |
-
await refreshImage();
|
292 |
-
|
293 |
-
feed.onload = function() {
|
294 |
-
isLoading = false;
|
295 |
-
if (isJpeg) {
|
296 |
-
setTimeout(async () => {
|
297 |
-
await refreshImage();
|
298 |
-
}, 250);
|
299 |
-
}
|
300 |
-
|
301 |
-
if (firstLoad) {
|
302 |
-
countryElement.textContent = "connecting...";
|
303 |
-
infoDiv.style.opacity = "0";
|
304 |
-
}
|
305 |
-
firstLoad = false;
|
306 |
-
|
307 |
-
setTimeout(() => {
|
308 |
-
locationName.textContent = "{{ name|safe }}";
|
309 |
-
countryElement.textContent = "{{ country|safe }}";
|
310 |
-
feed.style.width = "100%";
|
311 |
-
feed.style.height = "70%";
|
312 |
-
feed.style.opacity = "1";
|
313 |
-
infoDiv.style.opacity = "1";
|
314 |
-
}, 100);
|
315 |
-
|
316 |
-
infoText.style.opacity = "1";
|
317 |
-
};
|
318 |
-
|
319 |
-
feed.onerror = function() {
|
320 |
-
console.error('Error loading feed', this.src);
|
321 |
-
const urlParams = new URLSearchParams(window.location.search);
|
322 |
-
|
323 |
-
if (urlParams.get('id')) {
|
324 |
-
firstLoad = false;
|
325 |
-
feed.style.width = "80px";
|
326 |
-
feed.style.height = "50px";
|
327 |
-
feed.src = loadingGif;
|
328 |
-
feed.style.opacity = "0.15";
|
329 |
-
countryElement.textContent = "couldn't connect.";
|
330 |
-
} else if (firstLoad) {
|
331 |
-
window.location.href = "?new=true";
|
332 |
-
} else {
|
333 |
-
firstLoad = false;
|
334 |
-
console.log("Trying again");
|
335 |
-
setTimeout(refreshImage, 500);
|
336 |
-
}
|
337 |
-
};
|
338 |
-
}
|
339 |
-
|
340 |
// Handle feed load and refresh
|
341 |
document.addEventListener("DOMContentLoaded", function() {
|
342 |
|
@@ -384,11 +327,67 @@
|
|
384 |
|
385 |
}
|
386 |
}
|
387 |
-
|
388 |
-
init();
|
389 |
-
console.log('Feed load initiated');
|
390 |
});
|
391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
// Stop stream when click button
|
393 |
document.querySelectorAll('.abortButton').forEach(button => {
|
394 |
button.addEventListener('click', () => {
|
|
|
280 |
const loadingGif = "{{ url_for('static', filename='eye.gif') }}";
|
281 |
const newUrl = decodeURIComponent("{{ url|safe }}");
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
// Handle feed load and refresh
|
284 |
document.addEventListener("DOMContentLoaded", function() {
|
285 |
|
|
|
327 |
|
328 |
}
|
329 |
}
|
|
|
|
|
|
|
330 |
});
|
331 |
|
332 |
+
async function init() {
|
333 |
+
feed.style.width = "80px";
|
334 |
+
feed.style.height = "50px";
|
335 |
+
feed.src = loadingGif;
|
336 |
+
feed.style.opacity = "0.15";
|
337 |
+
infoText.style.opacity = "0";
|
338 |
+
locationName.textContent = "{{ page_title|safe }}";
|
339 |
+
|
340 |
+
await refreshImage();
|
341 |
+
|
342 |
+
feed.onload = function() {
|
343 |
+
isLoading = false;
|
344 |
+
if (isJpeg) {
|
345 |
+
setTimeout(async () => {
|
346 |
+
await refreshImage();
|
347 |
+
}, 250);
|
348 |
+
}
|
349 |
+
|
350 |
+
if (firstLoad) {
|
351 |
+
countryElement.textContent = "connecting...";
|
352 |
+
infoDiv.style.opacity = "0";
|
353 |
+
}
|
354 |
+
firstLoad = false;
|
355 |
+
|
356 |
+
setTimeout(() => {
|
357 |
+
locationName.textContent = "{{ name|safe }}";
|
358 |
+
countryElement.textContent = "{{ country|safe }}";
|
359 |
+
feed.style.width = "100%";
|
360 |
+
feed.style.height = "70%";
|
361 |
+
feed.style.opacity = "1";
|
362 |
+
infoDiv.style.opacity = "1";
|
363 |
+
}, 100);
|
364 |
+
|
365 |
+
infoText.style.opacity = "1";
|
366 |
+
};
|
367 |
+
|
368 |
+
feed.onerror = function() {
|
369 |
+
console.error('Error loading feed', this.src);
|
370 |
+
const urlParams = new URLSearchParams(window.location.search);
|
371 |
+
|
372 |
+
if (urlParams.get('id')) {
|
373 |
+
firstLoad = false;
|
374 |
+
feed.style.width = "80px";
|
375 |
+
feed.style.height = "50px";
|
376 |
+
feed.src = loadingGif;
|
377 |
+
feed.style.opacity = "0.15";
|
378 |
+
countryElement.textContent = "couldn't connect.";
|
379 |
+
} else if (firstLoad) {
|
380 |
+
window.location.href = "?new=true";
|
381 |
+
} else {
|
382 |
+
firstLoad = false;
|
383 |
+
console.log("Trying again");
|
384 |
+
setTimeout(refreshImage, 500);
|
385 |
+
}
|
386 |
+
};
|
387 |
+
}
|
388 |
+
init();
|
389 |
+
console.log('Feed load initiated');
|
390 |
+
|
391 |
// Stop stream when click button
|
392 |
document.querySelectorAll('.abortButton').forEach(button => {
|
393 |
button.addEventListener('click', () => {
|