BraydenMoore commited on
Commit
0b3a3ad
·
1 Parent(s): 495fade

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +58 -59
templates/index.html CHANGED
@@ -264,7 +264,65 @@
264
 
265
 
266
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  // Handle feed load and refresh
269
  let controller;
270
  document.addEventListener("DOMContentLoaded", function() {
@@ -325,65 +383,6 @@
325
  }
326
  }
327
 
328
- async function init() {
329
- feed.style.width = "80px";
330
- feed.style.height = "50px";
331
- feed.src = loadingGif;
332
- feed.style.opacity = "0.15";
333
- infoText.style.opacity = "0";
334
- locationName.textContent = "{{ page_title|safe }}";
335
-
336
- await refreshImage();
337
-
338
- feed.onload = function() {
339
- isLoading = false;
340
- if (isJpeg) {
341
- setTimeout(async () => {
342
- await refreshImage();
343
- }, 250);
344
- }
345
-
346
- if (firstLoad) {
347
- countryElement.textContent = "connecting...";
348
- infoDiv.style.opacity = "0";
349
- }
350
- firstLoad = false;
351
-
352
- setTimeout(() => {
353
- locationName.textContent = "{{ name|safe }}";
354
- countryElement.textContent = "{{ country|safe }}";
355
- feed.style.width = "100%";
356
- feed.style.height = "70%";
357
- feed.style.opacity = "1";
358
- infoDiv.style.opacity = "1";
359
- }, 100);
360
-
361
- infoText.style.opacity = "1";
362
- };
363
-
364
- feed.onerror = function() {
365
- console.error('Error loading feed', this.src);
366
- const urlParams = new URLSearchParams(window.location.search);
367
-
368
- if (urlParams.get('id')) {
369
- firstLoad = false;
370
- feed.style.width = "80px";
371
- feed.style.height = "50px";
372
- feed.src = loadingGif;
373
- feed.style.opacity = "0.15";
374
- countryElement.textContent = "couldn't connect.";
375
- } else if (firstLoad) {
376
- window.location.href = "?new=true";
377
- } else {
378
- firstLoad = false;
379
- console.log("Trying again");
380
- setTimeout(refreshImage, 500);
381
- }
382
- };
383
-
384
-
385
- }
386
-
387
  init();
388
  console.log('Feed load initiated');
389
  });
 
264
 
265
 
266
  <script>
267
+
268
+ // init
269
+ async function init() {
270
+ feed.style.width = "80px";
271
+ feed.style.height = "50px";
272
+ feed.src = loadingGif;
273
+ feed.style.opacity = "0.15";
274
+ infoText.style.opacity = "0";
275
+ locationName.textContent = "{{ page_title|safe }}";
276
+
277
+ await refreshImage();
278
+
279
+ feed.onload = function() {
280
+ isLoading = false;
281
+ if (isJpeg) {
282
+ setTimeout(async () => {
283
+ await refreshImage();
284
+ }, 250);
285
+ }
286
+
287
+ if (firstLoad) {
288
+ countryElement.textContent = "connecting...";
289
+ infoDiv.style.opacity = "0";
290
+ }
291
+ firstLoad = false;
292
+
293
+ setTimeout(() => {
294
+ locationName.textContent = "{{ name|safe }}";
295
+ countryElement.textContent = "{{ country|safe }}";
296
+ feed.style.width = "100%";
297
+ feed.style.height = "70%";
298
+ feed.style.opacity = "1";
299
+ infoDiv.style.opacity = "1";
300
+ }, 100);
301
+
302
+ infoText.style.opacity = "1";
303
+ };
304
 
305
+ feed.onerror = function() {
306
+ console.error('Error loading feed', this.src);
307
+ const urlParams = new URLSearchParams(window.location.search);
308
+
309
+ if (urlParams.get('id')) {
310
+ firstLoad = false;
311
+ feed.style.width = "80px";
312
+ feed.style.height = "50px";
313
+ feed.src = loadingGif;
314
+ feed.style.opacity = "0.15";
315
+ countryElement.textContent = "couldn't connect.";
316
+ } else if (firstLoad) {
317
+ window.location.href = "?new=true";
318
+ } else {
319
+ firstLoad = false;
320
+ console.log("Trying again");
321
+ setTimeout(refreshImage, 500);
322
+ }
323
+ };
324
+ }
325
+
326
  // Handle feed load and refresh
327
  let controller;
328
  document.addEventListener("DOMContentLoaded", function() {
 
383
  }
384
  }
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  init();
387
  console.log('Feed load initiated');
388
  });