mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add filetable range-select with shift-pgup/pgdn,
and retain file selection cursor when lazyloading more files
This commit is contained in:
parent
c9492d16ba
commit
f7ceae5a5f
|
@ -4679,6 +4679,7 @@ function hkhelp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var fselgen, fselctr;
|
||||||
document.onkeydown = function (e) {
|
document.onkeydown = function (e) {
|
||||||
if (e.altKey || e.isComposing)
|
if (e.altKey || e.isComposing)
|
||||||
return;
|
return;
|
||||||
|
@ -4723,15 +4724,26 @@ document.onkeydown = function (e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aet == 'tr' && ae.closest('#files')) {
|
if (aet == 'tr' && ae.closest('#files')) {
|
||||||
var d = '';
|
var d = '', rem = 0;
|
||||||
if (k == 'ArrowUp') d = 'previous';
|
if (k == 'ArrowUp') d = 'previous';
|
||||||
if (k == 'ArrowDown') d = 'next';
|
if (k == 'ArrowDown') d = 'next';
|
||||||
|
if (k == 'PageUp') { d = 'previous'; rem = 0.6; }
|
||||||
|
if (k == 'PageDown') { d = 'next'; rem = 0.6; }
|
||||||
if (d) {
|
if (d) {
|
||||||
var el = ae[d + 'ElementSibling'];
|
fselctr = 0;
|
||||||
if (el) {
|
var gen = fselgen = Date.now();
|
||||||
|
if (rem)
|
||||||
|
rem *= window.innerHeight;
|
||||||
|
|
||||||
|
function selfun() {
|
||||||
|
var el = ae[d + 'ElementSibling'];
|
||||||
|
if (!el || gen != fselgen)
|
||||||
|
return;
|
||||||
|
|
||||||
el.focus();
|
el.focus();
|
||||||
|
var elh = el.offsetHeight;
|
||||||
if (ctrl(e))
|
if (ctrl(e))
|
||||||
document.documentElement.scrollTop += (d == 'next' ? 1 : -1) * el.offsetHeight;
|
document.documentElement.scrollTop += (d == 'next' ? 1 : -1) * elh;
|
||||||
|
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
clmod(el, 'sel', 't');
|
clmod(el, 'sel', 't');
|
||||||
|
@ -4739,8 +4751,17 @@ document.onkeydown = function (e) {
|
||||||
msel.selui();
|
msel.selui();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ev(e);
|
rem -= elh;
|
||||||
|
if (rem > 0) {
|
||||||
|
ae = document.activeElement;
|
||||||
|
if (++fselctr % 5 && rem > elh * (FIREFOX ? 5 : 2))
|
||||||
|
selfun();
|
||||||
|
else
|
||||||
|
setTimeout(selfun, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
selfun();
|
||||||
|
return ev(e);
|
||||||
}
|
}
|
||||||
if (k == 'Space') {
|
if (k == 'Space') {
|
||||||
clmod(ae, 'sel', 't');
|
clmod(ae, 'sel', 't');
|
||||||
|
@ -5776,9 +5797,15 @@ var treectl = (function () {
|
||||||
var nodes = res.dirs.concat(res.files),
|
var nodes = res.dirs.concat(res.files),
|
||||||
html = mk_files_header(res.taglist),
|
html = mk_files_header(res.taglist),
|
||||||
sel = r.lsc === res ? msel.getsel() : [],
|
sel = r.lsc === res ? msel.getsel() : [],
|
||||||
|
ae = document.activeElement,
|
||||||
|
cid = null,
|
||||||
plain = [],
|
plain = [],
|
||||||
seen = {};
|
seen = {};
|
||||||
|
|
||||||
|
if (ae && /^tr$/i.exec(ae.nodeName))
|
||||||
|
if (ae = ae.querySelector('a[id]'))
|
||||||
|
cid = ae.getAttribute('id');
|
||||||
|
|
||||||
r.lsc = res;
|
r.lsc = res;
|
||||||
if (res.unlist) {
|
if (res.unlist) {
|
||||||
var ptn = new RegExp(res.unlist);
|
var ptn = new RegExp(res.unlist);
|
||||||
|
@ -5878,6 +5905,10 @@ var treectl = (function () {
|
||||||
else
|
else
|
||||||
msel.origin_id(null);
|
msel.origin_id(null);
|
||||||
|
|
||||||
|
if (cid) try {
|
||||||
|
ebi(cid).closest('tr').focus();
|
||||||
|
} catch (ex) { }
|
||||||
|
|
||||||
setTimeout(eval_hash, 1);
|
setTimeout(eval_hash, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue