better clientside upload dedup

This commit is contained in:
ed 2021-11-10 20:57:45 +01:00
parent 391caca043
commit 8a59b40c53
4 changed files with 13 additions and 29 deletions

View file

@ -2096,10 +2096,6 @@ html.light #u2foot .warn span {
color: #fff;
padding-left: .2em;
}
#u2cleanup {
float: right;
margin-bottom: -.3em;
}
.fsearch_explain {
padding-left: .7em;
font-size: 1.1em;

View file

@ -122,7 +122,7 @@ ebi('op_up2k').innerHTML = (
' <tr>\n' +
' <td>filename</td>\n' +
' <td>status</td>\n' +
' <td>progress<a href="#" id="u2cleanup" tt="remove completed uploads$N(makes it possible to upload a file after searching for it)">cleanup</a></td>\n' +
' <td>progress</td>\n' +
' </tr>\n' +
' </thead>\n' +
' <tbody></tbody>\n' +

View file

@ -669,6 +669,7 @@ function up2k_init(subtle) {
var st = {
"files": [],
"seen": {},
"todo": {
"head": [],
"hash": [],
@ -994,13 +995,9 @@ function up2k_init(subtle) {
}
function up_them(good_files) {
var seen = {},
evpath = get_evpath(),
var evpath = get_evpath(),
draw_each = good_files.length < 50;
for (var a = 0; a < st.files.length; a++)
seen[st.files[a].name + '\n' + st.files[a].size] = 1;
for (var a = 0; a < good_files.length; a++) {
var fobj = good_files[a][0],
name = good_files[a][1],
@ -1026,15 +1023,20 @@ function up2k_init(subtle) {
"bytes_uploaded": 0,
"hash": []
},
key = entry.name + '\n' + entry.size;
key = name + '\n' + entry.size + '\n' + lmod + '\n' + uc.fsearch;
if (uc.fsearch)
entry.srch = 1;
if (seen[key])
try {
if (st.seen[fdir][key])
continue;
}
catch (ex) {
st.seen[fdir] = {};
}
seen[key] = 1;
st.seen[fdir][key] = 1;
pvis.addfile([
uc.fsearch ? esc(entry.name) : linksplit(
@ -1067,20 +1069,6 @@ function up2k_init(subtle) {
}
more_one_file();
function u2cleanup(e) {
ev(e);
for (var a = 0; a < st.files.length; a++) {
var t = st.files[a];
if (t.done && t.name) {
if (!qsr('#f' + t.n))
continue;
t.name = undefined;
}
}
}
ebi('u2cleanup').onclick = u2cleanup;
var etaref = 0, etaskip = 0, op_minh = 0;
function etafun() {
var nhash = st.busy.head.length + st.busy.hash.length + st.todo.head.length + st.todo.hash.length,

View file

@ -9,7 +9,7 @@
#ops, #tree, #path, #wrap>h2:last-child, /* main tabs and navigators (tree/breadcrumbs) */
#u2cleanup, #u2conf tr:first-child>td[rowspan]:not(#u2btn_cw), /* most of the config options */
#u2conf tr:first-child>td[rowspan]:not(#u2btn_cw), /* most of the config options */
#srch_dz, #srch_zd, /* the filesearch dropzone */