mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add play/pause hotkey
This commit is contained in:
parent
076e103d53
commit
1aa9033022
|
@ -171,7 +171,7 @@ the browser has the following hotkeys
|
||||||
* `0..9` jump to 10%..90%
|
* `0..9` jump to 10%..90%
|
||||||
* `U/O` skip 10sec back/forward
|
* `U/O` skip 10sec back/forward
|
||||||
* `J/L` prev/next song
|
* `J/L` prev/next song
|
||||||
* `J` also starts playing the folder
|
* `M` play/pause (also starts playing the folder)
|
||||||
* in the grid view:
|
* in the grid view:
|
||||||
* `S` toggle multiselect
|
* `S` toggle multiselect
|
||||||
* `A/D` zoom
|
* `A/D` zoom
|
||||||
|
|
|
@ -445,19 +445,22 @@ function song_skip(n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function playpause(e) {
|
||||||
|
ev(e);
|
||||||
|
if (mp.au) {
|
||||||
|
if (mp.au.paused)
|
||||||
|
mp.au.play();
|
||||||
|
else
|
||||||
|
mp.au.pause();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
play(0);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// hook up the widget buttons
|
// hook up the widget buttons
|
||||||
(function () {
|
(function () {
|
||||||
ebi('bplay').onclick = function (e) {
|
ebi('bplay').onclick = playpause;
|
||||||
ev(e);
|
|
||||||
if (mp.au) {
|
|
||||||
if (mp.au.paused)
|
|
||||||
mp.au.play();
|
|
||||||
else
|
|
||||||
mp.au.pause();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
play(0);
|
|
||||||
};
|
|
||||||
ebi('bprev').onclick = function (e) {
|
ebi('bprev').onclick = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
song_skip(-1);
|
song_skip(-1);
|
||||||
|
@ -1227,6 +1230,9 @@ document.onkeydown = function (e) {
|
||||||
if (n !== 0)
|
if (n !== 0)
|
||||||
return song_skip(n);
|
return song_skip(n);
|
||||||
|
|
||||||
|
if (k == 'KeyM')
|
||||||
|
return playpause();
|
||||||
|
|
||||||
n = k == 'KeyU' ? -10 : k == 'KeyO' ? 10 : 0;
|
n = k == 'KeyU' ? -10 : k == 'KeyO' ? 10 : 0;
|
||||||
if (n !== 0)
|
if (n !== 0)
|
||||||
return mp.au ? seek_au_sec(mp.au.currentTime + n) : true;
|
return mp.au ? seek_au_sec(mp.au.currentTime + n) : true;
|
||||||
|
|
Loading…
Reference in a new issue