ajax navigation in table listing too

This commit is contained in:
ed 2021-10-24 00:54:22 +02:00
parent 060dc54832
commit dfd89b503a
2 changed files with 25 additions and 12 deletions

View file

@ -1281,6 +1281,7 @@ html.light #files a:hover,
html.light #files tr.sel a:hover {
color: #000;
background: #fff;
text-decoration: underline;
}
html.light #treeh {
background: #f7f7f7;

View file

@ -2351,17 +2351,8 @@ var thegrid = (function () {
td = oth.closest('td').nextSibling,
tr = td.parentNode;
if (href.endsWith('/')) {
var ta = QSA('#treeul a.hl+ul>li>a+a'),
txt = oth.textContent.slice(0, -1);
for (var a = 0, aa = ta.length; a < aa; a++) {
if (ta[a].textContent == txt) {
in_tree = ta[a];
break;
}
}
}
if (href.endsWith('/'))
in_tree = treectl.find(oth.textContent.slice(0, -1));
if (r.sel) {
td.click();
@ -3159,10 +3150,17 @@ var treectl = (function () {
onscroll();
}
treectl.find = function (txt) {
var ta = QSA('#treeul a.hl+ul>li>a+a');
for (var a = 0, aa = ta.length; a < aa; a++)
if (ta[a].textContent == txt)
return ta[a];
};
treectl.goto = function (url, push) {
get_tree("", url, true);
reqls(url, push, true);
}
};
function get_tree(top, dst, rst) {
var xhr = new XMLHttpRequest();
@ -4421,6 +4419,20 @@ function goto_unpost(e) {
}
ebi('files').onclick = function (e) {
var tgt = e.target.closest('a[id]');
if (!tgt || tgt.getAttribute('id').indexOf('f-') !== 0 || !tgt.textContent.endsWith('/'))
return;
var el = treectl.find(tgt.textContent.slice(0, -1));
if (!el)
return;
ev(e);
el.click();
}
function reload_mp() {
if (mp && mp.au) {
mp.au.pause();