mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
hotkeys for directory traversal
This commit is contained in:
parent
6b3295059e
commit
f991f74983
|
@ -307,10 +307,14 @@ var vbar = (function () {
|
||||||
|
|
||||||
|
|
||||||
function seek_au_mul(mul) {
|
function seek_au_mul(mul) {
|
||||||
seek_au_sec(mp.au.duration * mul);
|
if (mp.au)
|
||||||
|
seek_au_sec(mp.au.duration * mul);
|
||||||
}
|
}
|
||||||
|
|
||||||
function seek_au_sec(seek) {
|
function seek_au_sec(seek) {
|
||||||
|
if (!mp.au)
|
||||||
|
return;
|
||||||
|
|
||||||
console.log('seek: ' + seek);
|
console.log('seek: ' + seek);
|
||||||
if (!isFinite(seek))
|
if (!isFinite(seek))
|
||||||
return;
|
return;
|
||||||
|
@ -608,6 +612,34 @@ function autoplay_blocked() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
function tree_neigh(n) {
|
||||||
|
var links = document.querySelectorAll('#treeul li>a+a');
|
||||||
|
var act = -1;
|
||||||
|
for (var a = 0, aa = links.length; a < aa; a++) {
|
||||||
|
if (links[a].getAttribute('class') == 'hl') {
|
||||||
|
act = a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a += n;
|
||||||
|
if (a < 0)
|
||||||
|
a = links.length - 1;
|
||||||
|
if (a >= links.length)
|
||||||
|
a = 0;
|
||||||
|
|
||||||
|
links[a].click();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tree_up() {
|
||||||
|
var act = document.querySelector('#treeul a.hl');
|
||||||
|
if (act.previousSibling.textContent == '-')
|
||||||
|
return act.previousSibling.click();
|
||||||
|
|
||||||
|
act.parentNode.parentNode.parentNode.getElementsByTagName('a')[1].click();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
document.onkeydown = function (e) {
|
document.onkeydown = function (e) {
|
||||||
if (document.activeElement != document.body && document.activeElement.nodeName.toLowerCase() != 'a')
|
if (document.activeElement != document.body && document.activeElement.nodeName.toLowerCase() != 'a')
|
||||||
return;
|
return;
|
||||||
|
@ -625,7 +657,14 @@ document.onkeydown = function (e) {
|
||||||
|
|
||||||
n = k == 'KeyU' ? -10 : k == 'KeyO' ? 10 : 0;
|
n = k == 'KeyU' ? -10 : k == 'KeyO' ? 10 : 0;
|
||||||
if (n !== 0)
|
if (n !== 0)
|
||||||
return seek_au_sec(mp.au.currentTime + n);
|
return mp.au ? seek_au_sec(mp.au.currentTime + n) : true;
|
||||||
|
|
||||||
|
n = k == 'KeyI' ? -1 : k == 'KeyK' ? 1 : 0;
|
||||||
|
if (n !== 0)
|
||||||
|
return tree_neigh(n);
|
||||||
|
|
||||||
|
if (k == 'KeyP')
|
||||||
|
return tree_up();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue