compat + perf + ux

This commit is contained in:
ed 2021-08-08 04:02:58 +02:00
parent 953183f16d
commit ee86b06676
5 changed files with 35 additions and 25 deletions

View file

@ -1243,7 +1243,7 @@ class Up2k(object):
hops = len(ndst[nc:]) - 1 hops = len(ndst[nc:]) - 1
lsrc = "../" * hops + "/".join(lsrc) lsrc = "../" * hops + "/".join(lsrc)
os.symlink(fsenc(lsrc), fsenc(ldst)) os.symlink(fsenc(lsrc), fsenc(ldst))
except (AttributeError, OSError) as ex: except Exception as ex:
self.log("cannot symlink; creating copy: " + repr(ex)) self.log("cannot symlink; creating copy: " + repr(ex))
shutil.copy2(fsenc(src), fsenc(dst)) shutil.copy2(fsenc(src), fsenc(dst))

View file

@ -1568,7 +1568,10 @@ var fileman = (function () {
r = {}; r = {};
r.clip = null; r.clip = null;
r.bus = new BroadcastChannel("fileman_bus"); try {
r.bus = new BroadcastChannel("fileman_bus");
}
catch (ex) { }
r.render = function () { r.render = function () {
if (r.clip === null) if (r.clip === null)
@ -1920,7 +1923,7 @@ var fileman = (function () {
deleter(); deleter();
} }
modal.confirm('===== DANGER =====\nDELETE these ' + vps.length + ' items?\n\n' + vps.join('\n'), function () { modal.confirm('===== DANGER =====\nDELETE these ' + vps.length + ' items?\n\n' + uricom_adec(vps).join('\n'), function () {
modal.confirm('Last chance! Delete?', deleter, null); modal.confirm('Last chance! Delete?', deleter, null);
}, null); }, null);
}; };
@ -1936,14 +1939,15 @@ var fileman = (function () {
if (!sel.length) if (!sel.length)
return toast.err(3, 'select at least 1 item to cut'); return toast.err(3, 'select at least 1 item to cut');
for (var a = 0; a < sel.length; a++) { if (sel.length < 100)
vps.push(sel[a].vp); for (var a = 0; a < sel.length; a++) {
var cl = ebi(sel[a].id).closest('tr').classList, vps.push(sel[a].vp);
inv = cl.contains('c1'); var cl = ebi(sel[a].id).closest('tr').classList,
inv = cl.contains('c1');
cl.remove(inv ? 'c1' : 'c2'); cl.remove(inv ? 'c1' : 'c2');
cl.add(inv ? 'c2' : 'c1'); cl.add(inv ? 'c2' : 'c1');
} }
toast.inf(1, 'cut ' + sel.length + ' items'); toast.inf(1, 'cut ' + sel.length + ' items');
jwrite('fman_clip', vps); jwrite('fman_clip', vps);
@ -2021,15 +2025,19 @@ var fileman = (function () {
}, null); }, null);
}; };
r.bus.onmessage = function (e) { if (r.bus)
r.clip = null; r.bus.onmessage = function (e) {
r.render(); r.clip = null;
var me = get_evpath(); r.render();
if (e && e.data == me) var me = get_evpath();
treectl.goto(e.data); if (e && e.data == me)
}; treectl.goto(e.data);
};
r.tx = function (msg) { r.tx = function (msg) {
if (!r.bus)
return;
r.bus.postMessage(msg); r.bus.postMessage(msg);
r.bus.onmessage(); r.bus.onmessage();
}; };

View file

@ -18,6 +18,10 @@ html, body {
background: #f7f7f7; background: #f7f7f7;
color: #333; color: #333;
} }
#toast {
bottom: auto;
top: 1.4em;
}
#mn { #mn {
font-weight: normal; font-weight: normal;
margin: 1.3em 0 .7em 1em; margin: 1.3em 0 .7em 1em;

View file

@ -155,6 +155,9 @@ html.light #tt em {
padding: 1em 1.1em; padding: 1em 1.1em;
border-radius: .6em; border-radius: .6em;
box-shadow: 0 .3em 3em rgba(0,0,0,0.5); box-shadow: 0 .3em 3em rgba(0,0,0,0.5);
max-width: 50em;
max-height: 30em;
overflow: auto;
} }
@media (min-width: 40em) { @media (min-width: 40em) {
#modalc { #modalc {

View file

@ -733,15 +733,10 @@ var modal = (function () {
if (a) if (a)
a.onclick = ng; a.onclick = ng;
var a = ebi('modal-ok'); a = ebi('modal-ok');
if (a) { a.onclick = ok;
a.onclick = ok;
a.focus();
}
var a = ebi('modali'); (ebi('modali') || a).focus();
if (a)
a.focus();
}; };
r.hide = function () { r.hide = function () {