mirror of
https://github.com/Dangoware/confetti-box.git
synced 2025-04-19 07:12:58 -05:00
Made progress bar smoothly fill
This commit is contained in:
parent
ed0af7f969
commit
8515ba382e
1 changed files with 4 additions and 2 deletions
|
@ -173,13 +173,15 @@ async function addNewToList(origFileName) {
|
|||
function uploadProgress(progress, progressBar, progressText, progressValues, fileSize, ID) {
|
||||
if (progress.lengthComputable) {
|
||||
progressValues[ID] = progress.loaded;
|
||||
const progressTotal = progressValues.reduce((a, b) => a + b, 0);
|
||||
|
||||
const progressPercent = Math.floor((progressValues.reduce((a, b) => a + b, 0) / fileSize) * 100);
|
||||
const progressPercent = Math.floor((progressTotal / fileSize) * 100);
|
||||
if (progressPercent == 100) {
|
||||
progressBar.removeAttribute("value");
|
||||
progressText.textContent = "⏳";
|
||||
} else {
|
||||
progressBar.value = progressPercent;
|
||||
progressBar.value = progressTotal;
|
||||
progressBar.max = fileSize;
|
||||
progressText.textContent = progressPercent + "%";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue