mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
keep active dir scrolled into view on keybd nav
This commit is contained in:
parent
789724e348
commit
3e8541362a
|
@ -1711,6 +1711,25 @@ var thegrid = (function () {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
function tree_scrollto() {
|
||||||
|
var act = QS('#treeul a.hl');
|
||||||
|
if (!act)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var ctr = ebi('tree'),
|
||||||
|
ul = act.offsetParent,
|
||||||
|
em = parseFloat(getComputedStyle(act).fontSize),
|
||||||
|
top = act.offsetTop + ul.offsetTop,
|
||||||
|
min = top - 11 * em,
|
||||||
|
max = top - (ctr.offsetHeight - 10 * em);
|
||||||
|
|
||||||
|
if (ctr.scrollTop > min)
|
||||||
|
ctr.scrollTop = Math.floor(min);
|
||||||
|
else if (ctr.scrollTop < max)
|
||||||
|
ctr.scrollTop = Math.floor(max);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function tree_neigh(n) {
|
function tree_neigh(n) {
|
||||||
var links = QSA('#treeul li>a+a');
|
var links = QSA('#treeul li>a+a');
|
||||||
if (!links.length) {
|
if (!links.length) {
|
||||||
|
@ -1736,6 +1755,7 @@ function tree_neigh(n) {
|
||||||
if (act >= links.length)
|
if (act >= links.length)
|
||||||
act = 0;
|
act = 0;
|
||||||
|
|
||||||
|
treectl.dir_cb = tree_scrollto;
|
||||||
links[act].click();
|
links[act].click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue