Slightly improved descriptive upload progress

Bumped v1 version string
This commit is contained in:
Bobby Wibowo 2019-11-27 00:12:58 +07:00
parent 78cea4a4b9
commit c4c45a5857
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
4 changed files with 9 additions and 7 deletions

2
dist/js/home.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/home.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -341,8 +341,10 @@ page.prepareDropzone = () => {
if (page.uploadAge !== null) xhr.setRequestHeader('age', page.uploadAge)
}
// If not chunked uploads OR first chunk
if (!file.upload.chunked || file.upload.chunks.length === 1)
if (file.upload.chunked)
file.previewElement.querySelector('.descriptive-progress').innerHTML =
`Uploading chunk ${file.upload.chunks.length}/${file.upload.totalChunkCount}\u2026${file._percentage ? ` ${file._percentage}%` : ''}`
else
file.previewElement.querySelector('.descriptive-progress').innerHTML = 'Uploading\u2026'
})
@ -350,7 +352,7 @@ page.prepareDropzone = () => {
this.on('uploadprogress', (file, progress) => {
// Total bytes will eventually be bigger than file size when chunked
const total = Math.max(file.size, file.upload.total)
const percentage = (file.upload.bytesSent / total * 100).toFixed(0)
file._percentage = (file.upload.bytesSent / total * 100).toFixed(0)
const prefix = file.upload.chunked
? `Uploading chunk ${file.upload.chunks.length}/${file.upload.totalChunkCount}\u2026`
@ -368,7 +370,7 @@ page.prepareDropzone = () => {
const prettyBytesPerSec = page.getPrettyBytes(bytesPerSec)
file.previewElement.querySelector('.descriptive-progress').innerHTML =
`${prefix} ${percentage}%${prettyBytesPerSec ? ` at ~${prettyBytesPerSec}/s` : ''}`
`${prefix} ${file._percentage}%${prettyBytesPerSec ? ` at ~${prettyBytesPerSec}/s` : ''}`
})
this.on('success', (file, response) => {

View File

@ -1,5 +1,5 @@
{
"1": "1574781142",
"1": "1574788369",
"2": "1568894058",
"3": "1568894058",
"4": "1568894058",