From 70d07d1609a5c3fbe88240d3f3163dfa5c8e185c Mon Sep 17 00:00:00 2001
From: ed
Date: Wed, 27 Jul 2022 14:01:30 +0200
Subject: [PATCH] perf
---
copyparty/web/up2k.js | 40 +++++++++++++++++++++++-----------------
copyparty/web/util.js | 2 ++
2 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js
index ab300f6e..4356fcf6 100644
--- a/copyparty/web/up2k.js
+++ b/copyparty/web/up2k.js
@@ -205,7 +205,7 @@ function U2pvis(act, btns, uc, st) {
if (!r.is_act(fo.in))
return;
- var k = 'f{0}{1}'.format(nfile, field.slice(1)),
+ var k = 'f' + nfile + '' + field.slice(1),
obj = ebi(k);
obj.innerHTML = field == 'ht' ? (markup[html] || html) : html;
@@ -250,9 +250,7 @@ function U2pvis(act, btns, uc, st) {
nb = fo.bt * (++fo.nh / fo.cb.length),
p = r.perc(nb, 0, fobj.size, fobj.t_hashing);
- fo.hp = '{0}%, {1}, {2} MB/s'.format(
- f2f(p[0], 2), p[1], f2f(p[2], 2)
- );
+ fo.hp = f2f(p[0], 2) + '%, ' + p[1] + ', ' + f2f(p[2], 2) + ' MB/s';
if (!r.is_act(fo.in))
return;
@@ -269,14 +267,12 @@ function U2pvis(act, btns, uc, st) {
fo.bd += delta;
var p = r.perc(fo.bd, fo.bd0, fo.bt, fobj.t_uploading);
- fo.hp = '{0}%, {1}, {2} MB/s'.format(
- f2f(p[0], 2), p[1], f2f(p[2], 2)
- );
+ fo.hp = f2f(p[0], 2) + '%, ' + p[1] + ', ' + f2f(p[2], 2) + ' MB/s';
if (!r.is_act(fo.in))
return;
- var obj = ebi('f{0}p'.format(fobj.n)),
+ var obj = ebi('f' + fobj.n + 'p'),
o1 = p[0] - 2, o2 = p[0] - 0.1, o3 = p[0];
if (!obj) {
@@ -446,8 +442,8 @@ function U2pvis(act, btns, uc, st) {
r.npotato = 0;
var html = [
- "
files: {0} finished, {1} failed, {2} busy, {3} queued
".format(r.ctr.ok, r.ctr.ng, r.ctr.bz, r.ctr.q), - ]; + "files: {0} finished, {1} failed, {2} busy, {3} queued
".format( + r.ctr.ok, r.ctr.ng, r.ctr.bz, r.ctr.q)]; while (r.head < r.tab.length && has(["ok", "ng"], r.tab[r.head].in)) r.head++; @@ -457,7 +453,8 @@ function U2pvis(act, btns, uc, st) { act = r.tab[r.head]; if (act) - html.push("file {0} of {1} : {2} {3}
file {0} of {1} : {2} {3}