code cleanup
This commit is contained in:
parent
4680d7f014
commit
d21b873327
12 changed files with 40 additions and 213 deletions
|
|
@ -1597,10 +1597,10 @@ function renderProgressBar(bar, bytes, totalBytes) {
|
|||
bar.value = Math.min(sent, bar.max)
|
||||
}
|
||||
|
||||
// Older peers only send the overall byte totals - then those drive the bar.
|
||||
// The bar follows the current phase's bytes (a phase starts empty).
|
||||
function barValues(info) {
|
||||
let bytes = Math.max(0, Number(info.barBytes == null ? info.bytes : info.barBytes) || 0)
|
||||
let total = Math.max(0, Number(info.barTotalBytes == null ? info.totalBytes : info.barTotalBytes) || 0)
|
||||
let bytes = Math.max(0, Number(info.barBytes) || 0)
|
||||
let total = Math.max(0, Number(info.barTotalBytes) || 0)
|
||||
// a provisional total can be smaller than what already moved (it grows as
|
||||
// entries arrive): the bar reads full, never over 100%
|
||||
if (total > 0 && bytes > total) bytes = total
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue