Commit
·
cf8f5f9
1
Parent(s):
c221235
Update templates/index.html
Browse files- templates/index.html +6 -5
templates/index.html
CHANGED
@@ -281,21 +281,22 @@
|
|
281 |
infoText.style.opacity = "0";
|
282 |
};
|
283 |
|
284 |
-
|
285 |
-
feed.src =
|
286 |
feed.style.width = "100%";
|
287 |
feed.style.height = "70%";
|
288 |
feed.style.opacity = "1";
|
289 |
infoText.style.opacity = "1";
|
290 |
country.textContent = "{{ country }}";
|
291 |
};
|
292 |
-
|
293 |
const refreshImage = () => {
|
294 |
let xhr = new XMLHttpRequest();
|
295 |
-
|
|
|
296 |
xhr.onreadystatechange = () => {
|
297 |
if (xhr.readyState === 4 && xhr.status === 200 && xhr.getResponseHeader('Content-Type') === 'image/jpeg') {
|
298 |
-
setLoadedState();
|
299 |
}
|
300 |
};
|
301 |
xhr.send();
|
|
|
281 |
infoText.style.opacity = "0";
|
282 |
};
|
283 |
|
284 |
+
const setLoadedState = (url) => {
|
285 |
+
feed.src = url;
|
286 |
feed.style.width = "100%";
|
287 |
feed.style.height = "70%";
|
288 |
feed.style.opacity = "1";
|
289 |
infoText.style.opacity = "1";
|
290 |
country.textContent = "{{ country }}";
|
291 |
};
|
292 |
+
|
293 |
const refreshImage = () => {
|
294 |
let xhr = new XMLHttpRequest();
|
295 |
+
const urlWithTimestamp = `${newUrl}?t=${new Date().getTime()}`;
|
296 |
+
xhr.open('HEAD', urlWithTimestamp, true);
|
297 |
xhr.onreadystatechange = () => {
|
298 |
if (xhr.readyState === 4 && xhr.status === 200 && xhr.getResponseHeader('Content-Type') === 'image/jpeg') {
|
299 |
+
setLoadedState(urlWithTimestamp);
|
300 |
}
|
301 |
};
|
302 |
xhr.send();
|