BraydenMoore commited on
Commit
778b22a
1 Parent(s): 12c957f

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +11 -0
templates/index.html CHANGED
@@ -263,6 +263,9 @@
263
  <script>
264
 
265
  // Handle feed load and refresh
 
 
 
266
  document.addEventListener("DOMContentLoaded", function() {
267
  const feed = document.getElementById("feed");
268
  const infoDiv = document.getElementById("info");
@@ -279,6 +282,9 @@
279
  async function refreshImage() {
280
  if (isLoading) return;
281
  isLoading = true;
 
 
 
282
  try {
283
  const response = await fetch(newUrl, { method: 'HEAD' });
284
  if (!response.ok) {
@@ -380,6 +386,11 @@
380
  console.log('Feed load initiated');
381
  });
382
 
 
 
 
 
 
383
 
384
  // Time count
385
  document.addEventListener("DOMContentLoaded", function() {
 
263
  <script>
264
 
265
  // Handle feed load and refresh
266
+ let controller = new AbortController();
267
+ let signal = controller.signal;
268
+
269
  document.addEventListener("DOMContentLoaded", function() {
270
  const feed = document.getElementById("feed");
271
  const infoDiv = document.getElementById("info");
 
282
  async function refreshImage() {
283
  if (isLoading) return;
284
  isLoading = true;
285
+ controller = new AbortController();
286
+ signal = controller.signal;
287
+
288
  try {
289
  const response = await fetch(newUrl, { method: 'HEAD' });
290
  if (!response.ok) {
 
386
  console.log('Feed load initiated');
387
  });
388
 
389
+ // Stop stream when click button
390
+ document.querySelectorAll('hoverButton').forEach(button => {
391
+ button.addEventListener('click', () => {
392
+ controller.abort();
393
+
394
 
395
  // Time count
396
  document.addEventListener("DOMContentLoaded", function() {