BraydenMoore commited on
Commit
3733085
1 Parent(s): 5bed416

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +5 -1
templates/index.html CHANGED
@@ -271,11 +271,14 @@
271
  const countryElement = document.getElementById("country");
272
  let firstLoad = true;
273
  let isJpeg = false;
 
274
 
275
  const loadingGif = "{{ url_for('static', filename='eye.gif') }}";
276
  const newUrl = decodeURIComponent("{{ url|safe }}");
277
 
278
  async function refreshImage() {
 
 
279
  try {
280
  const response = await fetch(newUrl, { method: 'HEAD' });
281
  if (!response.ok) {
@@ -317,7 +320,8 @@
317
  setTimeout(async () => {
318
  await refreshImage();
319
  }, 250);
320
- }
 
321
  }
322
 
323
  async function init() {
 
271
  const countryElement = document.getElementById("country");
272
  let firstLoad = true;
273
  let isJpeg = false;
274
+ let isLoading = false;
275
 
276
  const loadingGif = "{{ url_for('static', filename='eye.gif') }}";
277
  const newUrl = decodeURIComponent("{{ url|safe }}");
278
 
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) {
 
320
  setTimeout(async () => {
321
  await refreshImage();
322
  }, 250);
323
+ }
324
+ isLoading = false;
325
  }
326
 
327
  async function init() {