Spaces:
Running
Running
Commit
·
49746af
1
Parent(s):
ad4aed3
Update index.html
Browse files- index.html +17 -0
index.html
CHANGED
@@ -87,8 +87,25 @@
|
|
87 |
totalUploaded = Array.from(progressMap.values()).reduce((a, b) => a + b, 0);
|
88 |
const progressBar = document.getElementById('progressBar');
|
89 |
progressBar.value = totalUploaded;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
};
|
|
|
92 |
|
93 |
xhr.send(init.body);
|
94 |
});
|
|
|
87 |
totalUploaded = Array.from(progressMap.values()).reduce((a, b) => a + b, 0);
|
88 |
const progressBar = document.getElementById('progressBar');
|
89 |
progressBar.value = totalUploaded;
|
90 |
+
|
91 |
+
// Calculate speed
|
92 |
+
const elapsedSeconds = (Date.now() - startTime) / 1000;
|
93 |
+
const speedInMBps = totalUploaded / elapsedSeconds / 1024 / 1024;
|
94 |
+
|
95 |
+
// Update speed display
|
96 |
+
const speedDisplay = document.getElementById('speedDisplay');
|
97 |
+
speedDisplay.textContent = `${speedInMBps.toFixed(2)} MB/s`;
|
98 |
+
|
99 |
+
// Update processing message
|
100 |
+
const processingMessage = document.getElementById('processingMessage');
|
101 |
+
if (totalUploaded === 0) {
|
102 |
+
processingMessage.textContent = 'Preparing your upload';
|
103 |
+
} else if (totalUploaded === progressBar.max) {
|
104 |
+
processingMessage.textContent = 'Processing your upload';
|
105 |
+
}
|
106 |
}
|
107 |
};
|
108 |
+
|
109 |
|
110 |
xhr.send(init.body);
|
111 |
});
|