Commit
·
b225114
1
Parent(s):
d9063d0
Update templates/index.html
Browse files- templates/index.html +9 -7
templates/index.html
CHANGED
|
@@ -265,8 +265,6 @@
|
|
| 265 |
<script>
|
| 266 |
|
| 267 |
// Handle feed load and refresh
|
| 268 |
-
let controller = new AbortController();
|
| 269 |
-
let signal = controller.signal;
|
| 270 |
|
| 271 |
document.addEventListener("DOMContentLoaded", function() {
|
| 272 |
const feed = document.getElementById("feed");
|
|
@@ -281,12 +279,14 @@
|
|
| 281 |
const loadingGif = "{{ url_for('static', filename='eye.gif') }}";
|
| 282 |
const newUrl = decodeURIComponent("{{ url|safe }}");
|
| 283 |
|
|
|
|
|
|
|
| 284 |
async function refreshImage() {
|
| 285 |
-
if
|
| 286 |
-
|
| 287 |
-
|
| 288 |
controller = new AbortController();
|
| 289 |
-
signal = controller.signal;
|
| 290 |
|
| 291 |
try {
|
| 292 |
const response = await fetch(newUrl, { method: 'HEAD' , signal: signal});
|
|
@@ -392,7 +392,9 @@
|
|
| 392 |
// Stop stream when click button
|
| 393 |
document.querySelectorAll('.abortButton').forEach(button => {
|
| 394 |
button.addEventListener('click', () => {
|
| 395 |
-
controller
|
|
|
|
|
|
|
| 396 |
});
|
| 397 |
});
|
| 398 |
|
|
|
|
| 265 |
<script>
|
| 266 |
|
| 267 |
// Handle feed load and refresh
|
|
|
|
|
|
|
| 268 |
|
| 269 |
document.addEventListener("DOMContentLoaded", function() {
|
| 270 |
const feed = document.getElementById("feed");
|
|
|
|
| 279 |
const loadingGif = "{{ url_for('static', filename='eye.gif') }}";
|
| 280 |
const newUrl = decodeURIComponent("{{ url|safe }}");
|
| 281 |
|
| 282 |
+
let controller;
|
| 283 |
+
|
| 284 |
async function refreshImage() {
|
| 285 |
+
if(controller) {
|
| 286 |
+
controller.abort();
|
| 287 |
+
}
|
| 288 |
controller = new AbortController();
|
| 289 |
+
const signal = controller.signal;
|
| 290 |
|
| 291 |
try {
|
| 292 |
const response = await fetch(newUrl, { method: 'HEAD' , signal: signal});
|
|
|
|
| 392 |
// Stop stream when click button
|
| 393 |
document.querySelectorAll('.abortButton').forEach(button => {
|
| 394 |
button.addEventListener('click', () => {
|
| 395 |
+
if (controller) {
|
| 396 |
+
controller.abort();
|
| 397 |
+
}
|
| 398 |
});
|
| 399 |
});
|
| 400 |
|