Spaces:
Running
Running
Commit
·
5584bf1
1
Parent(s):
5b4bf65
Update templates/index.html
Browse files- templates/index.html +13 -40
templates/index.html
CHANGED
@@ -177,46 +177,19 @@
|
|
177 |
// });
|
178 |
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
xhr.onprogress = function(e) {
|
194 |
-
var arrayBuffer = new Uint8Array(buffer.byteLength + e.loaded);
|
195 |
-
arrayBuffer.set(new Uint8Array(buffer), 0);
|
196 |
-
arrayBuffer.set(new Uint8Array(xhr.response), buffer.byteLength);
|
197 |
-
|
198 |
-
// Parse buffer to find the boundary and extract JPEG images
|
199 |
-
while (true) {
|
200 |
-
var start = arrayBuffer.indexOf(boundary);
|
201 |
-
var end = arrayBuffer.indexOf(boundary, start + boundary.length);
|
202 |
-
|
203 |
-
if (start === -1 || end === -1) {
|
204 |
-
break;
|
205 |
-
}
|
206 |
-
|
207 |
-
var blob = new Blob([arrayBuffer.slice(start + boundary.length, end)], { type: "image/jpeg" });
|
208 |
-
var urlCreator = window.URL || window.webkitURL;
|
209 |
-
var imageUrl = urlCreator.createObjectURL(blob);
|
210 |
-
image.src = imageUrl;
|
211 |
-
|
212 |
-
arrayBuffer = arrayBuffer.slice(end);
|
213 |
-
}
|
214 |
-
|
215 |
-
buffer = arrayBuffer;
|
216 |
-
};
|
217 |
-
|
218 |
-
xhr.send();
|
219 |
-
});
|
220 |
</script>
|
221 |
</body>
|
222 |
|
|
|
177 |
// });
|
178 |
|
179 |
|
180 |
+
document.addEventListener("DOMContentLoaded", function() {
|
181 |
+
const feed = document.getElementById("feed");
|
182 |
+
feed.src = "{{ url_for('static', filename='loading.gif') }}";
|
183 |
+
|
184 |
+
const newUrl = "{{ url }}";
|
185 |
+
|
186 |
+
const img = new Image();
|
187 |
+
img.onload = function() {
|
188 |
+
feed.src = this.src;
|
189 |
+
};
|
190 |
+
img.src = newUrl;
|
191 |
+
});
|
192 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
</script>
|
194 |
</body>
|
195 |
|