add buttons for prev/next folder

This commit is contained in:
ed 2022-11-19 22:19:38 +00:00
parent d1eb113ea8
commit ab655a56af
3 changed files with 26 additions and 5 deletions

View file

@ -857,6 +857,12 @@ html.y #path a:hover {
color: var(--srv-3); color: var(--srv-3);
border-bottom: 1px solid var(--srv-3b); border-bottom: 1px solid var(--srv-3b);
} }
#goh+span {
color: var(--bg-u5);
padding-left: .5em;
margin-left: .5em;
border-left: .2em solid var(--bg-u5);
}
#repl { #repl {
padding: .33em; padding: .33em;
} }

View file

@ -2806,6 +2806,7 @@ function eval_hash() {
(function () { (function () {
// a11y jump-to-content
for (var a = 0; a < 2; a++) for (var a = 0; a < 2; a++)
(function (a) { (function (a) {
var d = mknod('a'); var d = mknod('a');
@ -2822,8 +2823,16 @@ function eval_hash() {
}; };
})(a); })(a);
// account-info label
var d = mknod('div', 'acc_info'); var d = mknod('div', 'acc_info');
document.body.insertBefore(d, ebi('ops')); document.body.insertBefore(d, ebi('ops'));
// folder nav
ebi('goh').parentElement.appendChild(mknod('span', null,
'<a href="#" id="gop">prev</a>/<a href="#" id="gou">up</a>/<a href="#" id="gon">next</a>'));
ebi('gop').onclick = function () { tree_neigh(-1); }
ebi('gon').onclick = function () { tree_neigh(1); }
ebi('gou').onclick = function () { tree_up(true); }
})(); })();
@ -4274,7 +4283,7 @@ function tree_neigh(n) {
} }
function tree_up() { function tree_up(justgo) {
if (showfile.active()) if (showfile.active())
return thegrid.setvis(true); return thegrid.setvis(true);
@ -4284,9 +4293,11 @@ function tree_up() {
treectl.entree(null, true); treectl.entree(null, true);
return; return;
} }
if (act.previousSibling.textContent == '-') if (act.previousSibling.textContent == '-') {
return act.previousSibling.click(); act.previousSibling.click();
if (!justgo)
return;
}
act.parentNode.parentNode.parentNode.getElementsByTagName('a')[1].click(); act.parentNode.parentNode.parentNode.getElementsByTagName('a')[1].click();
} }

View file

@ -54,11 +54,15 @@ var ebi = document.getElementById.bind(document),
XHR = XMLHttpRequest; XHR = XMLHttpRequest;
function mknod(et, eid) { function mknod(et, eid, html) {
var ret = document.createElement(et); var ret = document.createElement(et);
if (eid) if (eid)
ret.id = eid; ret.id = eid;
if (html)
ret.innerHTML = html;
return ret; return ret;
} }