Spaces:
Running
Running
BraydenMoore
commited on
Commit
·
fc0cfed
1
Parent(s):
709a571
Update templates/index.html
Browse files- templates/index.html +9 -20
templates/index.html
CHANGED
@@ -169,27 +169,16 @@
|
|
169 |
const feed = document.getElementById("feed");
|
170 |
feed.src = "{{ url_for('static', filename='loading.gif') }}";
|
171 |
|
172 |
-
function setImageSource(url, isImage = false) {
|
173 |
-
const img = new Image();
|
174 |
-
img.onload = function() {
|
175 |
-
feed.src = this.src;
|
176 |
-
if (isImage) {
|
177 |
-
setTimeout(() => setImageSource(url.replace("COUNTER", Math.random()), true), 500);
|
178 |
-
}
|
179 |
-
};
|
180 |
-
img.onerror = function() {
|
181 |
-
feed.src = "{{ url_for('static', filename='error.png') }}";
|
182 |
-
};
|
183 |
-
img.src = url;
|
184 |
-
}
|
185 |
-
|
186 |
const newUrl = "{{ url }}";
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
193 |
});
|
194 |
</script>
|
195 |
</body>
|
|
|
169 |
const feed = document.getElementById("feed");
|
170 |
feed.src = "{{ url_for('static', filename='loading.gif') }}";
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
const newUrl = "{{ url }}";
|
173 |
+
|
174 |
+
const img = new Image();
|
175 |
+
img.onload = function() {
|
176 |
+
feed.src = this.src;
|
177 |
+
};
|
178 |
+
img.onerror = function() {
|
179 |
+
feed.src = "{{ url_for('static', filename='error.png') }}"; // You can set an error image here
|
180 |
+
};
|
181 |
+
img.src = newUrl;
|
182 |
});
|
183 |
</script>
|
184 |
</body>
|