mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
add up2k cleanup button
This commit is contained in:
parent
fa656577d1
commit
8081f9ddfd
|
@ -986,6 +986,8 @@ function apply_perms(perms) {
|
|||
goto();
|
||||
}
|
||||
|
||||
document.body.setAttribute('perms', perms.join(' '));
|
||||
|
||||
var have_write = has(perms, "write");
|
||||
var tds = document.querySelectorAll('#u2conf td');
|
||||
for (var a = 0; a < tds.length; a++) {
|
||||
|
@ -993,7 +995,7 @@ function apply_perms(perms) {
|
|||
(have_write || tds[a].getAttribute('data-perm') == 'read') ?
|
||||
'table-cell' : 'none';
|
||||
}
|
||||
if (!have_write)
|
||||
if (!have_write && up2k)
|
||||
up2k.set_fsearch();
|
||||
}
|
||||
|
||||
|
|
|
@ -368,6 +368,7 @@ function up2k_init(have_crypto) {
|
|||
"size": fobj.size,
|
||||
"lmod": lmod / 1000,
|
||||
"purl": get_vpath(),
|
||||
"done": false,
|
||||
"hash": []
|
||||
};
|
||||
|
||||
|
@ -400,6 +401,19 @@ function up2k_init(have_crypto) {
|
|||
}
|
||||
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) {
|
||||
var tr = ebi('f{0}p'.format(t.n)).parentNode;
|
||||
tr.parentNode.removeChild(tr);
|
||||
t.name = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
ebi('u2cleanup').onclick = u2cleanup;
|
||||
|
||||
/////
|
||||
////
|
||||
/// actuator
|
||||
|
@ -819,6 +833,7 @@ function up2k_init(have_crypto) {
|
|||
st.busy.handshake.splice(st.busy.handshake.indexOf(t), 1);
|
||||
|
||||
if (done) {
|
||||
t.done = true;
|
||||
st.bytes.uploaded += t.size - t.bytes_uploaded;
|
||||
var spd1 = (t.size / ((t.t2 - t.t1) / 1000.)) / (1024 * 1024.);
|
||||
var spd2 = (t.size / ((t.t3 - t.t2) / 1000.)) / (1024 * 1024.);
|
||||
|
@ -1112,6 +1127,10 @@ function up2k_init(have_crypto) {
|
|||
for (var a = nodes.length - 1; a >= 0; a--)
|
||||
nodes[a].addEventListener('touchend', nop, false);
|
||||
|
||||
var perms = document.body.getAttribute('perms');
|
||||
if (perms && perms.indexOf('write') === -1)
|
||||
set_fsearch();
|
||||
|
||||
bumpthread({ "target": 1 })
|
||||
|
||||
return { "init_deps": init_deps, "set_fsearch": set_fsearch }
|
||||
|
|
|
@ -212,3 +212,7 @@
|
|||
color: #fff;
|
||||
padding-left: .2em;
|
||||
}
|
||||
#u2cleanup {
|
||||
float: right;
|
||||
margin-bottom: -.3em;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<tr>
|
||||
<td>filename</td>
|
||||
<td>status</td>
|
||||
<td>progress</td>
|
||||
<td>progress<a href="#" id="u2cleanup">cleanup</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
Loading…
Reference in a new issue