mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Slightly improved descriptive upload progress
Bumped v1 version string
This commit is contained in:
parent
78cea4a4b9
commit
c4c45a5857
2
dist/js/home.js
vendored
2
dist/js/home.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/home.js.map
vendored
2
dist/js/home.js.map
vendored
File diff suppressed because one or more lines are too long
@ -341,8 +341,10 @@ page.prepareDropzone = () => {
|
|||||||
if (page.uploadAge !== null) xhr.setRequestHeader('age', page.uploadAge)
|
if (page.uploadAge !== null) xhr.setRequestHeader('age', page.uploadAge)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not chunked uploads OR first chunk
|
if (file.upload.chunked)
|
||||||
if (!file.upload.chunked || file.upload.chunks.length === 1)
|
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'
|
file.previewElement.querySelector('.descriptive-progress').innerHTML = 'Uploading\u2026'
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -350,7 +352,7 @@ page.prepareDropzone = () => {
|
|||||||
this.on('uploadprogress', (file, progress) => {
|
this.on('uploadprogress', (file, progress) => {
|
||||||
// Total bytes will eventually be bigger than file size when chunked
|
// Total bytes will eventually be bigger than file size when chunked
|
||||||
const total = Math.max(file.size, file.upload.total)
|
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
|
const prefix = file.upload.chunked
|
||||||
? `Uploading chunk ${file.upload.chunks.length}/${file.upload.totalChunkCount}\u2026`
|
? `Uploading chunk ${file.upload.chunks.length}/${file.upload.totalChunkCount}\u2026`
|
||||||
@ -368,7 +370,7 @@ page.prepareDropzone = () => {
|
|||||||
const prettyBytesPerSec = page.getPrettyBytes(bytesPerSec)
|
const prettyBytesPerSec = page.getPrettyBytes(bytesPerSec)
|
||||||
|
|
||||||
file.previewElement.querySelector('.descriptive-progress').innerHTML =
|
file.previewElement.querySelector('.descriptive-progress').innerHTML =
|
||||||
`${prefix} ${percentage}%${prettyBytesPerSec ? ` at ~${prettyBytesPerSec}/s` : ''}`
|
`${prefix} ${file._percentage}%${prettyBytesPerSec ? ` at ~${prettyBytesPerSec}/s` : ''}`
|
||||||
})
|
})
|
||||||
|
|
||||||
this.on('success', (file, response) => {
|
this.on('success', (file, response) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"1": "1574781142",
|
"1": "1574788369",
|
||||||
"2": "1568894058",
|
"2": "1568894058",
|
||||||
"3": "1568894058",
|
"3": "1568894058",
|
||||||
"4": "1568894058",
|
"4": "1568894058",
|
||||||
|
Loading…
Reference in New Issue
Block a user